function SelectRandom()
  if not flags.hidden_garderob or (not flags.hidden_garderob_two and flags.mini_dnk  and flags.mini_notebook) then
    selectrandomobject1(1.5,5)
  return;end;
  if obj.verev~=nil and not obj.verev.is_collapsed then
        selectrandomobject1(1.5,220,false);
  end;      
  
  if obj.kamen~=nil and obj.kamen.is_collapsed and not flags.vaza_svecha then
    if flags.vase_brokeM then
        selectrandomobject1(1.5,12);
    return;end;
        selectrandomobject1(1.5,10);
  return;end; 
  if obj.klyk~=nil and obj.klyk.is_collapsed and not flags.volf then
      selectrandomobject1(1.5,19);
  return;end;   
  if obj.biven~=nil and obj.biven.is_collapsed and not flags.vepr then
      selectrandomobject1(1.5,15);
  return;end;    
  if flags.volf and flags.vepr and not flags.tiger then
      selectrandomobject1(1.5,17);
  return;end;
  if obj.stdwa~=nil and obj.stdwa.is_collapsed and obj.totem~=nil and obj.totem.is_collapsed and not flags.kamin_mayor  then
      selectrandomobject1(1.5,50);
  return;end; 
  if obj.sovok~=nil and obj.sovok.is_collapsed and not flags.kamin then
      selectrandomobject1(1.5,48);
  return;end; 
  if  flags.kamin and not flags.kamin_puzzle then
      selectrandomobject1(1.5,48);
  return;end;  
  if flags.kamin_puzzle and flags.kamin_mayor and not flags.seyf_kartina then
    if not flags.kartina_sdvig then
       selectrandomobject1(1.5,49);
    return;end;
    if flags.safe_completeM then
       selectrandomobject1(1.5,26);
    return;end;
    selectrandomobject1(1.5,25);
  return;end;
  if obj.fomka~=nil and obj.fomka.is_collapsed and not flags.mayor_wind then
      selectrandomobject1(1.5,41);
  return;end;   
   not_hint=true
CreatePlashechka(900000,"10005")

return;end;

function SetParticles()

    if obj.verev~=nil and not obj.verev.is_collapsed then
      AddParticleToObject(220,"fomka",658,424);
      MoveEmiter("fomka",685,424);
      StartEmiter("fomka");    
    end;
    if not flags.vaza_svecha then
      AddParticleToObject(10,"vaza_mayor",340,408);
      MoveEmiter("vaza_mayor",340,408);
      StartEmiter("vaza_mayor");
    end;
    if not flags.mayor_wind then
      AddParticleToObject(41,"mayor_wind",191,210);
      MoveEmiter("mayor_wind",191,210);
      StartEmiter("mayor_wind");
    end;
    if not flags.hidden_garderob then
      AddParticleToObject(5,"garderob",55,561);
      MoveEmiter("garderob",55,561);
      StartEmiter("garderob");
    end;
    if (not flags.hidden_garderob_two) and (flags.mini_dnk and flags.mini_notebook) then
      AddParticleToObject(5,"garderob",55,561);
      MoveEmiter("garderob",55,561);
      StartEmiter("garderob");
    end;
    if not flags.volf then
      AddParticleToObject(19,"volf",358,158);
      MoveEmiter("volf",358,158);
      StartEmiter("volf");
    end;
    if not flags.vepr then
      AddParticleToObject(15,"vepr",512,164);
      MoveEmiter("vepr",512,164);
      StartEmiter("vepr");
    end;
    if not flags.tiger then
      AddParticleToObject(17,"tiger",442,256);
      MoveEmiter("tiger",442,256);
      StartEmiter("tiger");
    end;
    if not flags.kamin_mayor then
      AddParticleToObject(50,"kamin_stat",842,291);
      MoveEmiter("kamin_stat",842,291);
      StartEmiter("kamin_stat");
    end;
    if flags.kartina_sdvig and not flags.seyf_kartina then
    if not flags.safe_complete then
      AddParticleToObject(25,"seyf_mayor",662,185);
      MoveEmiter("seyf_mayor",662,185);
      StartEmiter("seyf_mayor");
    else
      AddParticleToObject(26,"seyf_mayor",662,185);
      MoveEmiter("seyf_mayor",662,185);
      StartEmiter("seyf_mayor");    
    end;
    end;
    if not flags.kamin_puzzle then
      AddParticleToObject(48,"kamin",847,424);
      MoveEmiter("kamin",847,424);
      StartEmiter("kamin");
    end;
