var m_24 = "Por favor escribe tu nombre";
var m_25 = "Por favor escribe tu correo";
var m_26 = "Por favor escribe tu apellido";
var m_27 = "Complete your name";
var m_28 = "Complete your second name";
var m_29 = "Escribe tu contraseña";
var m_30 = "Complete your password";
var m_31 = "Confima tu contraseña";
var m_32 = "Confim your password";
var m_33 = "Tu contraseña no coincide con la verificación";
var m_34 = "Password doesn't match with your verification";
var m_35 = "Contraseña no válida.\nDebe tener de 8 a 10 caracteres";
var m_36 = "Password not valid.\nIt must have from 8 to 10 characters";
var m_37 = "No ha especificado un teléfono";
var m_38 = "Please write a telephone number";
var m_39 = "Escribe el código que aparece en la imagen";
var m_40 = "Please enter the code you see in the image";


//Guarda la referencia de info del colaborador
var info_actual=null;

//Muestra/oculta al colaborador seleccionado
function veInfoCol(id){
	var aux = "";

   if(info_actual==null)
      info_actual = id;

   //Checha si da click en el mismo para ocultar/mostrar (toggle)
   if(info_actual == id){
      var ac = document.getElementById(id).style.display;
      if(ac == "none"){
	document.getElementById(id).style.display = "";
	aux = id + "_1";
	//alert(aux);
	document.getElementById(id + '_1').className = "s-padd10azul";
	}
      else
	document.getElementById(id).style.display = "none";

   }else{
      document.getElementById(info_actual).style.display = "none";
      aux = info_actual + "_1";
      document.getElementById(aux).className = "s-padd10";
      document.getElementById(id).style.display = "";
	aux = id + "_1";
	//alert(aux);
	document.getElementById(aux).className = "s-padd10azul";
	location.href = "#" + id;
   }


   info_actual = id;
}

function chorizo_24(id){
	var aux = "";
	//alert(id + " id al entrar");
	//alert(info_actual + "info_actual al entrar");
	
   if(info_actual==null){
      info_actual = id;
      //alert(info_actual + " = " + id);
   }

   //Checha si da click en el mismo para ocultar/mostrar (toggle)
   if(info_actual == id){
      var ac = document.getElementById(id).style.display;

      if(ac == "none"){
	document.getElementById(id).style.display = "";
	}
      else{
	document.getElementById(id).style.display = "none";
	}
   }else{
      document.getElementById(info_actual).style.display = "none";
      aux = info_actual + "_1";
      document.getElementById(id).style.display = "";
   }
   info_actual = id;
}



var info_actual1=null;

//Muestra/oculta al colaborador seleccionado
function veInfoCol1(id){
   if(info_actual1==null)
      info_actual1 = id;

   //Checha si da click en el mismo para ocultar/mostrar (toggle)
   if(info_actual1 == id){
      var ac = document.getElementById(id).style.display;
      if(ac == "none")
	document.getElementById(id).style.display = "";
      else
	document.getElementById(id).style.display = "none";

   }else{
      document.getElementById(info_actual1).style.display = "none";
      document.getElementById(id).style.display = "";
	location.href = "#" + id;
   }


   info_actual1 = id;
}

	
function deshabilitadacheckEmailOnDB(v)
{
    //alert(v);
    valor = document.form.email.value;
    //alert(valor);

    koolajax.callback(php_checkEmailOnDB(valor),checkEmailOnDB_ondone);

}

function deshabilitadacheckEmailOnDB_ondone(result)
{
    //if(result)
	 alert('El email ya está en nuestra base de datos.');

     
}



//Check the email
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[^@.]$/i;
  if (strEmail.search(validRegExp) == -1)
  {
    return false;
  }
    return true;
}




function verificaDatos(lang){
  var l = parseInt(lang);
  var nombre   = document.form.nombre.value;
  var apellido = document.form.apellido.value;
  var passwd   = document.form.passwd.value;
  var passwd2  = document.form.passwd2.value;
  var tel      = document.form.telefono.value;
  var code     = document.form.code.value;
  var ok=true;  

     //Valida el nombre
     if(nombre==""){
          if (lang ==1)
            alert(m_24);
          else
             alert(m_27);
       ok=false;
     }
      else{
       //Valida el apellido
         if(apellido==""){
          if (lang ==1)
            alert(m_26);
          else
             alert(m_28);
          ok=false;
         }
           else{
             if(passwd == ""){
               if (lang ==1)
                  alert(m_29);
               else
                  alert(m_30);
               ok=false;
             }
             else{
              if((passwd.length < 8) || (passwd.length >10)){
                if (lang ==1)
                  alert(m_35);
                else
                  alert(m_36);
                ok=false;
                }
                else{
                  if(passwd2 == ""){
                      if (lang ==1)
                        alert(m_31);
                      else
                        alert(m_32);
                       ok=false;
                   }
                   else{
                      if(passwd != passwd2){
                        if (lang ==1)
                          alert(m_33);
                        else
                          alert(m_34);
                        ok=false;
                      }
 		      else{
                       if(tel == ""){
                         if (lang ==1)
                           alert(m_37);
                          else
                           alert(m_38);
                          ok=false;
                       	}
                          else{
                            if(code == ""){
                              if (lang ==1)
                              alert(m_39);
                             else
                             alert(m_40);
                            ok=false;
                       	  }
                      }

                   }	
                }
            }
        }
      }
}

   return ok;
}
