//////////////////// DIV POPUPS LAYER FUNCTIONS (wait layer)

var showDiv = false;

function closeDivPage(){
	try{
	showDiv = false;
	document.onkeypress = {};
    document.getElementById("divSignin").style.display="none";
    objDiv = document.getElementById("divg");
    objDiv.style.display = "none"; 
	}catch(e){
		alert(e);
	}
}
 
function showDivPage(w,h){
    try{ 
		if(showDiv == true){
			document.getElementById("divSignin").style.width = w;
			document.getElementById("divSignin").style.height = h;
			document.getElementById("pb3ds").style.width = w;
			document.getElementById("pb3ds").style.height = h;
	        document.getElementById("divSignin").style.display="block";
	        objDiv = document.getElementById("divg");
			objDiv.style.display = "block"; 
			objDiv.style.width = 3000;
			objDiv.style.height = 3000;
			fnSetDivSigninLeft("divSignin");
			document.onkeypress = stopRKey;  
			window.onresize = function(){showDivPage(w,h);}
		}
    }catch(e){
        alert(e);
    }
}

function locDivPage(url){
	document.frames['payment'].location = url;
}

function fnSetDivSigninLeft(oElement){
	var centerPoint = window.center({width:parseInt(document.getElementById(oElement).offsetWidth,10),height:parseInt(document.getElementById(oElement).offsetHeight,10)});
	document.getElementById(oElement).style.left = centerPoint.x + "px";
	document.getElementById(oElement).style.top = centerPoint.y + "px";
	return false;     
}

function stopRKey(evt) {
	var evt  = (evt) ? evt : ((event) ? event : null);
	if(evt.keyCode) { return false; }
}

window.size = function()
{
	var w = 0;
	var h = 0;

	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
		h = window.innerHeight;
	}
	return {width:w,height:h};
}

window.center = function()
{
	var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};

	var _x = 0;
	var _y = 0;
	var offsetX = 0;
	var offsetY = 0;

	//IE
	if(!window.pageYOffset)
	{
		//strict mode
		if(!(document.documentElement.scrollTop == 0))
		{
			offsetY = document.documentElement.scrollTop;
			offsetX = document.documentElement.scrollLeft;
		}
		//quirks mode
		else
		{
			offsetY = document.body.scrollTop;
			offsetX = document.body.scrollLeft;
		}
	}
	//w3c
	else
	{
		offsetX = window.pageXOffset;
		offsetY = window.pageYOffset;
	}

	_x = ((this.size().width-hWnd.width)/2);
	_y = ((this.size().height-hWnd.height)/2);

	return{x:_x,y:_y};
}

// Iframe load URL in DIV function
var iframeLoad = {
	changeIframe:function(url,iframeEl){
		showDiv = true;
		this.returnID(iframeEl).setAttribute('src','http://www.boophone.com/blank.lol');
		this.returnID(iframeEl).setAttribute('src',url);
	},
	returnID:function(el){
		return document.getElementById(el);
	}
}