end;


function SetCursors()
    WriteToConsole("Set Cursors Start \n")
    ItemsCur={}
    PointingItems={}
    Set_Anim_Cur(33,17);
    if obj.verev~=nil and not obj.verev.is_collapsed then
        Set_Anim_Cur(220,4);
    end;    	
    if not flags.kamin_puzzle then
        Set_Anim_Cur(48,2);
    end;
    if not flags.vaza_svecha then
        Set_Anim_Cur(10,2);
    end;
    if not flags.vepr then
        Set_Anim_Cur(15,2)
    end;
    if not flags.tiger then
        Set_Anim_Cur(17,2);
    end;
    if not flags.volf then
        Set_Anim_Cur(19,2);
    end;
    if not flags.mayor_wind then
        Set_Anim_Cur(41,2);
    end;
    if not flags.kamin_mayor then
        Set_Anim_Cur(50,2);
    end;
    if flags.vase_brokeM and not flags.vaza_svecha then
        Set_Anim_Cur(12,2);        
    end;
    if (not flags.hidden_garderob or (not flags.hidden_garderob_two and flags.mini_dnk  and flags.mini_notebook))then
      Set_Anim_Cur(5,2);
    end;
    if flags.kamin_mayor then
      Set_Anim_Cur(49,4);
    end;
    if flags.kartina_sdvig and not flags.seyf_kartina then
      Set_Anim_Cur(25,2);
    end;
    if flags.mayor_wind then
      Set_Anim_Cur(42,16);
    end;
    WriteToConsole("Set Cursors Finish \n")
end;

function ActionsJump ()
    
end;

