function getBrowser(){
  return navigator.appName + navigator.appVersion;
}

function NumericField(inVal){
  if(inVal.search(/\D/)!=-1){
     return false;
  }else{
     return true;
  }
}

function showHideDiv(divID){
  var theDiv = document.getElementById(divID);
  if(theDiv){
     if((theDiv.style.display=="none") || (theDiv.style.display=="") || (theDiv.style.display=="undefined")){
        theDiv.style.display="inline";
     }else{
        theDiv.style.display="none";
     }
  }
}

function findOffsetLeft(element){
  return findOffset(element, "offsetLeft");
}

function findOffsetTop(element){
  return findOffset(element, "offsetTop");
}

function findOffset(element, type){
  var os = 0;
  while(element){
      os += element[type];
      element = element.offsetParent;
  }
  return os;
}

function fSubmit(idForm){
  if(isPressed){
     alert(alertWaitPageSubmit);
     return false;
  }else{
     isPressed = true;
  }
  document.getElementById(idForm).submit();
  return true;
}

function fSubmitAction(idForm, inAction){
  if(isPressed){
     alert(alertWaitPageSubmit);
     return false;
  }else{
     isPressed = true;
  }
  document.getElementById(idForm).action=inAction;
  document.getElementById(idForm).submit();
  return true;
}

function fSubmitActionTarget(idForm, inAction, inTarget){
  document.getElementById(idForm).action=inAction;
  document.getElementById(idForm).target=inTarget;
  document.getElementById(idForm).submit();
  return true;
}
theFunc="";
function submitFormAjax(inUrl, outFunc, idForm, formTarget){
  var theForm = $(idForm);
  var params = Form.serialize($(idForm));
  theFunc = outFunc;
  var ajaxRequest = new Ajax.Request(inUrl,{Method: 'post', parameters: params, onComplete: AjaxResponse});
}
function AjaxResponse(originalRequest){
  if(theFunc==""){
     alert(originalRequest.responseText);
  }
}
function stringToArray(stringa, delim){
  var arrOut = stringa.split(delim);
  return arrOut;
}
function openPop(inURL,inName,inWidth,inHeight){
  re = /&/gi;
  re2 = /\?/gi;
  var theURL = inURL.replace(re,'%26');
  theURL = theURL.replace(re2,'%3F');
  var params = "width="+inWidth+",height="+inHeight+",left=1,top=1,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,directories=no,location=no,status=no";
  window.open(theURL,inName,params);
}
function openPopSubmitForm(inURL,inName,inWidth,inHeight,idForm){
  openPop(inURL,inName,inWidth,inHeight);
  document.getElementById(idForm).target=inName;
  document.getElementById(idForm).submit();
}
function setQueryString(frm){
  var queryString = "";
  var numberElements =  frm.elements.length;
  for(var i = 0; i < numberElements; i++){
      if(i < numberElements-1){
         queryString += frm.elements[i].name+"="+encodeURIComponent(frm.elements[i].value)+"&";
      }else{
         queryString += frm.elements[i].name+"="+encodeURIComponent(frm.elements[i].value);
      }
  }
  return queryString;
}
function chk_options(ident, valor){
  var v = $(ident).options;
  for(i=0; i<v.length; i++){
      if(v[i].value != valor){
         v[i].selected = false;
      }else{
         v[i].selected = true;
      }
  }
}
//login
var regExpMail  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var alertNoEmail = " - e-mail\n";
var alertNoPass = " - contraseņa\n";

//popAlert
function showPopAlert(redir_url, redir_params){
  var all_params = "";
  var array_params = redir_params.split('&');
  for(var i=0; i<=array_params.length-1; i++){
      var param = array_params[i];
      all_params+="&"+param;
  }
  new Ajax.Updater('popAlert', 'plantilla_alert.jsp?redir_url='+redir_url+all_params, {asynchronous:true});
  var elTapun = $('elTapun');
  elTapun.style.width=document.body.offsetWidth;
  elTapun.style.height=document.body.scrollHeight;
  elTapun.style.display='inline';
  Element.show('popAlert');
}

//areapersonal - fPswdLostSubmit
var alertPswdLostEmail = " - E-mail\n";

