var xmlHttp
function ajax_login_front()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var login = document.getElementById('login').value;
var senha = document.getElementById('senha').value;

var page="verifica_login.php"
page=page+"?senha="+senha+"&login="+login
page=page+"&sid="+Math.random()
xmlHttp.onreadystatechange=mostra_status
xmlHttp.open("GET",page,true)
xmlHttp.send("")

}

function checkLogin()
{
 if (xmlHttp.responseText == "logado")
  {
  alert('Seja Bem vindo');
  window.location='clientes/principal.php';
 } 
  else if(xmlHttp.responseText == "logado2")
  {
  alert('Seja Bem vindo');
  window.location='../clientes/principal.php';
 }
 else if(xmlHttp.responseText == "nao ativo")
  {
  alert('Cadastro Não Ativo');
 }
 else
 {
 alert('Dados Invalidos');
 }
 }

function mostra_status() 

{ 
if(xmlHttp.readyState == 1) { // Quando estiver carregando, exibe uma camada: Carregando...
document.getElementById('inf').style.visibility="visible";
}
if(xmlHttp.readyState == 4||xmlHttp.readyState=="Complete")
{ 
document.getElementById('inf').style.visibility="hidden";
checkLogin();
}

}
function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 

function abrePopup(PAGINA, LARGURA, ALTURA, VALOR){
	var centroLeft = window.screen.width / 2 - 267.5;
	var centroTop = window.screen.height / 2 - VALOR;
	//
	window.open(PAGINA,'01','top='+centroTop+',left='+centroLeft+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+LARGURA+', height='+ALTURA+''); void(0)
}