function ShowPopUpWindow(strURL, bCentrePopup, bResizable, bScrolling, Height, Width)
{
	//create unique id so each time a popup is clicked a new window opens.
	var day = new Date();
	var id = day.getTime();
	var strWindowFormat='';
	
	if (bResizable)
	{
		strWindowFormat = strWindowFormat+"resizable=1";
	}
	else
	{
		strWindowFormat = strWindowFormat+"resizable=0";
	}
	//add extra default settings
	if (bCentrePopup)
	{
		if (Width=='')
		{
			Width=100;
		}
		if (Height=='')
		{
			Height=100;
		}
		var windowLeft = (screen.width - Width) / 2;
		var windowTop = (screen.height - Height) / 2;
		strWindowFormat = strWindowFormat+",left=" + windowLeft + ",top=" + windowTop;
	}
	if (bScrolling)
	{
		strWindowFormat = strWindowFormat+",scrollbars=1";
	}
	strWindowFormat = strWindowFormat+",width=" + Width + ",height=" + Height;
	//switch for status bar
	strWindowFormat = strWindowFormat+",status=0";
	//switch for help icon on the windows tool bar
	strWindowFormat = strWindowFormat+",help=0"
	//switch for address bar
	strWindowFormat = strWindowFormat+",location=0"
	//switch for menu bar
	strWindowFormat = strWindowFormat+",menubar=0"
	//alert(strWindowFormat);

	window.open(strURL, 'popUpWindow'+id, strWindowFormat);
	
}
function LaunchGameInfoHelp()
{
	var strURL = rootname + "StaticContent/GameInfoHelp/index.htm";
	ShowPopUpWindow(strURL, false, true, true, 400, 640);
}
function ViewTerms(strURL)
{
	ShowPopUpWindow(strURL, true, true, true, 400, 500);
	return false;	
}
function register_startup() {
	register_RefreshForCountrySelection();
}

function checkform() {
	var obj = document.getElementById("addresscountrycode");
	var index = getselectedindex(obj);
	var strcountry = obj[index].value;
	
	if (strcountry == "US" || strcountry == "VI" || strcountry == "UM" || strcountry == "AN" || strcountry == "TR")
	{
		alert (strAN);
		return false;
	}
	else
		return true;
}

function getselectedindex(objcombo) {
	var intindex = -1;
	var intoption = 0;
	
	while (intoption < objcombo.options.length) 
	{
		if (objcombo.options[intoption].selected == true)
		{
			intindex = intoption;
			intoption++;
		}
	}
	
	return intindex;
}

function register_RefreshForCountrySelection() 
{
	var objcountry = document.getElementById("addresscountrycode");
	var objstate = document.getElementById("state");
	
	if (objstate && objcountry) {
		var index = getselectedindex(objcountry);
		var strcode = (index < 0 ? "" : objcountry[index].value);
		var stateindex = getselectedindex(objstate);
		var statevalue = "";
		
		
		if (stateindex > 0)
			statevalue = objstate.options[stateindex].value;
				
		clearcombobox(objstate);
		var count = 0;
		addtexttocombo(objstate, "", "");
		for (var a = 0; a < arrStates.length; a++) {
			if (arrStates[a][2] == strcode) {
				count ++;
				addtexttocombo(objstate, arrStates[a][1], arrStates[a][0]);
			}
		}
		if (count == 0) {
			objstate.options[0].text = varNA
			objstate[0].selected = true;
		}
		
		// select state:
		if (statevalue != "") {
			for (var a = 0; a < objstate.options.length; a++) {
				if (objstate.options[a].value == statevalue)
					objstate.options[a].selected = true;
			}
		}
	}
}

function clearcombobox(objcombo) {
	while (objcombo.options.length > 0)
		removecomboitem(objcombo, 0);
}
function removecomboitem(objcombo, intindex) {
	if (objcombo.options.remove)
		objcombo.options.remove(intindex);
	else
		objcombo.options[intindex] = null;
}
function addtexttocombo(objcombo, strtext, strvalue) {
	var oNewOpt = new Option();
	var intpos = objcombo.options.length;
	oNewOpt.value = strvalue;
	objcombo.options[objcombo.options.length] = oNewOpt;
	objcombo.options[intpos].text = strtext;
}
function getselectedindex(objcombo) {
	var intindex = -1;
	var intoption = 0;
	while (intoption < objcombo.options.length) {
		if (objcombo.options[intoption].selected == true)
			intindex = intoption;
		intoption++;
	}		
	return intindex;
}
function handlePrimaCasinoActiveX(externalgamepassword, clientlogincode)
{	
	if (document.Loader && document.Loader.object) 
	{
		document.Loader.SetID3=externalgamepassword;
		document.Loader.SetID4=0;
		document.Loader.LogUName=clientlogincode;
	} 

	if (window.external && window.external.object) 
	{
		window.external.SetID3=externalgamepassword;
		window.external.SetID4=0;
		window.external.LogUName=clientlogincode;
	} 

}
function WithdrawalChargeInfo(strURL)
{
	ShowPopUpWindow(strURL, true, false, true, 500, 600);
	return false;
}
function CardVerificationInfo(strURL)
{
	ShowPopUpWindow(strURL, true, false, true, 340, 380);
	return false;
}
function DirectBankTransferWithdrawal(strURL)
{
	ShowPopUpWindow(strURL, true, true, true, 600, 820);
	return false;
}
function DirectBankTransferDeposit(strURL)
{
	ShowPopUpWindow(strURL, true, false, true, 600, 820);
	return false;
}