function fPswdLostSubmit(idForm){
  var alertText = "";
  var comma = ",";
  //Initialize required fields classes
  if((typeof(errorId) != "undefined") && (errorId != "")){
      aErrorId = errorId.split(",");
      for(var i=0; i<=aErrorId.length-1; i++){
         if(aErrorId[i] != ""){
            if($(aErrorId[i]).className=="FieldAlert"){
               $(aErrorId[i]).className="FieldRequired";
            }else if($(aErrorId[i]).className=="FieldAlertInput"){
               $(aErrorId[i]).className="FieldRequiredInput";
            }
         }
     }
  }
  errorId = "";
  if($("fPswdLostMail")){
     var campo = $F("fPswdLostMail");
     if(trim(campo)==""){
        alertText += alertNoRegEmail;
        if($("fPswdLostMailLabel")){
           errorId = errorId + "fPswdLostMailLabel" + comma;
        }else{
           errorId = errorId + "fPswdLostMail" + comma;
        }
     }else if(regExpMail.test(campo)==false){
        alertText += alertNoRegEmail;
        if($("fPswdLostMailLabel")){
           errorId = errorId + "fPswdLostMailLabel" + comma;
        }else{
           errorId = errorId + "fPswdLostMail" + comma;
        }
     }
  }
  if(alertText!=""){
     alert("Por favor revisa:\n\n" + alertText);
     if((typeof(errorId) != "undefined") && (errorId != "")){
        errorId = errorId.substr(0, errorId.length-1);
        aErrorId = errorId.split(",");
        for(var j=0; j<=aErrorId.length-1; j++){
            if(aErrorId[j]!=""){
               if($(aErrorId[j]).type=="text" || $(aErrorId[j]).type=="password"){
                  $(aErrorId[j]).className="FieldAlertInput";
               }
               if($(aErrorId[j]).className=="FieldRequired"){
                  $(aErrorId[j]).className="FieldAlert";
               }
            }
        }
     }
     return false;
  }else{
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     $(idForm).submit();
     return true;
  }
}
//areapersonal - MisDocumentos
function setListaCarpetasNav(){
  var idx = document.getElementById("listaCarpetasNav").selectedIndex;
  var val = document.getElementById("listaCarpetasNav").options[idx].value;
  var txt = document.getElementById("listaCarpetasNav").options[idx].text;
  document.getElementById("idxListaCarpetasNav").value=idx;
  document.getElementById("valListaCarpetasNav").value=val;
  document.getElementById("txtListaCarpetasNav").value=txt;
  if(val==0){
     alert("Selecciona una carpeta");
     return false;
  }else if(val=="crearcarpeta"){
        fSubmitAction('fMisDocumentosNav', 'ctl_servlet?_f=30030');
  }else{
        fSubmitAction('fMisDocumentosNav', 'ctl_servlet?_f=30012');
  }
}
function setListaCarpetas(inID){
  var idx = document.getElementById("listaCarpetas_"+inID).selectedIndex;
  var val = document.getElementById("listaCarpetas_"+inID).options[idx].value;
  var txt = document.getElementById("listaCarpetas_"+inID).options[idx].text;
  if(val==0){
     alert("Selecciona una carpeta");
     return false;
  }else if(val=="crearcarpeta"){
        fSubmitAction('fMisDocumentos', 'ctl_servlet?_f=30030&documentoid='+inID);
  }else{
        document.getElementById("idDocumentoSelected").value=inID;
        document.getElementById("idCarpetaSelected").value=val;
        fSubmitAction('fMisDocumentos', 'ctl_servlet?_f=30038');
  }
}
function populateListaCarpetas(){
  var listaCarpetasNav = document.getElementById("listaCarpetasNav");
  var oForm = document.getElementById("fMisDocumentos");
  for(var i=0;i<oForm.length;i++){
      var fElement = oForm.elements[i];
      if(fElement.type=="select-one"){
         var fElementID = fElement.id;
         if(fElementID.substring(0,13)=="listaCarpetas"){
            var oSelect = document.getElementById(fElementID);
            for(var j=0;j<listaCarpetasNav.options.length;j++){
                oSelect.options[j] = new Option(listaCarpetasNav.options[j].text, listaCarpetasNav.options[j].value, false, false);
            }
         }
      }
  }
}
function fMisDocumentosEliminar(){
  var oneChecked = false;
  var listChecked = "";
  var oForm = document.getElementById("fMisDocumentos");
  for(var i=0;i<oForm.length;i++){
      var fElement = oForm.elements[i];
      if(fElement.type=="checkbox"){
         var fElementID = fElement.id;
         if(fElementID.substring(0,11)=="ckDocumento"){
            var oCheckbox = document.getElementById(fElementID);
            if(oCheckbox.checked){
               oneChecked=true;
               listChecked+=oCheckbox.value+",";
            }
         }
      }
  }
  listChecked=listChecked.substring(0,listChecked.length-1);
  if(oneChecked){
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     oForm.submit();
     return true;
  }else{
     alert("Ningun elemento seleccionado");
     return false;
  }
}
//areapersonal - Busquedas Programadas
function setListaFrecuencia(){
  var idx = document.getElementById("listaFrecuencia").selectedIndex;
  var val = document.getElementById("listaFrecuencia").options[idx].value;
  var txt = document.getElementById("listaFrecuencia").options[idx].text;
  document.getElementById("idxListaFrecuencia").value=idx;
  document.getElementById("valListaFrecuencia").value=val;
  document.getElementById("txtListaFrecuencia").value=txt;

  fSubmitAction('fBusqProgNav', 'ctl_servlet?_f=30016');
}
function fBusqProgEliminar(){
  var oneChecked = false;
  var listChecked = "";
  var oForm = document.getElementById("fBusqProg");
  for(var i=0;i<oForm.length;i++){
      var fElement = oForm.elements[i];
      if(fElement.type=="checkbox"){
         var fElementID = fElement.id;
         if(fElementID.substring(0,11)=="ckDocumento"){
            var oCheckbox = document.getElementById(fElementID);
            if(oCheckbox.checked){
               oneChecked=true;
               listChecked+=oCheckbox.value+",";
            }
         }
      }
  }
  listChecked=listChecked.substring(0,listChecked.length-1);
  if(oneChecked){
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     oForm.action="ctl_servlet?_f=30046";
     oForm.submit();
     return true;
  }else{
     alert("Ningun elemento seleccionado");
     return false;
  }
}
function fBusqProgEdit(inID){
  document.getElementById("idDocumentoSelected").value=inID;
  fSubmitAction('fBusqProg', 'ctl_servlet?_f=30042');
}
function setListaFrecuenciaNoSub(){
  var idx = document.getElementById("listaFrecuencia").selectedIndex;
  var val = document.getElementById("listaFrecuencia").options[idx].value;
  var txt = document.getElementById("listaFrecuencia").options[idx].text;
  document.getElementById("idxListaFrecuencia").value=idx;
  document.getElementById("valListaFrecuencia").value=val;
  document.getElementById("txtListaFrecuencia").value=txt;
}
function setListaRevistas(){
  var idx = document.getElementById("listaRevistas").selectedIndex;
  var val = document.getElementById("listaRevistas").options[idx].value;
  var txt = document.getElementById("listaRevistas").options[idx].text;
  document.getElementById("idxListaRevistas").value=idx;
  document.getElementById("valListaRevistas").value=val;
  document.getElementById("txtListaRevistas").value=txt;
  document.getElementById("publicacion").value=val;
}
function setListaCampoRevista(){
  var idx = document.getElementById("listaCampoRevista").selectedIndex;
  var val = document.getElementById("listaCampoRevista").options[idx].value;
  var txt = document.getElementById("listaCampoRevista").options[idx].text;
  document.getElementById("idxListaCampoRevista").value=idx;
  document.getElementById("valListaCampoRevista").value=val;
  document.getElementById("txtListaCampoRevista").value=txt;
  document.getElementById("searchField").value=val;
}

