function SelectRandom()
  if (not flags.hidden4) or (flags.mayor_wind and not flags.hidden_saray_dwa) then
    selectrandomobject1(1.5,8,false);
  return;end;
  if (not flags.jashik) and (obj.tvrtk~=nil and obj.tvrtk.is_collapsed) then
    selectrandomobject1(1.5,3,false);
  return;end;
  if (not flags.jama) and (obj.lopat~=nil and obj.lopat.is_collapsed ) then
    selectrandomobject1(1.5,7,false);
  return;end;  
  if flags.jama and not flags.mayor_wind then
     selectrandomobject1(1.5,5,false); 
  return;end;
   not_hint=true
CreatePlashechka(900000,"10005")
return;end;

function ActionsJump (atID)
    StRot6=true
    StopRotate(5)
    StopRotate(6)        
end;


function SetParticles()
    AddParticleToObject(12,"FlyList3",100,0);
    MoveEmiter("FlyList3",100,0);
    StartEmiter("FlyList3");
    if not flags.jashik then
        AddParticleToObject(3,"pogarbox",505,525);
        MoveEmiter("pogarbox",505,525);
        StartEmiter("pogarbox");
    end;
    if not flags.jama then
        AddParticleToObject(7,"jama",751,460);
        MoveEmiter("jama",751,460);
        StartEmiter("jama");
    end;
    if not flags.hidden4 or (not flags.hidden_saray_dwa and flags.mayor_wind ) then
        AddParticleToObject(8,"saray",955,421);
        MoveEmiter("saray",955,421);
        StartEmiter("saray");
    end;    
end;

function SetCursors()
    ItemsCur={}
    PointingItems={}
    Set_Anim_Cur(15,2);
    Set_Anim_Cur(12,11);
    if not flags.jashik then
        Set_Anim_Cur(3,2);
    end;
    if not flags.jama then
        Set_Anim_Cur(7,2);
    end;
    if flags.mayor_wind then
      Set_Anim_Cur(9,14);
    end;
    if flags.jama then
      Set_Anim_Cur(5,2);
    end;
    if (not flags.hidden4) or (flags.mayor_wind and not flags.hidden_saray_dwa) then
      Set_Anim_Cur(8,2);
    end;
end;


function gameinput (sender,obj_id,attachedID)    
CursorTreatment(obj_id,sender,attachedID);     

if sender==7  and not StRot6 then
    if obj_id==25 then
        if V1 then
        V1=false
        RotateObject(obj_id,5,0,4)
        else
        V1=true
        RotateObject(obj_id,0,5,4)
        end;
    end;
    if obj_id==6 then
        if V2 then
        V2=false
        RotateObject(obj_id,-5,0,4.5)
        else
        V2=true
        RotateObject(obj_id,0,-5,4.5)
        end;
    end;    
return;end;


if sender == 100 then
    playeffect("fon_street",true);
    SetParticles()
    SetCursors()
    BlockCursor(false)
    StRot6=false
    RotateObject(25,0,5,4)
    RotateObject(6,0,-5,4.5)
    V1=true
    V2=true    
    if flags.is_hidden_finish then
        flags.is_hidden_finish=false
        ActivateObject(8,false);
        Set_Anim_Cur(8,3);
        StopEmiter("saray");
    end;

      if flags.mayor_wind and not flags.mayor_wind_not_first and flags.is_jumping then
        if not open_window then
            open_window=true
            speciale_action(2,9);
            speciale_action(2,10);
            Set_Anim_Cur(10,14);
        end;
        -- Set_Anim_Cur(15,3);
        -- ActivateObject(15,false)
        flags.mayor_wind_not_first = true;
      return;end;
    if proval then
      speciale_action(2,5);
      Set_Anim_Cur(5,2);
      ActivateObject(7,false);
      Set_Anim_Cur(7,3);
      StopEmiter("jama"); 
      flags.is_comics=true    
      jump("mayor_yard","comicsp",7,50);     
    return;end; 
return; end;

  if sender==44 then
    AboutItem(obj_id)
  return;end; 

if sender == 1 then

  g_attachedID = attachedID;

  if obj_id == 8 and ((not flags.hidden4) or (flags.mayor_wind and not flags.hidden_saray_dwa)) then
    flags.is_hidden_loc = true;
    RemObjFromMouse()
    jump("mayor_yard","saray",6,3);
  return; end;
  
  if obj_id == 9 then
     playeffect("step_room")
    RemObjFromMouse()
    jump("mayor_yard","mayor_house",8,0);
    if not flags.hidden_garderob_two and flags.mini_dnk and flags.mini_opyt_blood and flags.mini_notebook then
      Set_Anim_Cur(5,2);
      AddParticleToObject(5,"garderob",55,561);
      MoveEmiter("garderob",55,561);
      StartEmiter("garderob");
    end;
  return; end;
  
  if obj_id == 12 then
    playeffect("step_street")
    RemObjFromMouse()    
    jump("mayor_yard","mayor_portal",5,0);
  return; end;
  
  if obj_id == 5 then
    CreatePlashechka(900000,"2009")
  return; end;
 
  if obj_id == 15 then
    CreatePlashechka(900000,"1002")
  return; end;
 
  if obj_id == 7 then
    s_obj=attachedID        
    RemObjFromMouse()
    Set_Sat("jama",6,1,"mayor_yard")
  return; end;
  
  if obj_id == 3 then
    s_obj=attachedID         
    RemObjFromMouse()
    Set_Sat("jashik",6,2,"mayor_yard")
  return; end;
return; end;  
end
function SheetSwitched(nCount)
end;