function GameScreen:InitScreen()
    self:LoadScreen()
    SetVisibleCursor(true)
    self.disable = false;
    
    clApplication.curret_win = self;
    
    clApplication.game_pause = true;
    CurrentScreen:PauseScreen()
    
    clApplication:SetCursor("graphics/interface/cursors/cursor")
    
    self:FadeOut();
end

function GameScreen:OnKeyDown(key)
	if(key == VK_ESCAPE and clApplication.curret_win.name == self.name) then
	    clApplication.curret_win = nil
        --if(DragObject and DragObject.active) then
	    --    SetVisibleCursor(false)
	    --end
        ItemSetOpacity("drag_object", 1.0)
	    messenger_table.on_key_down = "";
		clApplication.game_pause = false;
        ItemSetOpacity("hud", 1.0)
        ItemSetOpacity("inventory", 1.0)
        ItemSetOpacity("menu_button", 1.0)
        clScreenManager:remove_screen(self); 
        CurrentScreen:UnPauseScreen()
	end
end

function GameScreen:OnClick(item_name)
    if(self.disable) then return end

    if("resume" == item_name) then
        SoundPlay("sound/interface/button.ogg")
        self.disable = true;
        self:FadeIn(0.5);
        
        DelayedExec(0.7, function() 
            ItemSetOpacity("drag_object", 1.0)
            --if(DragObject and DragObject.active) then
	        --    SetVisibleCursor(false)
	        --end

            clApplication.game_pause = false;
            ItemSetOpacity("hud", 1.0)
            ItemSetOpacity("inventory", 1.0)
            ItemSetOpacity("menu_button", 1.0)
            clScreenManager:remove_screen(self); 
            CurrentScreen:UnPauseScreen()
        end)
    elseif("options" == item_name) then
        SoundPlay("sound/interface/button.ogg")
        self:FadeIn(0.5);
        clApplication.curret_win = clScreenManager:add_screen("options_screen") 
        clApplication.curret_win.end_fun = function()
            clApplication.curret_win = self;
             self:FadeOut(0.5);
        end
    elseif("credits" == item_name) then
        SoundPlay("sound/interface/button.ogg")
        self:FadeIn(0.5);
        clApplication.curret_win = clScreenManager:add_screen("credits_screen") 
        clApplication.curret_win.end_fun = function()
            clApplication.curret_win = self;
            self:FadeOut(0.5);
        end
    elseif("main_menu" == item_name) then
        SoundPlay("sound/interface/button.ogg")
        
        self.disable = true
        self:FadeIn(0.5);
        local quit_screen = clScreenManager:add_screen("quit_screen") 
        quit_screen.end_fun = function()
            self.disable = false
            self:FadeOut(0.5);
        end
        quit_screen.end_fun2 = function()
            clScreenManager:remove_screen(self); 
        end
    end
end

function GameScreen:LoadScreen()
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "ingame_menu_back_trigger", "graphics/trigger", 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
    ItemSetOpacity("ingame_menu_back_trigger", 0.85)
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "main_menu", "graphics/interface/menu/main_menu", 270, 866);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "credits", "graphics/interface/menu/credits", 270, 754);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "options", "graphics/interface/menu/options", 270, 642);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "resume", "graphics/interface/menu/resume", 270, 530);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "menu_header", "graphics/interface/menu/menu_header", 570, 113);
end