var alertNoTermino = " - Termino a buscar\n";
var alertNoFrecuencia = " - Frecuencia\n";
var alertNoRevista = " - Revista\n";
var alertNoCampoRevista = " - Campo\n";
var alertNoEmail = " - E-mail\n";

function fBusqProgSubmit(idForm){
  var alertText = "";
  var comma = ",";
  //Initialize required fields classes
  if((typeof(errorId) != "undefined") && (errorId != "")){
      aErrorId = errorId.split(",");
      for(var i=0; i<=aErrorId.length-1; i++){
         if(aErrorId[i] != ""){
            if(document.getElementById(aErrorId[i]).className=="FieldAlert"){
               document.getElementById(aErrorId[i]).className="FieldRequired";
            }else if(document.getElementById(aErrorId[i]).className=="FieldAlertInput"){
               document.getElementById(aErrorId[i]).className="FieldRequiredInput";
            }
         }
     }
  }
  errorId = "";
  if(document.getElementById("searchText") && document.getElementById("searchText").disabled==false){
     var campo = document.getElementById("searchText").value;
     if(trim(campo)==""){
        alertText += alertNoTermino;
        if(document.getElementById("searchTextLabel")){
           errorId = errorId + "searchTextLabel" + comma;
        }else{
           errorId = errorId + "searchText" + comma;
        }
     }
  }
  if(document.getElementById("listaFrecuencia") && document.getElementById("listaFrecuencia").disabled==false){
     var campo = document.getElementById("valListaFrecuencia").value;
     if(trim(campo)==""){
        alertText += alertNoFrecuencia;
        if(document.getElementById("listaFrecuenciaLabel")){
           errorId = errorId + "listaFrecuenciaLabel" + comma;
        }else{
           errorId = errorId + "listaFrecuencia" + comma;
        }
     }else if(trim(campo)=="0"){
        alertText += alertNoFrecuencia;
        if(document.getElementById("listaFrecuenciaLabel")){
           errorId = errorId + "listaFrecuenciaLabel" + comma;
        }else{
           errorId = errorId + "listaFrecuencia" + comma;
        }
     }
  }
  if(document.getElementById("listaRevistas") && document.getElementById("listaRevistas").disabled==false){
     var campo = document.getElementById("valListaRevistas").value;
     if(trim(campo)==""){
        alertText += alertNoRevista;
        if(document.getElementById("listaRevistasLabel")){
           errorId = errorId + "listaRevistasLabel" + comma;
        }else{
           errorId = errorId + "listaRevistas" + comma;
        }
     }
  }
  if(document.getElementById("listaCampoRevista") && document.getElementById("listaCampoRevista").disabled==false){
     var campo = document.getElementById("valListaCampoRevista").value;
     if(trim(campo)==""){
        alertText += alertNoCampoRevista;
        if(document.getElementById("listaCampoRevistaLabel")){
           errorId = errorId + "listaCampoRevistaLabel" + comma;
        }else{
           errorId = errorId + "listaCampoRevista" + comma;
        }
     }
  }
  if(document.getElementById("busqMail") && document.getElementById("busqMail").disabled==false){
     var campo = document.getElementById("busqMail").value;
     if(trim(campo)==""){
        alertText += alertNoEmail;
        if(document.getElementById("busqMailLabel")){
           errorId = errorId + "busqMailLabel" + comma;
        }else{
           errorId = errorId + "busqMail" + comma;
        }
     }else if(regExpMail.test(campo)==false){
        alertText += alertNoEmail;
        if(document.getElementById("busqMailLabel")){
           errorId = errorId + "busqMailLabel" + comma;
        }else{
           errorId = errorId + "busqMail" + comma;
        }
     }
  }
  if(alertText!=""){
     alert("Por favor revisa:\n\n" + alertText);
     if((typeof(errorId) != "undefined") && (errorId != "")){
        errorId = errorId.substr(0, errorId.length-1);
        aErrorId = errorId.split(",");
        for(var j=0; j<=aErrorId.length-1; j++){
            if(aErrorId[j]!=""){
               if(document.getElementById(aErrorId[j]).type=="text" || document.getElementById(aErrorId[j]).type=="password"){
                  document.getElementById(aErrorId[j]).className="FieldAlertInput";
               }
               if(document.getElementById(aErrorId[j]).className=="FieldRequired"){
                  document.getElementById(aErrorId[j]).className="FieldAlert";
               }
            }
        }
     }
     return false;
  }else{
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     document.getElementById(idForm).submit();
     return true;
  }
}

