var error, descripcion;

function handleHttpResponse01() { 
    if (http01.readyState == 4||http01.readyState == "complete") {
  try{  	 
       if (http01.status == 200) { 
       	  var arrInfo  = http01.responseText.split("|");
       	  error = arrInfo[0];
       	  descripcion = arrInfo[1];
       	  idsesion = arrInfo[2];
          switch(error){
          	case "0":
			        alert(arrInfo[1]+"\nBienvenido al Área Privada");
			        //window.location="http://www.adimpo.es/login/index.asp"; 
			        reloc="http://www.adimpo.es/login/index.asp?sid="+idsesion;
			        window.location=reloc;
          	  break;
          	case "1":
          	  alert("Cliente Desconocido");
          	  break;
          	case "2":
          	  alert("Clave Incorrecta");
          	  break;
          	case "3":
          	  alert("Cliente Deshabilitado");
          	  break;
          	case "4":
          	  alert("Franquicia Desconocida"); 
          	  break;
          	case "5":
          	  alert("Cliente de Baja");
          	  break;
          	case "P":
          	  alert(arrInfo[1]+"\nBenvindo à sua Área Privada");
          		reloc="http://www.adimpo.pt/login/index.asp?sid="+idsesion;
			        window.location.href=reloc;     
			        break;     	
          	case "9":
          	  //solicitar franquicia
          	  //var wopen = window.open("Codigo_frq.html", "Login", "width=400, height=260, scrollbar=0, toolbar=0");
          	  //break;  
	            var urlfq = '../Codigo_frq.html';
              GB_showCenter(":: adimpo ::", urlfq, 360, 405);          	  
          	  break;     
          	case "88":
			        alert(arrInfo[1]+"\nBienvenido al Área Privada"+"\n\nEste sitio estará hoy fuera de servicio por motivos \ntécnicos desde las 21:00h hasta las 22:00h.");
			        //window.location="http://www.adimpo.es/login/index.asp"; 
			        reloc="http://www.adimpo.es/login/index.asp?sid="+idsesion;
			        window.location=reloc;
          	  break;          	  
          	case "99":
          	  alert("Nuestro sitio web está fuera de servicio por motivos técnicos.\nRogamos disculpen las molestias.");
          	  break;
          	default:
          	  alert("Error Desconocido");
          	  break;
          }	
          document.private_area.franquicia.value=-1;
          document.private_area.login_button.disabled = false;  
          document.private_area.login_button.style.visibility = "visible";
       }
       
      }
      catch(e){
      }       
       
    }
}

function Checkpoint01() {
	if (document.private_area.client1.value.length==10){
    if (http01) {      
    	 var customer1=document.private_area.client1.value;
	     var password1=document.private_area.password.value;
	     var franquicia1=document.private_area.franquicia.value;
       var murl = "Validar_cliente.asp?cus="+customer1+"&psw="+password1+"&frq="+franquicia1;
       document.getElementById("login_button").disabled = true;
       document.getElementById("login_button").style.visibility = "hidden";
       http01.open("GET", murl, true);
       http01.onreadystatechange = handleHttpResponse01;
       http01.send(null);      
    }
 }
 else
 	{
 		alert('Nuevo formato de Código de Cliente.\n\nEjemplo: 02/00056 pasa a ser 4300200056 (10 dígitos)');
 	}   
}

function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

var http01 = getHTTPObject(); // Creamos el objeto XMLHttpRequest

