var m_add_bonus = [];
var addd_b = 0;

function ClassAddBonus()
{
    this.gift_st = ss_data.clone();
    this.gift_st.alpha = 0.5
    this.gift_st.visible = false;

    this.gift = ss_data.clone();
    this.gift.visible = false;
    this.rand = 0;
    this.speed = 0;
    this.t = 0;
    m_add_bonus = [51*devise_size, 116*devise_size, 156*devise_size, 196*devise_size, 236*devise_size, 276*devise_size];
}

ClassAddBonus.prototype.Show = function(x, y, b)
{
    this.rand = Math.random()*6<<0;
    while(addd_b == this.rand) this.rand = Math.random()*6<<0;
    addd_b = this.rand;
    this.gift_st.gotoAndStop("bonus"+this.rand+"0_i");
    this.gift_st.regX = 23*devise_size;
    this.gift_st.regY = 21*devise_size;
    this.gift_st.x = x;
    this.gift_st.y = y;
    this.gift_st.visible = b;
    this.gift.gotoAndStop("bonus"+this.rand+"0_i");
    this.speed = (x - (m_add_bonus[this.rand] - 29*devise_size))/14;
    this.gift.regX = 23*devise_size;
    this.gift.regY = 21*devise_size;
    this.gift.x = x;
    this.gift.y = y;
    this.gift.visible = b;
    this.t = 0;
};

ClassAddBonus.prototype.Hide = function()
{
    if(this.gift.visible)
    {
        this.gift_st.visible = false;
        this.gift.visible = false;
        game.bonus.Add(this.rand, 1);
    }
};

ClassAddBonus.prototype.Drw = function()
{
    if(this.gift.y < (270*devise_size))
    {
        this.gift.x -= this.speed;
        this.gift.y += 8*devise_size;
    }
    else
    {
        this.t++;
        if(this.gift.paused && this.gift.visible)
        {
            game.bonus.Add(this.rand, 1);
            this.gift.regX = 77*devise_size;
            this.gift.regY = 77*devise_size;
            this.gift.gotoAndPlay("pets");
            if(audio_supported)
                s_get_reward.play();
        }
    }
    if(this.t > 24)
    {
        this.t = 0;
        this.gift.visible = false;
    }
};