function showEvent( elemento ){
		var c_obj = document.getElementById(elemento);
		if ( c_obj.style.display == 'none' ) c_obj.style.display = 'block';
		else c_obj.style.display = 'none';
	}

// Gravar/Alterar Perfil
function Logar(){ 
 
 xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Seu browser não suporta AJAX!");
  return;
  } 

  var Acao = "Logar"
  var EmailLogin = document.getElementById('EmailLogin').value;
  var SenhaLogin = document.getElementById('SenhaLogin').value;
  
  var Erro = "Nao"

 if (SenhaLogin == "")
 {document.getElementById('SenhaLogin').style.border = "1px solid #cc0033"; document.getElementById('SenhaLogin').focus(); Erro = "Sim"}
 else{document.getElementById('SenhaLogin').style.border = "1px solid #dfdfdf";}

 if (EmailLogin == "")
 {document.getElementById('EmailLogin').style.border = "1px solid #cc0033"; document.getElementById('EmailLogin').focus(); Erro = "Sim"}
 else{document.getElementById('EmailLogin').style.border = "1px solid #dfdfdf";}

 


 
 if (Erro == "Sim") { return(false);}else {document.getElementById('FormIlogin').submit();}
   
}


// Gravar/Alterar Perfil
function Cadastrar()
{ 
 
 xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Seu browser não suporta AJAX!");
  return;
  } 

  var Acao = "Logar"
  var NomeCad = document.getElementById('NomeCad').value;
  var EmailCad = document.getElementById('EmailCad').value;
  var TelefoneCad = document.getElementById('TelefoneCad').value;
  var SenhaCad = document.getElementById('SenhaCad').value;
  
  var Erro = "Nao"

 if (SenhaCad == "")
 {document.getElementById('SenhaCad').style.border = "1px solid #cc0033"; document.getElementById('SenhaCad').focus(); Erro = "Sim"}
 else{document.getElementById('SenhaCad').style.border = "1px solid #dfdfdf";}

 if (EmailCad == "")
 {document.getElementById('EmailCad').style.border = "1px solid #cc0033"; document.getElementById('EmailCad').focus(); Erro = "Sim"}
 else{document.getElementById('EmailCad').style.border = "1px solid #dfdfdf";}

 if (TelefoneCad == "")
 {document.getElementById('TelefoneCad').style.border = "1px solid #cc0033"; document.getElementById('TelefoneCad').focus(); Erro = "Sim"}
 else{document.getElementById('TelefoneCad').style.border = "1px solid #dfdfdf";}

 if (NomeCad == "")
 {document.getElementById('NomeCad').style.border = "1px solid #cc0033"; document.getElementById('NomeCad').focus(); Erro = "Sim"}
 else{document.getElementById('NomeCad').style.border = "1px solid #dfdfdf";}

 if (Erro == "Sim") { return(false);}else {document.getElementById('FormCad').submit();}
   

}


// Gravar/Alterar Perfil
function Lembrar()
{ 
 
 xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Seu browser não suporta AJAX!");
  return;
  } 

  var Acao = "Lembrar"
  var EmailLem = document.getElementById('EmailLem').value;
  
  var Erro = "Nao"

 if (EmailLem == "")
 {document.getElementById('EmailLem').style.border = "1px solid #cc0033"; document.getElementById('EmailLem').focus(); Erro = "Sim"}
 else{document.getElementById('EmailLem').style.border = "1px solid #dfdfdf";}

 if (Erro == "Sim") { return(false);}else {document.getElementById('FormLem').submit();}
   

}


// AddFavoritos
function AddFavoritos(CodImovel,IdObj,Acao){ 
 
 xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Seu browser não suporta AJAX!");
  return;
  } 
 
 document.getElementById(IdObj).innerHTML = "<IMG SRC='IMAGES/favorito.PNG' OnClick=OffFavoritos('"+ CodImovel +"','"+ IdObj +"','Retirar') >";

 //AJAX PARA VERIFICAR DISPONIBILIDADE DO NOME DE USUÁRIO
     var Pagina = "Processamento/InsereFavorito.asp";

	 var url=Pagina+"?Acao="+Acao+"&CodImovel="+CodImovel;
         url=url+"&sid="+Math.random();
         //xmlHttp.onreadystatechange=stateChanged;
         xmlHttp.open("GET",url,true);
         xmlHttp.send(null);

		 //x = document.getElementById("ConteudoGeral")
   
}

// OffFavoritos
function OffFavoritos(CodImovel,IdObj,Acao){ 
 
 xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Seu browser não suporta AJAX!");
  return;
  } 
 
 document.getElementById(IdObj).innerHTML = "<IMG SRC='IMAGES/ADICIONAR.PNG' OnClick=AddFavoritos('"+ CodImovel +"','"+ IdObj +"','Inserir') >";

 //AJAX PARA VERIFICAR DISPONIBILIDADE DO NOME DE USUÁRIO
     var Pagina = "Processamento/InsereFavorito.asp";

	 var url=Pagina+"?Acao="+Acao+"&CodImovel="+CodImovel;
         url=url+"&sid="+Math.random();
         //xmlHttp.onreadystatechange=stateChanged;
         xmlHttp.open("GET",url,true);
         xmlHttp.send(null);

		 //x = document.getElementById("ConteudoGeral")
   
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//FUNÇÃO STATECHANGED SETA ONDE OCORRERÁ O PROCESSAMENTO NA PÁGINA DE CHAMADA
function stateChanged() 
{ 
if (xmlHttp.readyState==1)
{ 
x.innerHTML="<div id='CarregadorForm' Style='margin:auto;margin-top:120px;width:100px;padding:10px;text-align:center'><img src=images/loading2.gif></div>"
}
if (xmlHttp.readyState==4)
{ 

x.innerHTML=xmlHttp.responseText;

}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