//areapersonal Alertas Personalizadas
function fAlertasRevistasSubmit(idForm){
  var alertText = "";
  var comma = ",";
  //Initialize required fields classes
  if((typeof(errorId) != "undefined") && (errorId != "")){
      aErrorId = errorId.split(",");
      for(var i=0; i<=aErrorId.length-1; i++){
         if(aErrorId[i] != ""){
            if(document.getElementById(aErrorId[i]).className=="FieldAlert"){
               document.getElementById(aErrorId[i]).className="FieldRequired";
               document.getElementById(aErrorId[i]).style.borderColor='#809DB9';
            }
         }
     }
  }
  errorId = "";
  if(document.getElementById("EMAIL_REVISTAS")){
     var campo = document.getElementById("EMAIL_REVISTAS").value;
     if(trim(campo)==""){
        alertText += alertNoEmail;
        errorId = errorId + "EMAIL_REVISTAS" + comma;
     }else if(regExpMail.test(campo)==false){
        alertText += alertNoEmail;
        errorId = errorId + "EMAIL_REVISTAS" + comma;
     }
  }
  if(alertText!=""){
     alert("Por favor revisa:\n\n" + alertText);
     if((typeof(errorId) != "undefined") && (errorId != "")){
        errorId = errorId.substr(0, errorId.length-1);
        aErrorId = errorId.split(",");
        for(var j=0; j<=aErrorId.length-1; j++){
            if(aErrorId[j]!=""){
               document.getElementById(aErrorId[j]).style.borderColor='red';
               if(document.getElementById(aErrorId[j]).className=="FieldRequired"){
                  document.getElementById(aErrorId[j]).className="FieldAlert";
               }
            }
        }
     }
     return false;
  }else{
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     document.getElementById(idForm).submit();
     return true;
  }
}
function fAlertasLibrosSubmit(idForm){
  var alertText = "";
  var comma = ",";
  //Initialize required fields classes
  if((typeof(errorId) != "undefined") && (errorId != "")){
      aErrorId = errorId.split(",");
      for(var i=0; i<=aErrorId.length-1; i++){
         if(aErrorId[i] != ""){
            if(document.getElementById(aErrorId[i]).className=="FieldAlert"){
               document.getElementById(aErrorId[i]).className="FieldRequired";
               document.getElementById(aErrorId[i]).style.borderColor='#809DB9';
            }
         }
     }
  }
  errorId = "";
  if(document.getElementById("EMAIL_LIBROS")){
     var campo = document.getElementById("EMAIL_LIBROS").value;
     if(trim(campo)==""){
        alertText += alertNoEmail;
        errorId = errorId + "EMAIL_LIBROS" + comma;
     }else if(regExpMail.test(campo)==false){
        alertText += alertNoEmail;
        errorId = errorId + "EMAIL_LIBROS" + comma;
     }
  }
  var ckAlertasLibros = document.getElementById('ckAlertasLibros');
  var ACTIVA_LIBROS = document.getElementById('ACTIVA_LIBROS');
  if(ckAlertasLibros.checked){
     ACTIVA_LIBROS.value="1";
  }else{
     ACTIVA_LIBROS.value="0";
  }
  if(alertText!=""){
     alert("Por favor revisa:\n\n" + alertText);
     if((typeof(errorId) != "undefined") && (errorId != "")){
        errorId = errorId.substr(0, errorId.length-1);
        aErrorId = errorId.split(",");
        for(var j=0; j<=aErrorId.length-1; j++){
            if(aErrorId[j]!=""){
               document.getElementById(aErrorId[j]).style.borderColor='red';
               if(document.getElementById(aErrorId[j]).className=="FieldRequired"){
                  document.getElementById(aErrorId[j]).className="FieldAlert";
               }
            }
        }
     }
     return false;
  }else{
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     document.getElementById(idForm).submit();
     return true;
  }
}
function fAlertasJanoSubmit(idForm){
  var alertText = "";
  var comma = ",";
  //Initialize required fields classes
  if((typeof(errorId) != "undefined") && (errorId != "")){
      aErrorId = errorId.split(",");
      for(var i=0; i<=aErrorId.length-1; i++){
         if(aErrorId[i] != ""){
            if(document.getElementById(aErrorId[i]).className=="FieldAlert"){
               document.getElementById(aErrorId[i]).className="FieldRequired";
               document.getElementById(aErrorId[i]).style.borderColor='#809DB9';
            }
         }
     }
  }
  errorId = "";
  if(document.getElementById("EMAIL_JANO")){
     var campo = document.getElementById("EMAIL_JANO").value;
     if(trim(campo)==""){
        alertText += alertNoEmail;
        errorId = errorId + "EMAIL_JANO" + comma;
     }else if(regExpMail.test(campo)==false){
        alertText += alertNoEmail;
        errorId = errorId + "EMAIL_JANO" + comma;
     }
  }
  var ckAlertasJano = document.getElementById('ckAlertasJano');
  var ACTIVA_JANO = document.getElementById('ACTIVA_JANO');
  if(ckAlertasJano.checked){
     ACTIVA_JANO.value="1";
  }else{
     ACTIVA_JANO.value="0";
  }
  if(alertText!=""){
     alert("Por favor revisa:\n\n" + alertText);
     if((typeof(errorId) != "undefined") && (errorId != "")){
        errorId = errorId.substr(0, errorId.length-1);
        aErrorId = errorId.split(",");
        for(var j=0; j<=aErrorId.length-1; j++){
            if(aErrorId[j]!=""){
               document.getElementById(aErrorId[j]).style.borderColor='red';
               if(document.getElementById(aErrorId[j]).className=="FieldRequired"){
                  document.getElementById(aErrorId[j]).className="FieldAlert";
               }
            }
        }
     }
     return false;
  }else{
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     document.getElementById(idForm).submit();
     return true;
  }
}
//fPwdChangeSubmit
var alertNoRegPasswordAntigua = " - Contraseņa antigua\n";
var alertNoRegPasswordNueva = " - Contraseņa nueva\n";

