( Combination = function()
{
    this.type;
    this.jewels = new Array();

    this.init = function( $type )
    {
        this.type = $type;
    }

    this.size = function()
    {
        return this.jewels.length;
    }

    this.addPoint = function( $p )
    {
        if ( !this.containsPoint( $p ) ) this.jewels.push( $p );
    }

    this.merge = function( $c2 )
    {
        for ( var j = 0; j < $c2.jewels.length; j++ )
        {
            var p2 = $c2.jewels[j];
            var found = false;
            for ( var i = 0; i < this.jewels.length; i++ )
            {
                var p1 = this.jewels[i]
                if ( p1.x == p2.x && p1.y == p2.y )
                {
                    found = true;
                    break;
                }
            }
            if ( !found )
            {
                this.jewels.push( p2 );
            }
        }
    }

    this.getRandomPoint = function()
    {
        return this.jewels[Math.floor( Math.random() * this.jewels.length )];
    }

    this.containsPoint = function( $p )
    {
        for ( var i = 0; i < this.jewels.length; i++ )
        {
            var p1 = this.jewels[i];
            if ( p1.x == $p.x && p1.y == $p.y )
            {
                return true;
            }
        }
        return false;
    }

} );