//Javascripts for Iamgame.com
//Statics
var BUTTONPATH = "images/buttons/"

//Object array
var Button
var szGameName

var WinCount = 0;
var Windows = new Array(5);

function OpenIAGEBXFrameset( szGameName, szGameType, IDX, status )
{
	if ( IDX == '' || IDX == '0' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	  window.open("/games/ClientFramesets/client_frames.BX.asp?idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
	  window.open("/games/ClientFramesets/client_frames.BX.asp?idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}

function OpenIAGEKenoFrameset( szGameName, szGameType, IDX, status )
{
	if ( IDX == '' || IDX == '0' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	  window.open("/games/ClientFramesets/client_frames.Keno.asp?idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
	  window.open("/games/ClientFramesets/client_frames.Keno.asp?idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}

function OpenSliderFrameset( szTheme, idx, status )
{
	if ( idx == '' || idx == '0' )
	{
		alert("Please login or create an account first");
		return;
	}

	if ( status >= 5 )
		window.open("/games/ClientFramesets/client_frames.slider.php?szThemeName="+szTheme+"&idx="+idx + "&szGameName=" + "Slider" +"&szGameType=" + "Slip n Slide", "" + "SlipNSlide"+idx, "width=" + 636 + ",height=" + 555 + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");
	else
		window.open("/games/ClientFramesets/client_frames.slider.php?szThemeName="+szTheme+"&idx="+idx + "&szGameName=" + "Slider" +"&szGameType=" + "Slip n Slide", "" + "SlipNSlide", "width=" + 636 + ",height=" + 555 + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");
}

function launchgame(theURL,winName,options) 
{
	var i;
	for(i=0;i<1;i++) {
		if (!Windows[i] || Windows[i].closed) break;
	}
	if(i == 1) {
		alert("No more game sessions allowed");
		return;
	}
	Windows[i] = window.open(theURL,winName+'win'+i,options);
}

// Object initializer: Button
// Special Note: Mouse events must return true to display szHelp

function Button(szDefaultImage, szOverImage, szDownImage, szName)
{
	this.mouseOut = BUTTONPATH + szDefaultImage
	this.mouseOver = BUTTONPATH + szOverImage
	this.mouseDown = BUTTONPATH + szDownImage
	this.name = szName
	return this
}

//Function ChangeState
// 0 = normal, 1 = over, 2 = down

function ChangeState(nButton, nState)
{
	switch(nState)
	{
		case 0:
			document.images[Button[nButton].name].src = Button[nButton].mouseOut
			break
		case 1:
			document.images[Button[nButton].name].src = Button[nButton].mouseOver
			break
		case 2:
			document.images[Button[nButton].name].src = Button[nButton].mouseDown
			break
		default:
			document.images[Button[nButton].name].src = Button[nButton].mouseOut
	}
}

//Button Initialization

Button[0] = new Button("member.gif", "member_over.gif", "member_down.gif", "member")
Button[1] = new Button("account.gif", "account_over.gif", "account_down.gif", "account")
Button[2] = new Button("store.gif", "store_over.gif", "store_down.gif", "store")
Button[3] = new Button("chat.gif", "chat_over.gif", "chat_down.gif", "chat")
Button[4] = new Button("contact.gif", "contact_over.gif", "contact_down.gif", "contact")
Button[5] = new Button("userguide.gif", "userguide_over.gif", "userguide_down.gif", "userguide")
Button[6] = new Button("help.gif", "help_over.gif", "help_down.gif", "help")
Button[7] = new Button("title.gif", "title_over.gif", "title_down.gif", "title")
Button[8] = new Button("home.gif", "home_over.gif", "home_down.gif", "home")
Button[9] = new Button("sweep.gif", "sweep_over.gif", "sweep_down.gif", "sweep")

//Used to launch game windows
function OpenWindow(szGameName)
{
	launchgame("/games/ClientFramesets/client_frames.php?szGameName=" + szGameName, "Bingo", "width=640, height=609, toolbar=0, status=0, menubar=0, scrollbars=0, resizable=1")
}

function OpenDaveFrameset(szGameName, szGameType, szThemeName, IDX, status)
{
  var WindowName = szGameType.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  window.open("/games/ClientFramesets/client_frames.bingo.theme.dave.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
}

function OpenBJackFramesetIAGE(szGameName, szGameType, szThemeName, IDX, status)
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

	if ( 'VPoker' == szGameName )
	{
		if ( status >= 5 )
		{
			window.open("/games/ClientFramesets/client.vpoker.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
		}
		else
		{
			window.open("/games/ClientFramesets/client.vpoker.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
		}
	}
	else
	{
		if ( status >= 5 )
		{
			window.open("/games/ClientFramesets/client.bjack.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
		}
		else
		{
			window.open("/games/ClientFramesets/client.bjack.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
		}
	}
}

function OpenBJackBetaFrameset(szGameName, szGameType, szThemeName, IDX, status)
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

  if ( status >= 5 )
  {
    window.open("/games/ClientFramesets/client.bjack.beta.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
  }
  else
  {
    window.open("/games/ClientFramesets/client.bjack.beta.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
  }
}

function OpenFramesetBigGame(IDX, status)
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	if ( status >= 5 )
  {
    window.open("/games/ClientFramesets/client.bingo.biggame.php?idx=" + IDX + "&status="+status, "BigGame" + IDX, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
  }
  else
  {
    window.open("/games/ClientFramesets/client.bingo.biggame.php?idx=" + IDX + "&status="+status, "BigGame", "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
  }
}

function OpenFramesetIAGE(szGameName, szGameType, szThemeName, IDX, status)
{
  var WindowName = szGameType.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

  if ( status >= 5 )
  {
    window.open("/games/ClientFramesets/client_frames.bingo.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
  }
  else if ( status == 4 )
	{
    window.open("/games/ClientFramesets/client_frames.bingo.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status + "&vip=2", "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
	}
  else
  {
    window.open("/games/ClientFramesets/client_frames.bingo.theme.iage2.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
  }
}

function OpenIAGEAsk4ThemeFrameset( szThemeType, szGameName, szGameType, IDX, status )
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}
	else if ( szGameName == 'VIPGame' && status == 0 )
	{
		alert("Invalid Link");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	  window.open("/games/ClientFramesets/client_frames.bingo.themes.asp?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
	  window.open("/games/ClientFramesets/client_frames.bingo.themes.asp?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}

function OpenVIPAsk4ThemeFrameset( szThemeType, szGameName, szGameType, IDX, status )
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	  window.open("/games/ClientFramesets/client_frames.bingo.themes.asp?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
	  window.open("/games/ClientFramesets/client_frames.bingo.themes.asp?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}

function OpenIENAsk4ThemeFrameset( szThemeType, szGameName, szGameType, IDX, status )
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
		window.open("/games/ClientFramesets/client_frames.bingo.ien.themes.php?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "iEN" + WindowName + IDX + szGameName, "width=635,height=458,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
		window.open("/games/ClientFramesets/client_frames.bingo.ien.themes.php?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "iEN" + WindowName + szGameName, "width=635,height=458,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}


function OpenIAGEAsk4Theme2Frameset( szThemeType, szGameName, szGameType, IDX, status )
{
	if ( IDX == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	  window.open("games/ClientFramesets/client_frames.bingo.themes2.php?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + IDX + szGameName, "width=" + 635 + ",height=" + 555 + ",toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
	  window.open("games/ClientFramesets/client_frames.bingo.themes2.php?szThemeType=" + szThemeType + "&idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + szGameName, "width=" + 635 + ",height=" + 555 + ",toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}
function OpenFramesetTest(szGameName, szGameType)
{
	// launchgame("client_frames.bingo.php?szGameName=" + szGameName + "&szGameType=" + szGameType, "Bingo", "width=800, height=555, toolbar=0, status=0, menubar=0, scrollbars=0, resizable=1")
	// window.open("games/ClientFramesets/client_frames.bingo2.php?szGameName=" + szGameName + "&szGameType=" + szGameType, "", "width=1000, height=555, toolbar=no, menubar=no, scrollbars=no, resizable=yes")
	// szGameType = escape(szGameType);
	// window.open("games/ClientFramesets/client_frames.bingo.test.php?szGameName=" + szGameName + "&szGameType=" + szGameType, "", "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
	launchgame("client_frames.bingo.test.php?szGameName=" + szGameName + "&szGameType=" + szGameType, "Bingo", "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
}

// 11-16-01 CJW - added status to query string
// 11-5-01 WBW - added idx to query string
// 10-30-01 WBW - changed to ASP frameset for bingo
//Used to launch game windows
function OpenFrameset(szGameName, szGameType, szThemeName, IDX, status)
{
	//	 launchgame("client_frames.bingo.php?szGameName=" + szGameName + "&szGameType=" + szGameType, szGameType, "width=800,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")

	//var ord = new Number(Math.floor(1000000 * Math.random())+1);

	//	  window.open("games/ClientFramesets/client_frames.bingo.theme.235.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + ord, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');


	if ( status >= 5 )
	{
	  window.open("games/ClientFramesets/client_frames.bingo.theme.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
	}
	else
	{
	  window.open("games/ClientFramesets/client_frames.bingo.theme.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
	}
}

function OpenFramesetGuestIAGE()
{
  var ord = new Number(Math.floor(1000000 * Math.random())+1);

  window.open("games/ClientFramesets/client_frames.bingo.vipguest.iage.php", "" + ord, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
}

// 01-23-01 CJW - added status to query string
//Used to launch tournament game
function OpenTourneyFrameset(szGameName, szGameType, szThemeName, IDX, status)
{
	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	{
		window.open("Tourney.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1" );
	}
	else
	{
		window.open("Tourney.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName +szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1" );
	}
}

function OpenTestFrameset(szGameName, szGameType, szThemeName, IDX, status)
{
	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	{
		window.open("games/ClientFramesets/client_frames.bingo.theme.test.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName + IDX + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
	}
	else
	{
		window.open("games/ClientFramesets/client_frames.bingo.theme.test.php?idx=" + IDX + "&status="+status+"&szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + WindowName + szGameName, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1");
	}
}

function OpenFramesetGuest($nVIP)
{
	var ord = new Number(Math.floor(1000000 * Math.random())+1);
	if ( !$nVIP || $nVIP == 0 )
		window.open("games/ClientFramesets/client_frames.bingo.guest.php", "" + ord, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
	else
		window.open("games/ClientFramesets/client_frames.bingo.vipguest.php", "" + ord, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
}

// 10-30-01 WBW - changed to ASP frameset for bingo
//Used to launch game windows
function OpenFramesetOLD(szGameName, szGameType, szThemeName)
{
	//	 launchgame("client_frames.bingo.php?szGameName=" + szGameName + "&szGameType=" + szGameType, szGameType, "width=800,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")

	var ord = new Number(Math.floor(1000000 * Math.random())+1);

	window.open("games/ClientFramesets/client_frames.bingo.theme.php?szGameName=" + szGameName + "&szGameType=" + szGameType + "&szThemeName=" + szThemeName, "" + ord, "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
}


//Used to launch game windows
function OpenFramesetCash(szGameName, szGameType)
{
	  window.open("games/ClientFramesets/client_frames.bingo.cash.php?szGameName=" + szGameName + "&szGameType=" + szGameType, "", "width=635,height=555,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1")
}

//Used to launch pop-up ads on contact pages
function PopUpAds()
{
    window.open("popup.php", "PopUp", "width=320, height=240, toolbar=0, status=0, menubar=0, scrollbars=0, resizable=0")
}

//Used to launch intermisson ads between games
function Intermission(szIntermission, szUserid)
{
	// disabled 6/5 per phall by wbw
	//    window.open("intermission_popup.php?szIntermission=" + szIntermission + "&szUserid=" + szUserid, "Intermission", "width=420, height=300, toolbar=0, status=0, menubar=0, scrollbars=0, resizable=0");
	//    window.focus();

	// Commented out by CJW due to script error ($szUserid ==null)
	//$hold=$szUserid;
	$hold="Default";
}



// new sgame launch 
function OpenSGame(url)
{
	window.open(url, "iamgame", "width=640,height=665,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0")
}


// OLD S GAME FUNCTIONS

///////////////////////////////////////////////////////////////////////////////
// The following code is used for on-the-fly creation of static games.
// If you need to add new static games to the list, please see the end
// of this file.

ICONPATH = "sgames/" //Change this to whatever folder the game icons reside in.

GameString = "<TABLE BORDER=0 CELLSPACING=10 CELLPADDING=0 WIDTH=100%>" + //This tag must NOT be modified!
             "<TR><TD COLSPAN=2 ALIGN=center><STRONG>Solitaire Games</STRONG></TD></TR>" +
             "<!-- STATIC GAMES -->" +
             "</TABLE>"

MaxGames = 30 //Support for 30 static games. Increaes these value if you need more.
ArrGameInfo = new Array(MaxGames)

TotalGames = 0 //Tracks the number of games entered.

function DisplayGames()
{
	document.write(GameString)
}

//AddGame inserts a new static game into the list of available static games. A series of AddGame()
//calls is made at the bottom of this file

function AddGame(GameName, GameIcon, GameURL)
{
	if(TotalGames >= MaxGames)
	{
		alert("Maximum number of games has been reached!")
		return
	}

	ArrGameInfo[TotalGames] = new Game(GameName, GameIcon, GameURL)

	tagString = "<!-- STATIC GAMES -->"
	NewGameString = "<TR><TD><A HREF=\"javascript:OpenGame(" + TotalGames + ")\">" +
	                "<IMG BORDER=0 SRC=\"" + ICONPATH + GameIcon + "\">" +
	                "</A></TD>" +
	                "<TD VALIGN=middle width=100%><A HREF=\"javascript:OpenGame(" + TotalGames + ")\">" +
	                GameName + "</A></TD></TR>" + tagString

	GameString = GameString.replace(tagString, NewGameString)

	TotalGames++
}

//Game() creates a new Game object.

function Game(GameName, GameIcon, GameURL)
{
	this.gamename = GameName
	this.gameicon = GameIcon
	this.gameurl = GameURL
}

//OpenGame() will look at the object specified by number, and find it's URL



// OLD GAME LAUNCH
function OpenGame(index)
{
	window.open(ArrGameInfo[index].gameurl, "iamgame", "width=640, height=540, toolbar=0, status=0, menubar=0, scrollbars=0, resizable=0")
}

//CloseGame() will close the current game running
function CloseGame()
{
	top.window.close();
}

function AdRedirTo(to, sitelocation, campaign)
{
	var ord = new Number(Math.floor(1000000 * Math.random())+1);
	
  var numFrames = 1;
  try
  {
		var iFrames = parent.window.frames;
		numFrames = iFrames.length;
  }
  catch( exception )
  {
  }

  if ( numFrames == 0 )
  {
		window.location = "../AdRedir.php?url="+to+"&location="+sitelocation+"&campaign="+campaign + "&dontClos=1";
  }
  else
  { 
		var newWindow = window.open("../AdRedir.php?url="+to+"&location="+sitelocation+"&campaign="+campaign, "" + ord,  "width=250,height=290");  
		if ( newWindow )
			window.focus();
		newWindow.blur();
  }
}

//Create your static games here!

//AddGame("Eleven Up", "11upicon.gif", "/sgames/11UP/client_frames.php")
//AddGame("Magic 21", "m21icon.gif", "/sgames/M21/client_frames.php")
//AddGame("Pyramid", "pyramidicon.gif", "/sgames/Pyramid/client_frames.php")
//AddGame("Go Away!", "goaway.gif", "/sgames/GOAWAY/client_frames.php")
//AddGame("Rescue Me!", "pyramidicon.gif", "/sgames/Rescue/client_frames.php")

function OpenIENFrameset(szGameName, height, width, file, idx)
{
	if ( idx == '' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

	//height = height + 2;
	nHeight = height + 120 + 68; // for chat and ad
  window.open("/games/iEN_Games/client_frames.ien.php?szGameName=" + szGameName+"&nGameHeight="+height +"&szFile=" + file + "&idx="+idx + "&status=" + status, "" + WindowName, "width=" + width + ",height=" + nHeight + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");
}

function OpenIENLanenaFrameset(szGameName, height, width, file, idx)
{
  var WindowName = szGameName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

	if ( idx == '' )
	{
		alert("Please login or create an account first");
		//nHeight = height + 68; // for chat and ad
		//window.open("/games/iEN_Games/client_frames.iEN.Lalena_no_chat.php?szGameName=" + szGameName+"&nGameHeight="+height +"&szFile=" + file, "" + WindowName, "width=" + width + ",height=" + nHeight + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");

		return;
	}
	//height = height + 2;
	nHeight = height + 120 + 68; // for chat and ad
  window.open("/games/iEN_Games/client_frames.iEN.Lalena.php?szGameName=" + szGameName+"&nGameHeight="+height +"&szFile=" + file + "&idx="+idx + "&status=" + status, "" + WindowName, "width=" + width + ",height=" + nHeight + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");
}

function OpenIENLocalGamesFrameset(szGameName, height, width, file, idx)
{
  var WindowName = szGameName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

	if ( idx == '' )
	{
		alert("Please login or create an account first");
		//nHeight = height + 68; // for chat and ad
		//window.open("/games/iEN_Games/client_frames.iEN.localgames_no_chat.php?szGameName=" + szGameName+"&nGameHeight="+height +"&szFile=" + file, "" + WindowName, "width=" + width + ",height=" + nHeight + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");

		return;
	}
	//height = height + 2;
	nHeight = height + 120 + 68; // for chat and ad
  window.open("/games/iEN_Games/client_frames.iEN.localgames.php?szGameName=" + szGameName+"&nGameHeight="+height +"&szFile=" + file + "&idx="+idx + "&status=" + status, "" + WindowName, "width=" + width + ",height=" + nHeight + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");
}

function OpenIENKidsGamesFrameset(szGameName, height, width, file, idx)
{
	var WindowName = szGameName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');
  WindowName = WindowName.replace('+','a');

	//height = height + 2;
	nHeight = height + 68; // for ad
  window.open("/games/iEN_Games/client_frames.iEN.kids.php?szGameName=" + szGameName+"&nGameHeight="+height +"&szFile=" + file + "&idx="+idx + "&status=" + status, "" + WindowName, "width=" + width + ",height=" + nHeight + ", toolbar=0, status=0, menubar=0, scrollbars=0, resizable");
}

function OpenIAGEWordSearchFrameset( szGameName, szGameType, IDX, status )
{
	if ( IDX == '' || IDX == '0' )
	{
		alert("Please login or create an account first");
		return;
	}

	var WindowName = szGameType.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');
	WindowName = WindowName.replace('+','a');

	if ( status >= 5 )
	  window.open("/games/ClientFramesets/client_frames.WordSearch.asp?idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + IDX + szGameName, "width=630,height=573,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
	else
	  window.open("/games/ClientFramesets/client_frames.WordSearch.asp?idx="+IDX + "&szGameName=" + szGameName +"&szGameType=" + szGameType + "&status=" + status, "" + WindowName + szGameName, "width=630,height=573,toolbar=0,status=0,menubar=0,scrollbars=0,resizable");
}