function gameinput (sender,obj_id,attachedID)  
WriteToConsole("IN GAMEINPUT sender = "..sender.." obj_id= "..obj_id.."\n")

    CursorTreatment(obj_id,sender,attachedID); 
      if sender==33 then
        if not open_tiger then
        Block_Show_Cur(false);
        end;
        if obj_id==120 then
            if st_flame==1 then
                SetAlfa(120,0.5,0.7,0.3)
            end;
            if st_flame==2 then
                SetAlfa(120,0.7,0.2,0.45)
            end;
            if st_flame==3 then
                SetAlfa(120,0.2,0.6,0.2)
            end;
            if st_flame==4 then
                SetAlfa(120,0.6,0.3,0.25)
            end;
            if st_flame==5 then
                SetAlfa(120,0.3,1,0.3)
            end;
            if st_flame==6 then
                SetAlfa(120,1,0.5,0.2)
                st_flame=0
            end;    
            st_flame = st_flame+1;            
        return;end;
    return;end; 
    
    if sender==28 then
        if obj_id==24 then
            Block_Show_Cur(false)
            CreatePlashechka(900000,"2014")    
          flags.kartina_sdvig = true;
          StopEmiter("kartina_house");
          speciale_action(2,25)
          Set_Anim_Cur(25,2);
          AddParticleToObject(25,"seyf_mayor",662,185);
          MoveEmiter("seyf_mayor",662,185);
          StartEmiter("seyf_mayor");            
        return;end;
    return;end;
    
    if sender==100 then
        SetCursors()
        SetParticles()
        BlockCursor(false)
        playeffect("fon_room",true);
        if flags.is_hidden_finish then
            flags.is_hidden_finish=false
            Set_Anim_Cur(5,3);
        end;
        if fromkamin then
            IsMiniGame=true        
            Set_Sat1("kamin_puzzle",8,11,"mayor_house")    
        end;
        StartTimer(67545,0.5)
    return;end;
  if sender==16 then
    if obj_id==101 or obj_id==103 or obj_id==105 or obj_id==107 or obj_id==109 or obj_id==111 or obj_id==113 or obj_id==115 or obj_id==117 then
        speciale_action(2,obj_id,true,3.7)
        speciale_action(2,obj_id+1,true,4)
    return;end;
    if obj_id==102 or obj_id==104 or obj_id==106 or obj_id==108 or obj_id==110 or obj_id==112 or obj_id==114 or obj_id==116 or obj_id==118 then
        speciale_action(2,obj_id,true,3.7)
        speciale_action(2,obj_id-1,true,4)    
    return;end;    
  return;end;  

  if sender == 1 then
  
    g_attachedID = attachedID;
  
	if obj_id==220 then
        StopEmiter("fomka")
        Set_Anim_Cur(220,3);
        StoreObj(obj.verev.id,obj_id,"155",285,350,"verevka",323,217)    		
	return;end;
  
    if obj_id == 10 or obj_id == 12 then
      if not flags.vaza_svecha then
        s_obj=attachedID            
        RemObjFromMouse()
        Set_Sat("vaza_svecha",8,2,"mayor_house")
      return; end;
    return; end;
    
    if obj_id == 15 then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("vepr",8,4,"mayor_house")
    return; end;
    
    if obj_id == 19 then
        RemObjFromMouse()
        s_obj=attachedID      
        Set_Sat("volf",8,3,"mayor_house")
    return; end;
    
    if obj_id == 17 then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("tiger",8,8,"mayor_house")
    return; end;
    
    if obj_id == 49 then
      flags.kartina_sdvig = true;
      StopEmiter("kartina_house");
      speciale_action(2,25)
      Set_Anim_Cur(25,2);
      AddParticleToObject(25,"seyf_mayor",662,185);
      MoveEmiter("seyf_mayor",662,185);
      StartEmiter("seyf_mayor");
    return; end;
    
    if obj_id == 25 or obj_id == 26 then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("seyf_kartina",8,12,"mayor_house")
    return; end;
    
    if obj_id == 50 then
        RemObjFromMouse()
        s_obj=attachedID      
        Set_Sat("kamin",8,5,"mayor_house")
    return; end;
    
    if obj_id == 41 then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("mayor_wind",8,7,"mayor_house")
    return; end;
    
    if obj_id == 42 then
        flags.is_jumping = false;
        playeffect("step_street")
        RemObjFromMouse()
        jump("mayor_house","mayor_yard",6,0);
    return; end;
    
    if obj_id == 48 then
      if not flags.kamin then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("kamin_pepel",8,6,"mayor_house")    
      return; end;
      if flags.kamin and not flags.kamin_puzzle then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("kamin_puzzle",8,11,"mayor_house")    
      return; end;
    return; end;
    
    if obj_id == 5 and (not flags.hidden_garderob or (not flags.hidden_garderob_two and flags.mini_dnk and flags.mini_notebook)) then
        flags.is_hidden_loc = true;
        RemObjFromMouse()
        jump("mayor_house","garderob",8,1);        
    return; end;    
    
    if obj_id == 33 then
        playeffect("step_room")
        RemObjFromMouse()    
        jump("mayor_house","jmp_mayor_house",50,2);
    return; end;

  return; end;
  
  if sender == 36 then
    -- if obj_id==67545 then
      -- StartEmiter("d");
      -- SetAlfa(220,1,0,1)
    -- StartTimer(67546,1)
    -- end;
    -- if obj_id==67546 then
      -- StopEmiter("d",true);
    -- end;    
    if obj_id==5678 then
        RemObjFromMouse()
        Set_Sat("tiger",8,8,"mayor_house")    
    return;end;
  return; end;
end
function SheetSwitched(nCount)
end;