// JavaScript Document
var xmlHttp

function showlg()
{ 
/*if (document.getElementById('concelho')) 
	{document.getElementById('concelho').value = null;}
if (document.getElementById('freguesia')) 
	{document.getElementById('freguesia').value = null;}	*/
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 var user=document.getElementById('email_login').value
 var pwd=document.getElementById('pass_login').value
//alert (user+" - "+pwd)
var url="get_lg.php"
url=url+"?email="+user+"&pass="+pwd
url=url+"&sid="+Math.random()
//alert(url)
xmlHttp.onreadystatechange=stateChanged_log 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function logout()
{ 
/*if (document.getElementById('concelho')) 
	{document.getElementById('concelho').value = null;}
if (document.getElementById('freguesia')) 
	{document.getElementById('freguesia').value = null;}	*/
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
//alert (user+" - "+pwd)
var url="get_lg.php"
url=url+"?sta=logout"
url=url+"&sid="+Math.random()
//alert(url)
xmlHttp.onreadystatechange=stateChanged_logout 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged_log() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
  document.getElementById("log_aj").innerHTML=xmlHttp.responseText 
 } 
}

function stateChanged_logout() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 window.location='home.php';
 document.getElementById("log_aj").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;
}