﻿
function comprobarLogin(){
 
    this.url = "/default.aspx";
    this.errormail = "Check your mail";
    this.errorpass = "Check your password";
    this.errorUser = "Check your user";
    this.cestaCreada = false;
    this.mensajeCesta = "When login the content of your shopping basket will be cleared. \nDo you wish to continue?";
}

comprobarLogin.prototype.login = function(email,password)
{
      var strError = ""
      if (!isEml(email)) strError = this.errormail + '\n';
      if (password.length==0) strError += this.errorpass;
      if (strError != "")
      {
        alert(strError);
      }
      else
      {
         if (this.cestaCreada && (!confirm(this.mensajeCesta))) return false;
         document.getElementById("accion").value="loginAgencia";
         document.getElementById("parametros").value= "&email=" + email + "&password=" + password;
      }
}

comprobarLogin.prototype.loginLDAP = function(user, password) {
    var strError = ""
    if (user.length == 0) strError = this.errorUser + '\n';
    if (user != 'juniperuser') {
        if (password.length == 0) strError += this.errorpass;
    }
    if (strError != "") {
        alert(strError);
        return false;
    }
    else {
        if (this.cestaCreada && (!confirm(this.mensajeCesta))) return false;
        document.getElementById("accion").value = "loginAgencia";
        document.getElementById("parametros").value = "&user=" + user + "&password=" + password;
    }

}