function fPwdChangeSubmit(idForm){
  var alertText = "";
  var comma = ",";
  //Initialize required fields classes
  if((typeof(errorId) != "undefined") && (errorId != "")){
      aErrorId = errorId.split(",");
      for(var i=0; i<=aErrorId.length-1; i++){
         if(aErrorId[i] != ""){
            if(document.getElementById(aErrorId[i]).className=="FieldAlert"){
               document.getElementById(aErrorId[i]).className="FieldRequired";
            }else if(document.getElementById(aErrorId[i]).className=="FieldAlertInput"){
               document.getElementById(aErrorId[i]).className="FieldRequiredInput";
            }
         }
      }
  }
  errorId = "";
  if(document.getElementById("regPasswordOld") && document.getElementById("regPasswordOld").disabled==false){
     var campo = document.getElementById("regPasswordOld").value;
     if(trim(campo)==""){
        alertText += alertNoRegPasswordAntigua;
        if(document.getElementById("regPasswordOldLabel")){
           errorId = errorId + "regPasswordOldLabel" + comma;
        }else{
           errorId = errorId + "regPasswordOld" + comma;
        }
     }
  }
  if(document.getElementById("regPassword1") && document.getElementById("regPassword2") && document.getElementById("regPassword1").disabled==false  && document.getElementById("regPassword2").disabled==false){
     var user_pswd = document.getElementById("regPassword1").value;
     var user_pswd2 = document.getElementById("regPassword2").value;
     if(trim(user_pswd)==""){
        alertText += alertNoRegPasswordNueva;
        if(document.getElementById("regPassword1Label")){
           errorId = errorId + "regPassword1Label" + comma;
        }else{
           errorId = errorId + "regPassword1" + comma;
        }
     }else if(trim(user_pswd2)==""){
        alertText += alertNoRegPasswordNueva;
        if(document.getElementById("regPassword2Label")){
           errorId = errorId + "regPassword2Label" + comma;
        }else{
           errorId = errorId + "regPassword2" + comma;
        }
     }else if((trim(user_pswd)) !=(trim(user_pswd2))){
        alertText += alertNoRegPasswordNueva;
        if(document.getElementById("regPassword1Label")){
           errorId = errorId + "regPassword1Label" + comma;
        }else{
           errorId = errorId + "regPassword1" + comma;
        }
        if(document.getElementById("regPassword2Label")){
           errorId = errorId + "regPassword2Label" + comma;
        }else{
           errorId = errorId + "regPassword2" + comma;
        }
     }
  }
  if(alertText!=""){
     alert("Por favor revisa:\n\n" + alertText);
     if((typeof(errorId) != "undefined") && (errorId != "")){
        errorId = errorId.substr(0, errorId.length-1);
        aErrorId = errorId.split(",");
        for(var j=0; j<=aErrorId.length-1; j++){
            if(aErrorId[j]!=""){
               if(document.getElementById(aErrorId[j]).type=="text" || document.getElementById(aErrorId[j]).type=="password"){
                  document.getElementById(aErrorId[j]).className="FieldAlertInput";
               }
               if(document.getElementById(aErrorId[j]).className=="FieldRequired"){
                  document.getElementById(aErrorId[j]).className="FieldAlert";
               }
            }
        }
     }
     return false;
  }else{
     if(isPressed){
        alert(alertWaitPageSubmit);
        return false;
     }else{
        isPressed = true;
     }
     document.getElementById(idForm).submit();
     return true;
  }
}