/*******************************************************************************
 * Filename: 		cards.js
 * Author: 		Steve Hannah <shannah@sfu.ca>
 * Date Created: 	August 11, 2005
 * Description:
 * 	Contains functions to produce random pair of playing card images.  Images
 * 	are located in the ./images/cards directory.  This is intended to simulate
 * 	a hand of Texas Holdem.
 *
 * NOTE: This is currently not being used because the functionality of showing a
 * different random set of cards on each refresh is not the preferred method.
 * see ../php/random_card.php for an option to show a different random card each 
 * day.
 * 	
 */
 
/*
* Returns array of 2 random card file names.  The images that these names correspond
* to are located in the ./images/cards directory.  The two returned names cannot be
* the same.
*/
var card_images_prefix  = "images/cards/";

function randomCards(){
	// global cards
	
	
	var index1 = Math.floor(Math.random()* cards.length);
	//alert(index1);

	var index2 = '';
	do {
		index2 = Math.floor(Math.random() * cards.length);
		
		
	} while ( index1==index2 );
	
	
	return new Array(card_images_prefix + cards[index1], card_images_prefix + cards[index2]);

}

// Initialize the available card names
var cards = new Array(52);
var card_suits = new Array("CLUBS","HEARTS","DIAMOND","SPADES");
var card_labels = new Array(13);
for ( i=1; i<=13; i++){
	card_labels[i-1]=i;
}

var k=0;
for (i=0; i<card_suits.length; i++){
	for (j=0; j<card_labels.length; j++){
		cards[k++] = card_suits[i]+card_labels[j]+".GIF";
	}
}



	
