function formatCurrency(num) 
{

	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
}


var gameImages = new Array(10);

gameImages[0] = new Array();
gameImages[0][0]="/assets/gameicons/game_icon_bingo_h20w20.png";
gameImages[0][1]="Bingo Bash";
gameImages[0][2]="javascript:showGameWindow('/games/play/Bingo')";

gameImages[1] = new Array();
gameImages[1][0]="/assets/gameicons/game_icon_poker_h20w20.png";
gameImages[1][1]="Poker Pals";
gameImages[1][2]="javascript:showGameWindow('/games/play/PokerPals')";

gameImages[2] = new Array();
gameImages[2][0]="/assets/gameicons/game_icon_spell_h20w20.png";
gameImages[2][1]="Spell Squad";
gameImages[2][2]="javascript:showGameWindow('/games/play/SpellSquad')";

gameImages[3] = new Array();
gameImages[3][0]="/assets/gameicons/game_icon_burger_h20w20.png";
gameImages[3][1]="Burger Buddy";
gameImages[3][2]="javascript:showGameWindow('/games/play/BurgerBuddy')";

gameImages[4] = new Array();
gameImages[4][0]="/assets/gameicons/game_icon_match_h20w20.png";
gameImages[4][1]="Match Makers";
gameImages[4][2]="javascript:showGameWindow('/games/play/MatchMaker')";

gameImages[5] = new Array();
gameImages[5][0]="/assets/gameicons/game_icon_slot_h20w20.png";
gameImages[5][1]="Slot Social";
gameImages[5][2]="javascript:showGameWindow('/games/play/SlotSocial')";

gameImages[6] = new Array();
gameImages[6][0]="/assets/gameicons/game_icon_facets_h20w20.png";
gameImages[6][1]="Facets";
gameImages[6][2]="javascript:showGameWindow('/games/play/Facets')";

gameImages[7] = new Array();
gameImages[7][0]="/assets/gameicons/game_icon_chain_h20w20.png";
gameImages[7][1]="Chain Gang";
gameImages[7][2]="javascript:showGameWindow('/games/play/ChainGang')";

gameImages[8] = new Array();
gameImages[8][0]="/assets/gameicons/game_icon_picture_h20w20.png";
gameImages[8][1]="Picture Magic";
gameImages[8][2]="javascript:showGameWindow('/games/play/PictureMagic')";

gameImages[9] = new Array();
gameImages[9][0]="/assets/gameicons/game_icon_doku_h20w20.png";
gameImages[9][1]="Doku Deluxe";
gameImages[9][2]="javascript:showGameWindow('/games/play/DokuDeluxe')";

var gameIndex = -1;
function rotateGames()
{
	gameIndex++;
	if ( gameIndex >= gameImages.length ) gameIndex = 0;
	
	document.getElementById("rotatingGames").innerHTML = '<a href="'+gameImages[gameIndex][2]+'"><img src="'+gameImages[gameIndex][0]+'" border="0" align="absmiddle"/></a> <a href="'+gameImages[gameIndex][2]+'">'+gameImages[gameIndex][1]+'</a>';
	
	setTimeout("rotateGames()", 10000);
}

function setCookie( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function getCookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}
