/*JAVASCRIPT QUE VIENE DE LA ANTERIOR PAGINA WEB*/
function inicio(){
  document.frmRegistro.cboespecialidad.selectedIndex=0;
  document.getElementById("otros").style.display='none';
}
function activar(){
  if(document.frmRegistro.cboespecialidad.value=="Otros"){
    document.getElementById("otros").style.display='';
    document.frmRegistro.txtotros.focus();
  }else{
    document.frmRegistro.txtotros.value="";
    document.getElementById("otros").style.display='none';
    document.frmRegistro.p_econ.focus();
  }
}
function numero(ev){
   tecla=String.fromCharCode(ev.keyCode);
   if(tecla>="0" && tecla<="9"){return true}else{ev.keyCode=0}
}
function CheckForm2(){
	if (document.frmRegistro.nombre.value==""){
		alert("Escribe tu nombre");
		document.frmRegistro.nombre.focus();
		return false;
	}
	if (document.frmRegistro.email.value==""){
		alert("Escribe tu email");
		document.frmRegistro.email.focus();
		return false;
	}
	if( frmRegistro.email.value.indexOf('@',0) <= 0  || frmRegistro.email.value.indexOf(';',0) != -1
     || frmRegistro.email.value.indexOf(' ',0) != -1 || frmRegistro.email.value.indexOf('/',0) != -1
     || frmRegistro.email.value.indexOf(';',0) != -1 || frmRegistro.email.value.indexOf('<',0) != -1
     || frmRegistro.email.value.indexOf('>',0) != -1 || frmRegistro.email.value.indexOf('*',0) != -1
     || frmRegistro.email.value.indexOf('|',0) != -1 || frmRegistro.email.value.indexOf('`',0) != -1
     || frmRegistro.email.value.indexOf('&',0) != -1 || frmRegistro.email.value.indexOf('$',0) != -1
     || frmRegistro.email.value.indexOf('!',0) != -1 || frmRegistro.email.value.indexOf('"',0) != -1
     || frmRegistro.email.value.indexOf(':',0) != -1 )
     {
    alert("Dirección de correo no valida. Por favor, introduce bien la direccion");
    frmRegistro.email.focus();
    return (false);
    }
	if (document.frmRegistro.cboespecialidad.selectedIndex==0){
	    alert("Selecciona tu Especialidad");
		document.frmRegistro.cboespecialidad.focus();
		return false;
	}
	if (document.frmRegistro.cboespecialidad.value=="Otros" && document.frmRegistro.txtotros.value==""){
	    alert("Especifica tu Especialidad");
		document.frmRegistro.txtotros.focus();
		return false;
	}
	if (document.frmRegistro.p_econ.value==""){
	    alert("Escribe tu Pretención Económica");
		document.frmRegistro.p_econ.focus();
		return false;
	}
	if (document.frmRegistro.file.value==""){
		alert("Escoge una imagen");
		document.frmRegistro.file.focus();
		return false;
	}
	return true
}

function validar(formulario) {
   if (formulario.nombre.value.length < 1) {
    alert("Por Favor Ingrese su Nombre o su Razón Social.");
    formulario.nombre.focus();
    return (false);
  }
  if (formulario.telefono.value.length < 6) {
    alert("El Número de 'Teléfono/FAX' NO es válido, mínimo 6 Numeros, Sólo Ingrese Números.");
    formulario.telefono.focus();
    return (false);
  }
  var checkOK = "0123456789().- +";
  var checkStr = formulario.telefono.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i);
    for (j = 0; j < checkOK.length; j++){
      if (ch == checkOK.charAt(j)){break;}
      if(j == checkOK.length) {
        allValid = false;
        break;
      }
      allNum += ch;
    }
  }
  if (!allValid) {
    alert("El campo \"Teléfono / Fax\" solo acepta Números.");
    formulario.telefono.focus();
    return (false);
  }
  if (formulario.email.value.length < 1) {
    alert("Por Favor Ingrese su Email.");
    formulario.email.focus();
    return (false);
  }
  var pos1, pos2, bOk = true;
  var sDir = formulario.email.value;
  if (sDir == ""){
   alert("Por favor ingrese su dirección de correo");
   formulario.email.focus();
   return false;
  }
  pos1 = sDir.indexOf('@', 0);
  pos2 = sDir.indexOf('.', 0);
  bOk = bOk && (pos1 > 0);
  bOk = bOk && (pos2 != -1);
  bOk = bOk && (pos1 < pos2 - 1);
  bOk = bOk && (pos2 < sDir.length - 1);
  if (!bOk){
   alert("Su Email es Incorrecto");
   formulario.email.focus();
   return false;
  }
  if (formulario.comentario.value.length < 4){
    alert("Por Favor Ingrese un Comentario.");
    formulario.comentario.focus();
    return (false);
  }
}



