function WindowBonusLevelComplete()
{
    this.name = "bwin";
    this.layer = 1;
    this.animation_time_in = 20;
    this.animation_time_out = 20;

    this.getImg.x = 160*devise_size;
    this.getImg.y = 2048;
    this.getImg.regX = 110*devise_size;
    this.getImg.regY = 105*devise_size;

    var bg = ss_data.clone();
    bg.gotoAndStop("window3");
    this.getImg.addChild(bg);

    this.lights = ss_data.clone();
    this.lights.gotoAndStop("lights");
    this.lights.x = -43*devise_size;
    this.lights.y = 60*devise_size;
    this.getImg.addChild(this.lights);

    this.bonus_text = ss_data.clone();
    this.bonus_text.gotoAndStop("text_white_bonus_reward");
    this.bonus_text.x = 32*devise_size;
    this.bonus_text.y = 120*devise_size;
    this.getImg.addChild(this.bonus_text);

    var up = ss_data.clone();
    up.gotoAndStop("text_yellow_bonus_level_comlete");
    up.x = -22*devise_size;
    up.y = -66*devise_size;
    this.getImg.addChild(up);

    this.text_num_lvl = new ClassText("", 4);
    this.text_num_lvl.getImg.x = 158*devise_size;
    this.text_num_lvl.getImg.y = -80*devise_size;
    this.getImg.addChild(this.text_num_lvl.getImg);

    this.btn_m = ss_data.clone();
    this.btn_m.gotoAndStop("btn");
    this.btn_m.on("mousedown", function(){
        window_controller.Show("map");
    });
    this.btn_m.x = 15*devise_size;
    this.btn_m.y = 180*devise_size;
    this.getImg.addChild(this.btn_m);
    var btn_m_up = ss_data.clone();
    btn_m_up.gotoAndStop("icon_menu");
    btn_m_up.x = 15*devise_size;
    btn_m_up.y = 180*devise_size;
    this.getImg.addChild(btn_m_up);

    this.btn_r = ss_data.clone();
    this.btn_r.gotoAndStop("btn");
    this.btn_r.on("mousedown", function(){
        game.CreateLvl(game.level_num);
        window_controller.Show("location");
        window_controller.Show("bonuslvl");
    });
    this.btn_r.x = 84*devise_size;
    this.btn_r.y = 180*devise_size;
    this.getImg.addChild(this.btn_r);
    var btn_r_up = ss_data.clone();
    btn_r_up.gotoAndStop("icon_reset");
    btn_r_up.x = 84*devise_size;
    btn_r_up.y = 180*devise_size;
    this.getImg.addChild(btn_r_up);

    this.btn_n = ss_data.clone();
    this.btn_n.gotoAndStop("btn");
    this.btn_n.on("mousedown", function(){
        game.CreateLvl(game.level_num+1);
        window_controller.Show("location");
        window_controller.Show("job");
    });
    this.btn_n.x = 152*devise_size;
    this.btn_n.y = 180*devise_size;
    this.getImg.addChild(this.btn_n);
    var btn_n_up = ss_data.clone();
    btn_n_up.gotoAndStop("icon_right");
    btn_n_up.x = 152*devise_size;
    btn_n_up.y = 180*devise_size;
    this.getImg.addChild(btn_n_up);

    this.progress = new ClassBonusBar();
    this.progress.getImg.x = 21*devise_size;
    this.progress.getImg.y = 30*devise_size;
    this.getImg.addChild(this.progress.getImg);

    this.gift0 = new ClassAddBonus();
    this.getImg.addChild(this.gift0.gift_st);
    this.getImg.addChild(this.gift0.gift);

    this.gift1 = new ClassAddBonus();
    this.getImg.addChild(this.gift1.gift_st);
    this.getImg.addChild(this.gift1.gift);
}
WindowBonusLevelComplete.prototype = new ClassWindow();

WindowBonusLevelComplete.prototype.Hide = function()
{
    this.gift0.Hide();
    this.gift1.Hide();
};

WindowBonusLevelComplete.prototype.Show = function()
{
    this.getImg.y = 2048;
    this.progress.Show();

    if(config.lvls[game.level_num].pt[0] <= ((game.score.score/5)<<0))
    {
        this.lights.visible = true;
        this.bonus_text.visible = true;
        this.gift0.Show(85*devise_size, 164*devise_size, true);
        this.gift1.Show(135*devise_size, 164*devise_size, true);
    }
    else
    {
        if(config.lvls[game.level_num].pt[1] <= ((game.score.score/5)<<0))
        {
            this.lights.visible = true;
            this.bonus_text.visible = true;
            this.gift0.Show(110*devise_size, 164*devise_size, true);
            this.gift1.Show(0, 0, false);
        }
        else
        {
            this.lights.visible = false;
            this.bonus_text.visible = false;
            this.gift0.Show(0, 0, false);
            this.gift1.Show(0, 0, false);
        }
    }

    if(config.lvls[game.level_num].max * 0.75 <= game.score.score)
        game.save.setMap(3);
    else
    {
        if(config.lvls[game.level_num].max * 0.6 <= game.score.score)
            game.save.setMap(2);
        else
            game.save.setMap(1);
    }
};

WindowBonusLevelComplete.prototype.Drw = function()
{
    if(this.isSt())
    {
        if(this.progress.isLoad())
        {
            this.progress.Upd();
        }
        else
        {
            if(this.gift0.gift.visible)
            {
                this.gift0.Drw();
            }
            else
            {
                if(this.gift1.gift.visible)
                    this.gift1.Drw();
            }
        }

    }
};

WindowBonusLevelComplete.prototype.DrwIn = function()
{
    this.getImg.y = (-105 + 345*(this.animation/this.animation_time_in))*devise_size;
};

WindowBonusLevelComplete.prototype.DrwOut = function()
{
    this.getImg.y = (240 + 345*(this.animation/(-this.animation_time_out)))*devise_size;
    if(this.animation == -this.animation_time_out) this.getImg.y = 2048;
};