function SelectRandom()
  idObject=GetRandomObject();
  giveMeHint(idObject);
end;

function mini_create()
  init_mini(true)
  create_mini(8128);
end

if flags.fotoBaleriny then
  miniCreate()
end

local state = {2,3,1,5,6,4,8,9,7,11,10}
local noga = 2
local rukalev = 6
local rukaprav = 7
local golova = 10
flags.videlbalerinu = true
local finish = false

function gameinput (sender,obj_id,attachedID)
  MiniInterfaceHandler(sender, obj_id,attachedID);
  sendersProcessing(sender,obj_id,attachedID)
  if wrongItemWarning(sender, obj_id, attachedID) then
    return
  end
  --out("gameinput("..tostring(sender)..","..tostring(obj_id)..","..tostring(attachedID)..")\n")
  if sender==1 then
    if not flags.fotoBaleriny then
      CreatePlashechka("555","he")
    end  
    if obj_id >= 1 and obj_id <= 11 then
      if flags.fotoBaleriny then
        speciale_action(2,obj_id,true,0.5)
        speciale_action(2,state[obj_id],true,0.5)
        playeffect("balet")
        if obj_id >= 1 and obj_id <= 3 then
          noga = state[obj_id]
        elseif obj_id >= 4 and obj_id <= 6 then
          rukalev = state[obj_id]
        elseif obj_id >= 7 and obj_id <= 9 then
          rukaprav = state[obj_id]
        else
          golova = state[obj_id]
        end
        checkMini()
      else
        CreatePlashechka("555","he")
      end
    end
  end
  if sender == 10 then
    neighbors.HollMuzeyaBalerina.lock = true
    neighbors.HollMuzeyaTajnik.lock = false
    neighbors.HollMuzeyaHidden.lock = false
    flags.HollMuzeyaHidden2=true;
    finish = true
    for i=1,11,1 do
      setCursor(i,3)
    end;    
    playeffect("mini_complete")
    if noga ~= 3 then
      speciale_action(2,noga,true,1.5)
      speciale_action(2,3,true,1.5)
    end
    if rukalev ~= 4 then
      speciale_action(2,rukalev,true,1.5)
      speciale_action(2,4,true,1.5)
    end
    if rukaprav ~= 9 then
      speciale_action(2,rukaprav,true,1.5)
      speciale_action(2,9,true,1.5)
    end
    if golova ~= 11 then
      speciale_action(2,golova,true,1.5)
      speciale_action(2,11,true,1.5)
    end
    StartTimer(timerID,2,"CloseSatelite")
  end
end

function checkMini()
  --out("\n")
  --out("noga="..noga.."\n")
  --out("rukalev="..rukalev.."\n")
  --out("rukaprav="..rukaprav.."\n")
  --out("golova="..golova.."\n")
  if noga == 3 and rukalev == 4 and rukaprav == 9 and golova == 11 then
    finish_mini_game(true)
  end
end


