function ClassEl()
{
    this.ID = -1;       //-1 none
                        // 0 pets
                        // 1 heart
                        // 2 water cans
                        // 3 pumpkins
                        // 4 watermelons

    this.bonusID = 0;   // 0 none
                        // 1 glow
                        // 2 lock
                        // 3 gift

    this.val = 0;
    this.multi = 1;
}

ClassEl.prototype.set = function(id, val)
{
    this.ID = id;
    this.val = val;
    this.bonusID = 0;
    this.multi = 1;
};

ClassEl.prototype.setB = function(b)
{
    this.bonusID = b;
};

ClassEl.prototype.addMulti = function()
{
    this.multi = 2;
};

function isDes(a, b)
{
    var c = false;

    if(a.ID == 0 && b.ID == 0 && a.val == b.val && a.bonusID != 2 && b.bonusID != 2) c = true;
    if((a.ID == 0 && b.ID == 1 && a.bonusID != 2) || (a.ID == 1 && b.ID == 0 && b.bonusID != 2)) c = true;
    //if(a.ID == 2 && b.ID == 2) c = true;

    return c;
}

function isSwp(i, j)
{
    return (game.grid.mass[i][j].ID != -1 && game.grid.mass[i][j].bonusID != 2);
}

function swapE(i1, j1, i2, j2)
{
    game.grid.mass[i1][j1].ID += game.grid.mass[i2][j2].ID;
    game.grid.mass[i2][j2].ID = game.grid.mass[i1][j1].ID - game.grid.mass[i2][j2].ID;
    game.grid.mass[i1][j1].ID -= game.grid.mass[i2][j2].ID;

    game.grid.mass[i1][j1].bonusID += game.grid.mass[i2][j2].bonusID;
    game.grid.mass[i2][j2].bonusID = game.grid.mass[i1][j1].bonusID - game.grid.mass[i2][j2].bonusID;
    game.grid.mass[i1][j1].bonusID -= game.grid.mass[i2][j2].bonusID;

    game.grid.mass[i1][j1].val += game.grid.mass[i2][j2].val;
    game.grid.mass[i2][j2].val = game.grid.mass[i1][j1].val - game.grid.mass[i2][j2].val;
    game.grid.mass[i1][j1].val -= game.grid.mass[i2][j2].val;

    game.grid.mass[i1][j1].multi += game.grid.mass[i2][j2].multi;
    game.grid.mass[i2][j2].multi = game.grid.mass[i1][j1].multi - game.grid.mass[i2][j2].multi;
    game.grid.mass[i1][j1].multi -= game.grid.mass[i2][j2].multi;
}