local fFirstClick=true;
skip = false;
function mini_create ()
    show_help_wnd=true;
    init_mini(true);
    
--    create_mini(28,1021,7,"52436",3,3,600,500);--

end;

function SkipActions()
    finish_mini_game(true);
--    set_text(2001,"1012")    
end;

function Buttons_T(sender,id)
       ButtonTreatment(id,10001,10002,10003,CloseBtnX,CloseBtnY,CloseWidth,CloseHeight,sender,"police",true)   
end; 

function gameinput (sender,id,attachedID)
CursorTreatment(id,sender,attachedID);
Buttons_T(sender,id)
   
  if sender == 36 then

    if id == 8882 then
      speciale_action(2,1009,true);
      speciale_action(2,1008,true);
        playeffect("00")
        speciale_action(2,1023-7,true,1.5);
      StartTimer(8881,1.5);
    return; end;

    
    if id == 8882100 then
      Block_Show_Cur(false);
      clear_satelite_leaf("police");
    return; end;
  return; end;
  

  
  if sender==16 then
    if id==1023-7 then
         playeffect("01")
        speciale_action(2,1023-7);
        speciale_action(2,1027-7,true,1.5);
    return;end;
    if id==1027-7 then
         playeffect("02")
        speciale_action(2,1027-7);
        speciale_action(2,1025-7,true,1.5);    
    return;end;    
    if id==1025-7 then
         playeffect("03")
        speciale_action(2,1025-7);
        speciale_action(2,1021-7,true,1.5);
    return;end;    
    if id==1021-7 then
         playeffect("04")
        speciale_action(2,1021-7);
        speciale_action(2,1024-7,true,1.5);    
    return;end;    
    if id==1024-7 then
         playeffect("05")
        speciale_action(2,1024-7);
        speciale_action(2,1026-7,true,1.5);    
    return;end;        
    if id==1026-7 then
         playeffect("06")
        speciale_action(2,1026-7);
        speciale_action(2,1022-7,true,1.5);    
    return;end;
    if id==1022-7 then
        speciale_action(2,1022-7);
        Block_Show_Cur(false);
        playeffect("case")
        flags.game_sud_compl=true;
        speciale_action(2,1007,true);
        speciale_action(2,obj.zalk.id,true);
        Set_Anim_Cur(obj.zalk.id,4);
    return;end;        
  return;end;
  
  
  if sender == 30 then     
      DeleteResource("case_police2" );
      DeleteResource("case_police3" );
      DeleteResource("case_police4" );     
      DeleteResource("case_policeall" );
      DeleteResource("case_police25"); 
      DeleteResource("zakl"); 
      setcurentleaf("police",4,0);
    if hint then
      flags.GlobalHint = false;
    end;
    Block_Show_Cur(false);    
    if flags.case_police then
      flags.help_expert = true;
      if not flags.game_sud_complM then
          flags.game_sud_complM=true;
          speciale_action(2,6);
          speciale_action(2,7);
          speciale_action(2,8);
          Set_Anim_Cur(8,3)
          speciale_action(2,1010,true,1);
          ActivateObject(8,false)
      end;
      ActivateObject(7,false);
      Set_Anim_Cur(7,3)      
      StopEmiter("case");
    return; end;
    if flags.game_sud_compl and not flags.game_sud_complM then
      flags.game_sud_complM=true;
      StopEmiter("case");
      speciale_action(2,6);
      speciale_action(2,7);
      speciale_action(2,8);
      Set_Anim_Cur(8,3)
      ActivateObject(8,false);
      ActivateObject(7,true);
      Set_Anim_Cur(7,2)
      AddParticleToObject(7,"case",97,579);
      MoveEmiter("case",97,579);
      StartEmiter("case");        
    return;end;
  return; end;
  

  if sender==100 then
    Block_Show_Cur(false)
  return;end;


  
  if sender==50 then
        StartTimer(8882100,1);
      flags.case_police=true
       Block_Show_Cur(true);
  return;end;
  
  if sender == 1 then
  

    if id == obj.zalk.id then
      StoreObj(obj.zakl.id,id,"50",335,350,"zakl",291,239,400000)    
    return; end;      

    if id == 1029 then
      if obj.krtch ~= nil and attachedID == obj.krtch.id then
        RemObjFromMouse()
        UnStoreObj(attachedID);
        Set_Anim_Cur(1029,3);
        speciale_action(2,1029);
        speciale_action(2,1009,true,0.4);
        flags.card_to_case = true;
        playeffect("vizitka")
        StartTimer(8882,0.5);
        Block_Show_Cur(true);
      return;end;
      if attachedID~=-1 and ((obj.krtch~=nil and attachedID ~= obj.krtch.id) or (obj.krtch==nil ))  then
        RemObjFromMouse()
        CreatePlashechka(900000,"1000")
      return;end;    
        CreatePlashechka(900000,"224")      
      return; end;
    
    if id == 1003 then
        CreatePlashechka(900000,"225")
    return; end;
  return; end; 
 
  
end;



function mini_delete ()

end;
function SheetSwitched(nCount)
end;