
// retorna a altura da página
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.body ? document.body.clientHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0
	);
}

// retorna o Width da página
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.body ? document.body.clientWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0
	);
}

// retorna a posição do Scroll
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


function escondeDiv(divToHide){
	document.getElementById(divToHide).style.display = 'none';
	document.getElementById("AlphaDiv").style.display = 'none';
	exibeSelects();
}

function mostraDiv(divToShow){
	document.getElementById(divToShow).style.display = '';
}

function exibeAlpha(){
	mostraDiv("AlphaDiv");
	var hpag = f_clientHeight() + "px";
	var wpag = f_clientWidth() + "px";
	var layer= document.getElementById("AlphaDiv").style;
//	alert("w: "+wpag+" h: "+hpag);

	var IE=!!document.all;
	var N4=!!document.layers;
	var N6=!!document.getElementById && !document.all;
	var name='AlphaDiv';
	
	if (IE) layer=document.all(name).style;
	if (N4) layer=document.layers[name];
	if (N6) layer=document.getElementById(name).style;	
	
//	alert(layer);

	layer.left = "0px";
	layer.top = "0px";
	
	
	//alert("tampag : "+hpag);
	
	wpag = Math.max(document.body.clientWidth,document.body.scrollWidth);
	hpag = Math.max(document.body.clientHeight,document.body.scrollHeight);
	wpag = wpag + "px";
	hpag = hpag + "px";
	
	layer.width = wpag;
	layer.height = hpag;


}

function exibeLogin(ErrorMSG, linkPag){
	
	var loginDiv = document.getElementById('loginDiv');
	// para alinhar o div no meio da página:
	var topVar = f_scrollTop() + 245;
	topVar = topVar + "px";

	//document.getElementById('msgErro').innerHTML = ErrorMSG ;
	loginDiv.style.display = ''
	loginDiv.style.top = topVar;
//	loginDiv.style.top = "200px";
//	alert("topvar: "+topVar); 
	exibeAlpha();	
	escondeSelects();
	
	document.getElementById("txtLoginEmail").focus();
/*
	document.getElementById('btOkAlert').onclick=function(){
		escondeDiv("loginDiv");
		if(linkPag){
			window.location.href=linkPag;
		}
	}*/	
}

function escondeLogin(){
	escondeDiv('loginDiv');
}


