/*
* This function launchs the Flash Casino english client.
*/
var lobbyWindow=null;

function launchCasino(){
	if(lobbyWindow != null && !lobbyWindow.closed) {
		lobbyWindow.focus();
		return;
	}
	var mytitle = "FlashClient";
	if(navigator.appName && navigator.appName.indexOf("Netscape") == -1 && navigator.appVersion.indexOf("Netscape") != -1){
		lobbyWindow = window.open("https://casino.azartiacuenta.com/fcasino/es_ES/FlexCasino.html?lid=es_ES&wm="+ value + "","" + mytitle,"toolbar=no,status=no,height=526,width=780,resizable=no," + getScreenXYParamString(780,526));
	} else {
		lobbyWindow = window.open("https://casino.azartiacuenta.com/fcasino/es_ES/FlexCasino.html?lid=es_ES&wm="+ value + "","" + mytitle,"toolbar=no,status=no,height=526,width=780,resizable=no," + getScreenXYParamString(780,526));
	}
	if ( redirect != 'set' ) {
		window.location = "/getting_started/"
	}
}

/*
* This function returns the location of the child window such that the
* child is centered with respect to the parent window.
* Return value is in the form of parameter to window.open
*/

function getChildLocation(parentX, parentY, parentWidth, parentHeight, childWidth, childHeight){
	var titleHeight = 30;
	var pw = parseInt(parentWidth+"");
	var ph = parseInt(parentHeight+"");
	var cw = parseInt(childWidth + "");
	var ch = parseInt(childHeight+"");

	var x = parseInt((pw - (cw + 10))/2);
	x = x + parseInt(parentX+"");
	var y = parseInt((ph - (ch + titleHeight))/2);

	y = y + parseInt(parentY+"");
	topLeft = parseInt(x+"");
	topRight = parseInt(y+"");
	return "screenX=" + topLeft + ",screenY=" + topRight + ",left=" + topLeft + ",top=" + topRight;
}
/*
* This function accepts the width and height of the window
* and returns a string representing the parameter to the window.open method.
*/
function getScreenXYParamString(w,h){
	return getChildLocation(0, 0, window.screen.width, window.screen.height, w, h);
}

