skip = false;
function Buttons_T(sender,id)
   ButtonTreatment(id,10001,10002,10003,CloseBtnX,CloseBtnY,CloseWidth,CloseHeight,sender,"secret_room",true)
   ButtonTreatment(id,10021,10022,10023,HelpBtnX,HelpBtnY,HelpWidth,HelpHeight,sender,"secret_room",true,150,200,200)
   if skip then
    ButtonTreatment(id,10011,10012,10013,SkipBtnX,SkipBtnY,111,31,sender,"secret_room",true)
   end;  
end; 

function c_find(id)
    c_count=c_count+1
    set_pos_in_img(1006,0,41*c_count,65,41)
    playeffect("otlichie")
    speciale_action(2,id + 30,true);
    speciale_action(2,id + 29,true);    
    if c_count==10 then
        finish_mini_game(true)
    end;
end;
function mini_create ()
    show_help_wnd=true;
    init_mini(true);
    
    --create_mini(1002,65,41,0,10,1008,1006);
    create_mini(8128);
    StartTimer(88821,0.5)
end;

function SkipActions()
    SkipMini()
    finish_mini_game(true);
    playeffect("miniok")
    HideSkip()
    HideHelp()
    Block_Show_Cur(true);
    StartTimer(8881,1);
    flags.portret_mini = true;
end;

function gameinput (sender,id,attachedID)
CursorTreatment(id,sender,attachedID); 
Buttons_T(sender,id)
   
  if sender == 100 then
    StartTimer(88811,0.3);
  return; end;
  
  if sender == 36 then    
    if id == 88821 then
      
    return; end;    
    if id == 88811 then
      Block_Show_Cur(false);
      CreatePlashechka(900000,"150")
    return; end;
    if id == 8881 then
      Block_Show_Cur(false);
   
      clear_satelite_leaf("secret_room"); 
      finish_mini_game(true);
    return; end;

  return; end;
  
  if sender == 30 then 
      DeleteResource("portret_05");
      DeleteResource("portret_06");
      DeleteResource("portret_07");
      DeleteResource("portret_08");
      DeleteResource("portret_09");
      DeleteResource("portret_10");
      DeleteResource("portret_11");
      DeleteResource("portret_12");
      DeleteResource("portret_13");
      DeleteResource("portret_14");
      DeleteResource("portret_15");
      DeleteResource("portret_16");
      DeleteResource("portret_17");
      DeleteResource("portret_18");
      DeleteResource("portret_19");
      DeleteResource("portret_20");
      DeleteResource("portret_21");      
      DeleteResource("portret_28");     
      DeleteResource("portret_29");    
    setcurentleaf("secret_room",7,0);    
    Block_Show_Cur(false);    
    if flags.portret_mini then
      neighbors.jmp_mayor_house.lock=false;
      neighbors.mayor_house.lock=false;
      CreatePlashechka(900000,"3040")
      speciale_action(2,32,true,3);
      speciale_action(2,33,true,3);
      ActivateObject(33,false)
      speciale_action(2,34)
      Set_Anim_Cur(34,16);
      StopEmiter("portret");
      UnStoreObj(attachedID);
      flags.help_portret = true;
    end;
  return; end;
  
  if sender==37 then
    skip = true;
  return;end;
  
  if sender == 10 then
    playeffect("miniok")
    HideSkip()
    HideHelp()
    Block_Show_Cur(true);
    StartTimer(8881,1);
    flags.portret_mini = true;
  return; end;
 
 
  if sender == 1 then
    if id == 1009 or  id == 1008 then
        ActivateObject(1009,false)
        ActivateObject(1008,false)
        c_find(1009)
    return; end;
    if id == 1040 or  id == 1010 then
        ActivateObject(1040,false)
        ActivateObject(1010,false)    
        c_find(1040)
    return; end;
    if id == 1013 or  id == 1012 then
        ActivateObject(1013,false)
        ActivateObject(1012,false)    
        c_find(1013)
    return; end;
    if id == 1015 or  id == 1014 then
        ActivateObject(1015,false)
        ActivateObject(1014,false)    
        c_find(1015)
    return; end;
    if id == 1017 or  id == 1016 then
        ActivateObject(1017,false)
        ActivateObject(1016,false)    
        c_find(1017)
    return; end;
    if id == 1019 or  id == 1018 then
        ActivateObject(1019,false)
        ActivateObject(1018,false)    
        c_find(1019)
    return; end;
    if id == 1021 or  id == 1020 then
        ActivateObject(1021,false)
        ActivateObject(1020,false)    
        c_find(1021)
    return; end;
    if id == 1023 or  id == 1022 then
        ActivateObject(1023,false)
        ActivateObject(1022,false)    
        c_find(1023)
    return; end;
    if id == 1025 or  id == 1024 then
        ActivateObject(1025,false)
        ActivateObject(1024,false)    
        c_find(1025)
    return; end;
    if id == 1027 or  id == 1026 then
        ActivateObject(1027,false)
        ActivateObject(1026,false)    
        c_find(1027)
    return; end;
  return; end;
  
end;

function mini_delete ()

end;
function SheetSwitched(nCount)
end;