var nomesJanelas = new Array();
var InfoChildX = 0;
var InfoChildY = 0;



nomesJanelas.push("player");

function iecompattest(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function centerPlayer(tipo) {

	var ie5=document.all&&document.getElementById
	var ns6=document.getElementById&&!document.all
	
	var winWidth = ns6? window.innerWidth-40 : iecompattest().clientWidth - 40;
	var winHeight = ns6? window.innerHeight-40 : iecompattest().clientHeight - 40;	
	
	if (arguments.length > 1) {
		if (arguments[2] != undefined) {
			var scrollY = arguments[2];
		} else {
			var scrollY = 0;
		}
		if (arguments[1] != undefined) {
			var scrollX = arguments[1];
		} else {
			var scrollX = 0;
		}
	} else {
		var scrollY = 0;
		var scrollX = 0;
	}
	
	for (var i = 0; i < nomesJanelas.length; i++) {
		
		var nome = nomesJanelas[i]; 
		
		var popupWidth	= document.getElementById(nome).style.width;	
		var popupWidth	= popupWidth.substr(0,popupWidth.length-2);
		
		var popupHeight = document.getElementById(nome).style.height;	
		var popupHeight	= popupHeight.substr(0,popupHeight.length-2);
		
		var winX = Math.ceil((winWidth - popupWidth) / 2);
		var winY = Math.ceil((winHeight - popupHeight) / 2);
				
		// POPUP
		winX = (winX - scrollX - ((tipo == "home") ? 320 : ((tipo == "internas") ? 330 : -80)));
	    winY = ( ( -scrollY )  + ((tipo == "home") ? 175 : ((tipo == "internas") ? 175 : 175)));
//		  winY = (winY - scrollY - ((tipo == "home") ? 175 : ((tipo == "internas") ? 130 : 265)));
		
		document.getElementById(nome).style.left =  winX + 'px';
		document.getElementById(nome).style.top = winY + 'px';
		document.getElementById(nome).style.visibility = "visible";
	}

}

function verificaPG(x,y)
{
	InfoChildX = x;
	InfoChildY = y;
	
	var endereco = window.ConteudoSite.location.toString();
	var busca = new RegExp('\home3.php|home.php|home.htm + \gmi');

	centerPlayer("home",x,y);

	if (endereco.match(busca)) {
		centerPlayer("home",x,y);
	} else {
		centerPlayer("internas",x,y);
	} 
	
}