function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function comprobar_datos()
{
	usuario = document.getElementById("usuario").value;
	pass = document.getElementById("pass").value;
  
  var pars = "usuario=" + usuario + "&pass=" + pass;	  
  
  ajax = nuevoAjax();     
  ajax.open("POST","includes/comprobar_logeo.php",true);         
  ajax.onreadystatechange=function() {                 

    if (ajax.readyState==4)
    {            
    	 if(ajax.responseText == 1)
    	 {
    	   irUrl("http://www.guiadeayuntamientos.info");
    	   return true;    	   
    	 }
    }
  }
     
  ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  ajax.send(pars)
}

function irUrl(url) 
{
  if(window.opener)                    
    window.opener.location.href=url;
}
