// OBJETOS AJAX PARA FUNCIONALIDADES VARIAS
//Funciones de Ajax que permite la carga dinamica de datos desde javascript
function nuevoAjax() { 
	var xmlhttp=false; 
	try { // Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e){ 
		try{ // Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 	      
	return xmlhttp; 
}
function usuarios(user,pass,municipio){	
    usuario=document.getElementById(user).value;	
    password=document.getElementById(pass).value;			
    poblacion=document.getElementById(municipio).value;			
    var aleatorio=Math.random();
    ajax=nuevoAjax();
    ajax.open("GET", "./intranet/usuarios.php?usuario="+usuario+"&pass="+password+"&poblacion="+poblacion+"&nocache="+aleatorio, true);        
    ajax.onreadystatechange=function() { 
        if (ajax.readyState==4){ 
          var resultado=ajax.responseText;                        
          if (resultado==1){
            window.location = "intranet/index.php";
          }
          else{
            //alert(resultado);
	    alert("El usuario y la contraseņa no son correctos....");
          }
        } 
      }
      ajax.send(null);    
}