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

local fFirstClick=true;
skip = false;
function mini_create ()
    show_help_wnd=true;
    init_mini(true);

    create_mini(19,15,20,206,90,648,300,1020,3,8,0,-1,false);
    if fromkamin then
        fromkamin=false
        SetAlfa(7777777,1,0,0.3)
    end;
    StartTimer(88821,0.5)
    Block_Show_Cur(false)
end;

function SkipActions()
    SkipMini()
        StartTimer(8881,0.5);
        HideHelp()
    set_text(2002,"1012")        
    speciale_action(2,10011)
    for i=1020,1034,1 do
       setcolor(i,1,1,1,1)
    end;    
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 == 88811 then
      Block_Show_Cur(false);
      CreatePlashechka(900000,"405")
    return; end;
    if id == 8881 then
    WriteToConsole("end timer \n")
        flags.kamin_puzzle = true;
    return; end;

  return; end;
  
  if sender == 30 then  
WriteToConsole("sender == 30 \n")  
objectid = 0;
mini_puzzle=false
      DeleteResource("kamin_puzzle1");
      WriteToConsole("DeleteResource  kamin_puzzle1 \n") 
      DeleteResource("kamin_puzzle2");
      WriteToConsole("DeleteResource  kamin_puzzle2 \n")
      DeleteResource("kamin_puzzle3");    
      WriteToConsole("DeleteResource  kamin_puzzle3 \n")      
    setcurentleaf("mayor_house",8,0);
    WriteToConsole("setcurentleaf  mayor_house \n")    
    Block_Show_Cur(false);    
    if flags.kamin_puzzle then
       WriteToConsole("in flags.kamin_puzzle \n")    
      speciale_action(2,48)
      Set_Anim_Cur(48,3);
      StopEmiter("kamin");
      WriteToConsole("in flags.kamin_puzzle end  \n")    
    end;
  return; end;
  
  if sender==37 then
    skip = true;
  return;end;
  
  if sender == 10 then    
    playeffect("miniok")
    WriteToConsole("Plashechka 3036 \n")
    CreatePlashechka(900000,"3036")
    set_text(2002,"1012")
    speciale_action(2,10011)    
    StartTimer(8881,1.5);
    WriteToConsole("StartTimer 8881 \n")
    skip=false
    HideHelp()
    WriteToConsole("set_text 1012 \n")
  return; end;
 
  if sender == 1 then   

--------------    
    if id >= 1020 and id <= 1034 then --нажимаем на часть
    
    if not flags.kamin_puzzle then
    if mousepresed then
		EndMoving(objectid)
        RemoveFromMouse(objectid);
    end;
      add_to_mouse(id);
      mousepresed=true;
      objectid=id;
	  BeginMoving(objectid)
     return;end;
      WriteToConsole("Clear In sender==1 \n")
      clear_satelite_leaf("mayor_house");      
    return; end       
  return; end;      

  if sender == 6 then --Отпустили левую кнопку мышки             
    if not flags.kamin_puzzle then    
		if mousepresed==true then
		  playeffect("paper")
		  RemoveFromMouse(objectid);
			EndMoving(objectid)
		  if check_mini_game_puzzle(objectid) then
			Set_Anim_Cur(objectid,3)
		  end;
		  mousepresed=false;
		  objectid=0;
		return;end;
	return;end;	
      WriteToConsole("Clear In sender==6 \n")
      clear_satelite_leaf("mayor_house");     
  return; end; 
end;
function MessageFromMinigame()
end;
function mini_delete ()

end;
function SheetSwitched(nCount)
end;