function Login(){
var objAjax, strResposta, strUser, strSenha, strDadosUser;
	try {
	  objAjax = new XMLHttpRequest();
	}
	catch(e1) {
		try {
		   objAjax = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e2) {
			try {
				objAjax = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(e3) {
				alert("Por favor, atualize o seu browser para que o sistema funcione corretamente!");
				objAjax = null;
				return false;
			}
		}
	}
	if (objAjax != null) {
		objAjax.open("POST", "scripts/login.php", true);
		objAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		objAjax.onreadystatechange = function() {
			if (objAjax.readyState == 1) {
				document.getElementById("Loading").innerHTML = "<div style='font-family:Helvetica, Arial, Tahoma, Verdana, sans-serif; font-size:14px; color:#666666; padding_left=10px'><br><br><br><br><br><br><br><br><img src=../images/loading.gif /><br>Carregando</div>";	
				document.getElementById("Formulario").style.display = "none";	
			}
			else if (objAjax.readyState == 4 && objAjax.status == 200) {
				document.getElementById("Loading").innerHTML = "";	
				strResposta = objAjax.responseText;
				if(strResposta == "0"){
					document.getElementById("Formulario").style.display = "block";	
					document.frmLogin.txtLogin.focus();
					document.getElementById("RespostaLogin").innerHTML = "<font color='#FF0000'>Usu&aacute;rio ou Senha inv&aacute;lido. Entre com usu&aacute;rio e senha v&aacute;lidos para ter acesso.</font>";	
				}
				else if(strResposta == "1"){
					window.location.href = "sistemas.php";
				}
			}
		}
	}
	strUser = document.frmLogin['txtLogin'].value;
	strSenha = document.frmLogin['txtSenha'].value;
	strDadosUser = "strUser="+strUser+"&strSenha="+strSenha;
	objAjax.send(strDadosUser);
}
