window.name = "homewindow";
if(!gameWin)
	var gameWin= null;

function openGamePage(gameType) {
		openGamePage(gameType,'spbd')
}//openGamePage

function openGamePage(gameType,provider) 
	{
		//alert("game: "+gameType+", provider: "+provider);
		if (gameWin != null && !gameWin.closed)
		{
			gameWin.focus();
			gameWin.alert("The game window is already open");
		}	
		else 
		{
			openGamewindow(gameType,provider);		
		}
	}
//openGamePage

function openGamewindow(gameType,provider)
{
	var w = window.screen.availWidth;
	var h = window.screen.availHeight;
	if(h > 800) {
		h=750;
	}//for higher resolutions
	if(w > 800) {
		w = w-25;
	} else {
		w = w-10;
	}//for higher resolutions
	//var windowDimensionsString  =provider == 'obs'?",width=767,height=567" : ",width=750,height=550";
	var windowDimensionsString  = ",width=750,height=550";
	var windowScreenLocation    = ",left="+(w-750)/2+",top="+(h-550)/2;
	var features = 	windowDimensionsString +
					windowScreenLocation + 
					",scrollbars=no" +
					",toolbar=no" +
					",menubar=no,resizable=yes,fullscreen=7";
	//modified on 05-nov-2004
		if(location.href.indexOf("index.html") != -1)
		{
			window.name	=  "slotgames";
			location.href="/commonsys/play/game_page.jsp?gameType="+gameType;
			return;
		}
	gameWin=window.open("/commonsys/play/game_page.jsp?gameType="+gameType+"&provider="+provider, "slotgames", features);
	//gameWin=window.open("../../play/game_page.jsp?gameType="+gameType, "slotgames", 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=760,height=630,left = 260,top = 212');
}

function openWin(winName,stockroot_url)
{
	if(winName!="kenoGame")
	{
		var date = new Date();
		var random_num = Math.random();
		var trackurl ="https://as1.emv2.com/P?emv_client_id=34509&emv_conversionflag=n&emv_pagename=game_window_page&emv_currency="+currency+"&emv_text1=PLAYERID_"+playerid_js+"&emv_text2=USERNAME_"+username+"&emv_date1="+date+"&emv_random="+random_num+"";
		//alert("URL="+trackurl);
		var trackImgDeposit = new Image();
		trackImgDeposit.src=trackurl;
	}
	allowResize = "yes";
	// Start at top left
	LeftPosition = 100;
	TopPosition = 0;
	// Go almost full-screen for Flash Bingo
	myHeight = (screen.height) ? (screen.height-145) : 455;
	myWidth = myHeight * 1.3475;
	// Set the left and top window position to zero if logic above has produced a value less than zero
	if (LeftPosition < 0) {	LeftPosition = 0;}
	if (TopPosition < 0) {	TopPosition = 0;}
	// Configure other window properties
	winProps = "left="+LeftPosition+",top="+TopPosition+",width="+myWidth+",height="+myHeight+",location=0,scrollbars=0,menubar=0,toolbar=0,resizable=" + allowResize;			
	binWin = window.open("", winName, winProps);
	//var actionURL = stockroot_url+"/bingo/flashbingolauncher.jsp";
	try
	{	document.forms[winName].target = winName;
		//document.forms[winName].action = actionURL;
		document.forms[winName].submit();

	}
	catch(e)
	{
		alert(e);
	}
	binWin.focus();
}
function openWinGame(gameName,gameType,configId)
{
	var windowname =gameName;
	while (windowname.indexOf(' ')!=-1){windowname=windowname.replace(' ','');}
	if(gameName!="Keno")
	{
		var date = new Date();
		var random_num = Math.random();
		var trackurl ="https://as1.emv2.com/P?emv_client_id=34509&emv_conversionflag=n&emv_pagename=game_window_page&emv_currency="+currency+"&emv_text1=PLAYERID_"+playerid_js+"&emv_text2=USERNAME_"+username+"&emv_date1="+date+"&emv_random="+random_num+"";
		//alert("URL="+trackurl);
		var trackImgDeposit = new Image();
		trackImgDeposit.src=trackurl;
	}
	 allowResize = "yes";
	 // Start at top left
	 LeftPosition = 100;
	 TopPosition = 0;
	 // Go almost full-screen for Flash Bingo
	 myHeight = (screen.height) ? (screen.height-145) : 455;
	 myWidth = myHeight * 1.3475;
	 // Set the left and top window position to zero if logic above has produced a value less than zero
	 if (LeftPosition < 0) { LeftPosition = 0;}
	 if (TopPosition < 0) { TopPosition = 0;}
	 // Configure other window properties
	 winProps = "left="+LeftPosition+",top="+TopPosition+",width="+myWidth+",height="+myHeight+",location=0,scrollbars=0,menubar=0,toolbar=0,resizable=" + allowResize;
	 binWin = window.open("/commonsys/launchGame.jsp?gameName="+gameName+"&gameType="+gameType+"&configId="+configId, windowname, winProps);
	 binWin.focus();
}
function openWinPullTab(winName,stockroot_url)
{
	allowResize = "yes";
	// Start at top left
	LeftPosition = 100;
	TopPosition = 0;
	// Go almost full-screen for Flash Bingo
	myHeight = (screen.height) ? (screen.height-145) : 455;
	myWidth = myHeight * 1.3475;
	// Set the left and top window position to zero if logic above has produced a value less than zero
	if (LeftPosition < 0) {	LeftPosition = 0;}
	if (TopPosition < 0) {	TopPosition = 0;}
	// Configure other window properties
	//alert(myHeight+"   "+myWidth);
	winProps = "left="+LeftPosition+",top="+TopPosition+",width=480,height=635,location=0,scrollbars=0,menubar=0,toolbar=0,resizable=" + allowResize;			
	binWin = window.open("", winName, winProps);
	//var actionURL = stockroot_url+"/bingo/flashbingolauncher.jsp";
	try
	{	document.forms[winName].target = winName;
		//document.forms[winName].action = actionURL;
		document.forms[winName].submit();

	}
	catch(e)
	{
		alert(e);
	}
	binWin.focus();
}
