function Deck()
{
	this.suits = new Array( "hearts", "clubs", "diamonds", "spades" );
	this.faces = new Array( "deuce", "three", "four", "five", "six",
		"seven", "eight", "nine", "ten", "jack", "queen", "king", "ace" );
	this.deck = new Array( 52 );
	for( var count = 0; count < this.deck.length; count++ )
			this.deck[ count ] = new Card( this.faces[ count % 13 ], this.suits[ Math.floor( count / 13 ) ] );
	this.shuffle = function()
	{
		var timesToShuffle = 8;
		for( var k = 0; k < timesToShuffle; k++ )
		{
			for( var i = 0; i < 52; i++ )
			{
				var j = Math.floor( Math.random() * 52 );
				var temp = this.deck[ i ];
				this.deck[ i ] = this.deck[ j ];
				this.deck[ j ] = temp;
			}
		}
	}
	this.printCards = function()
	{
		var output = "";
		for( var i = 0; i < 52; i++ )
		{
			output += this.deck[ i ].toString() + "<br/>";
		}
		return output;
	}
	this.getCard = function( c )
	{
		return this.deck[ c ];
	}
}
function Card( initialFace, initialSuit )
{
	this.face = initialFace;
	this.suit = initialSuit;
	if( initialFace == "deuce" )
		this.numValue = 2;
	else if( initialFace == "three" )
		this.numValue = 3;
	else if( initialFace == "four" )
		this.numValue = 4;
	else if( initialFace == "five" )
		this.numValue = 5;
	else if( initialFace == "six" )
		this.numValue = 6;
	else if( initialFace == "seven" )
		this.numValue = 7;
	else if( initialFace == "eight" )
		this.numValue = 8;
	else if( initialFace == "nine" )
		this.numValue = 9;
	else if( initialFace == "ten" )
		this.numValue = 10;
	else if( initialFace == "jack" )
		this.numValue = 11;
	else if( initialFace == "queen" )
		this.numValue = 12;
	else if( initialFace == "king" )
		this.numValue = 13;
	else if( initialFace == "ace" )
		this.numValue = 14;
	else if( initialFace == "" )
		this.numValue = 0;
	else
		alert( "Unknown Card Face" );
	
	this.getFace = utilGetFace;
	this.getSuit = utilGetSuit;
	this.getNumValue = utilGetNumValue;
	this.toString = utilToString;
}
function utilGetFace()
{
	return this.face;
}
function utilGetSuit()
{
	return this.suit;
}
function utilGetNumValue()
{
	return this.numValue;
}
function utilToString()
{
	/*var output = "";
	output += ".bg" + this.face + "Of" + this.suit + "<br/ >{<br />";
	output += 'background-image: url("../img/' + this.face + " of " + this.suit + '.gif");<br />';
	output += "}";
	return output;*/
	return this.face + " of " + this.suit;
}