function ClassBonus()
{
    this.getImg = new createjs.Container();

    this.ID = 0;// 0 none
                // 1 watering
                // 2 hairbrush
                // 3 water
                // 4 hairbrush
                // 5 food
                // 6 key

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

    this.bg_block = [];
    this.img_bonus = [];
    this.text_count = [];

    this.lvl_text = ss_data.clone();
    this.lvl_text.gotoAndStop("text_white_level");
    this.lvl_text.x = 33*devise_size;
    this.lvl_text.y = 8*devise_size;
    this.getImg.addChild(this.lvl_text);
    this.lvl_text_num = new ClassText("", 3);
    this.lvl_text_num.getImg.x = 93*devise_size;
    this.lvl_text_num.getImg.y = -1*devise_size;
    this.getImg.addChild(this.lvl_text_num.getImg);

    this.bg_block.push(ss_data.clone());
    this.bg_block[0].gotoAndStop("block_bonus");
    this.bg_block[0].x = 55*devise_size;
    this.bg_block[0].y = devise_size;
    this.bg_block[0].name = 0;
    this.bg_block[0].on("mousedown", function(evt){ game.bonus.setBonus(evt.target.name); });
    this.getImg.addChild(this.bg_block[0]);
    this.img_bonus.push(ss_data.clone());
    this.img_bonus[0].gotoAndStop("bonus00");
    this.img_bonus[0].regX = 8*devise_size;
    this.img_bonus[0].regY = 4*devise_size;
    this.img_bonus[0].x = 55*devise_size;
    this.img_bonus[0].y = devise_size;
    this.getImg.addChild(this.img_bonus[0]);
    this.text_count.push(new ClassText("", 2));
    this.text_count[0].getImg.x = 82*devise_size;
    this.text_count[0].getImg.y = 11*devise_size;
    this.getImg.addChild(this.text_count[0].getImg);

    for(var i=1; i<6; i++)
    {
        this.bg_block.push(ss_data.clone());
        this.bg_block[i].gotoAndStop("block_bonus");
        this.bg_block[i].x = (80 + 40*i)*devise_size;
        this.bg_block[i].y = devise_size;
        this.bg_block[i].name = i;
        this.bg_block[i].on("mousedown", function(evt){ game.bonus.setBonus(evt.target.name); });
        this.getImg.addChild(this.bg_block[i]);

        this.img_bonus.push(ss_data.clone());
        this.img_bonus[i].gotoAndStop("bonus"+ i +"0");
        this.img_bonus[i].regX = 8*devise_size;
        this.img_bonus[i].regY = 4*devise_size;
        this.img_bonus[i].x = (80 + 40*i)*devise_size;
        this.img_bonus[i].y = devise_size;
        this.getImg.addChild(this.img_bonus[i]);

        this.text_count.push(new ClassText("", 2));
        this.text_count[i].getImg.x = (108 + 40*i)*devise_size;
        this.text_count[i].getImg.y = 11*devise_size;
        this.getImg.addChild(this.text_count[i].getImg);
    }
}

ClassBonus.prototype.Create = function()
{
    this.bg_block[0].visible = !game.bonus_lvl;
    this.img_bonus[0].visible = !game.bonus_lvl;
    this.text_count[0].getImg.visible = !game.bonus_lvl;

    this.lvl_text.visible = game.bonus_lvl;
    this.lvl_text_num.getImg.visible = game.bonus_lvl;
    this.lvl_text_num.setText((game.level_num + 1).toString());
    this.Upd();
};

ClassBonus.prototype.Upd = function()
{
    for(var i=0; i<6; i++)
    {
        if(game.save.bonus[i] == 0)
        {
            this.bg_block[i].mouseEnabled = false;
            this.img_bonus[i].alpha = 0.5;
        }
        else
        {
            this.bg_block[i].mouseEnabled = true;
            this.img_bonus[i].alpha = 1;
        }
        this.text_count[i].setText(game.save.bonus[i].toString());
        this.text_count[i].getImg.regX = this.text_count[i].getImg.width;
    }
};

ClassBonus.prototype.Add = function(a, b)
{
    game.save.bonus[a] += b;
    game.save.SaveBonus();
    this.Upd();
};

ClassBonus.prototype.setBonus = function(a)
{
    if(this.ID == (a+1))
    {
        this.ID = 0;
        this.img_bonus[a].gotoAndStop("bonus" + a + "0");
    }
    else
    {
        this.ID = a+1;
        for(var i=0; i<6; i++)
        {
            if(a == i)
                this.img_bonus[i].gotoAndStop("bonus"+ i+"1");
            else
                this.img_bonus[i].gotoAndStop("bonus"+ i+"0");
        }
    }
};

ClassBonus.prototype.reBonus = function()
{
    this.ID = 0;
    for(var i=0; i<6; i++)
        this.img_bonus[i].gotoAndStop("bonus"+ i+"0");
};