<!--

bGoOn=new Image(); bGoOn.src="img/b_go_on.gif";
bApOver=new Image(); bApOver.src="img/ap_over.gif";

function abrirVentana(direccion,destino,opcs) {
  window.open(direccion,destino,opcs);
}

function redimPagina() {
  if (document.all) {
    if (window.XMLHttpRequest) {
      window.resizeTo(document.Foto.width+10,document.Foto.height+70);
    }
    else { 
      window.resizeTo(document.Foto.width+10,document.Foto.height+30);
    }
  } 
  else {
    window.resizeTo(document.Foto.width+window.outerWidth-window.innerWidth,document.Foto.height+window.outerHeight-window.innerHeight);
  }
  window.moveTo((screen.width-document.Foto.width)/2,(screen.height-document.Foto.height)/2);
  return true;
}    

function cambiaTamanio(src,t,l)
{
  src.style.fontSize=t;
  src.style.lineHeight=l;
}

function fecha(fecha)
{
  var f,fstr;
  if (fecha=="") { 
    f= new Date();
  } 
  else {
    fstr=fecha.substring(3,5)+"/"+fecha.substring(0,2)+"/"+fecha.substring(6,10);
    f= new Date(fstr);
  }
  if (document.all) {
    anio=f.getYear()
  }
  else {
    anio=f.getYear()+1900;
  }    
  var diasemana=new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
  var mes=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
  document.write(diasemana[f.getDay()]+", "+f.getDate()+" de "+mes[f.getMonth()]+" de "+anio); 
}

function buscar()
{
  if (document.all.buscador.value=="") {
    document.all.buscador.focus();
  } 
  else {
  //  if (document.all.donde.i.checked) {
  //    document.location.href="buscador.asp?p="+document.all.buscador.value;
  //  } 
  //  else {
      window.open("http://es.search.yahoo.com/search?p="+document.all.buscador.value,"_blank","");
  //  }
  }
}

function buscarEmpresa()
{
  if (document.all.cb.value=="") {
    document.all.cb.focus();
  } 
  else {
    document.location.search="?sec=2&subsec=2&cb="+document.all.cb.value;    
  }
}

function ct()
{
  if (document.all) {
    tecla=event.keyCode;
  }
  else {
    tecla=e.keyCode;
  }
  if (tecla==13) buscar();
}

function ctEmpresa()
{
  if (document.all) {
    tecla=event.keyCode;
  }
  else {
    tecla=e.keyCode;
  }
  if (tecla==13) buscarEmpresa();
}

function validarContact() {
  var error="";
  if ((document.Contact.DeMail.value=="") || (document.Contact.De.value=="") || (document.Contact.Asunto.value=="") || (document.Contact.Mensaje.value=="")) {
   error+='Por favor, introduzca todos los datos solicitados.\n';
   if (document.Contact.De.value=="") document.Contact.De.focus();
   else if (document.Contact.DeMail.value=="") document.Contact.DeMail.focus();
   else if (document.Contact.Asunto.value=="") document.Contact.Asunto.focus();
   else if (document.Contact.Mensaje.value=="") document.Contact.Mensaje.focus();
  }
  else {
   if (!(validaremail(document.Contact.DeMail.value))) {
     error+='dirección de e-mail inválida.\n';
     document.Contact.DeMail.focus();
   }
  }
  if (error!="") alert('Error:\n'+error);
  document.MM_returnValue = (error=="");
}

function validaremail(cadena)
{
  var largo=cadena.length;
  
  if (largo==0) return false;

  var estado=0;
  var caracter="";
  
  for (i=0;i<largo;i++) {
    caracter=cadena.charAt(i);
    if (((caracter>="a") && (caracter<="z")) || ((caracter>="A") && (caracter<="Z")) || ((caracter>="0") && (caracter<="9")))
      caracter="A";
    if ((caracter=="-") || (caracter=="_")) caracter="-";
    switch (caracter) {
      case "A":
        switch (estado) {
          case 0:
            estado=1;
            break;
          case 1:
            estado=1;
            break;
          case 2:
            estado=3;
            break;
          case 3:
            estado=3; 
            break;
          case 4:
            estado=5; 
            break;
          case 5:
            estado=6; 
            break;
          case 6:
            estado=7; 
            break;
          case 7:
            return false; 
            break;
        }
        break;
      case "-":
        switch (estado) {  
          case 1:
            estado=1;
            break;
          case 3:
            estado=3;
            break;
          default:
            return false;
        }
        break;
      case ".":
        switch (estado) {
          case 1:
            estado=0;
            break;
          case 3:
            estado=4;
            break;
          default:
            return false;
        }
        break;
      case "@":
        switch (estado) {
          case 1:
            estado=2;
            break;
          default:
            return false;
        }
        break;
      default:
        return false;
    }
  }
  if ((estado==6) || (estado==7)) return true;
  else return false;
}

function validarFSE() {
  var error="";
  if ((document.FSE.Nombre.value=="") || (document.FSE.Empresa.value=="") || (document.FSE.Direccion.value=="") || (document.FSE.Localidad.value=="") || (document.FSE.Telefono.value=="")) {
   error+='Por favor, introduzca todos los datos marcados con (*).\n';
   if (document.FSE.Nombre.value=="") document.FSE.Nombre.focus();
   else if (document.FSE.Empresa.value=="") document.FSE.Empresa.focus();
   else if (document.FSE.Direccion.value=="") document.FSE.Direccion.focus();
   else if (document.FSE.Localidad.value=="") document.FSE.Localidad.focus();
   else if (document.FSE.Telefono.value=="") document.FSE.Telefono.focus();
  }
  if (error!="") alert('Error:\n'+error);
  document.MM_returnValue = (error=="");
}

function ValidarVotos() {
  var error="";
  if ((document.Votar.Email.value=="") || (document.Votar.Pass.value=="")) {
   error+='Es necesario ser usuario registrado, por favor, identifíquese.\n';
   if (document.Votar.Email.value=="") document.Votar.Email.focus();
   else document.Votar.Pass.focus();
  }
  else {
   if ((document.Votar.Voto1.value=="0") || (document.Votar.Voto2.value=="0") || (document.Votar.Voto3.value=="0")) {
    error+='Por favor, seleccione sus tres imágenes favoritas.\n';
    if (document.Votar.Voto1.value=="0") document.Votar.Voto1.focus();
    else if (document.Votar.Voto2.value=="0") document.Votar.Voto2.focus();
         else document.Votar.Voto3.focus();
   }
   else {
    if (document.Votar.Voto1.value==document.Votar.Voto2.value) {
     error+='Atención, ha seleccionado dos veces la misma imagen, por favor, seleccione tres imágenes distintas.\n';
     document.Votar.Voto2.focus();
    }
    else {
     if (document.Votar.Voto1.value==document.Votar.Voto3.value) {
      error+='Atención, ha seleccionado dos veces la misma imagen, por favor, seleccione tres imágenes distintas.\n';
      document.Votar.Voto3.focus();
     }
     else {
      if (document.Votar.Voto2.value==document.Votar.Voto3.value) {
       error+='Atención, ha seleccionado dos veces la misma imagen, por favor, seleccione tres imágenes distintas.\n';
       document.Votar.Voto3.focus();
      }
     }
    }
   }
  }
  if (error!="") alert(error);
  document.MM_returnValue = (error=="");
}

function validarRegistro()
{
  var error="";
  if (document.Registro.Nombre.value=="") {
   error+='Por favor, introduzca su nombre.\n';
   document.Registro.Nombre.focus();
  }
  else {
   if (document.Registro.Email.value=="") {
    error+='Por favor, introduzca una dirección de email válida.\n';
    document.Registro.Email.focus();
   }
   else {
    if ((!(document.Registro.Sexo.H.checked)) && (!(document.Registro.Sexo.M.checked))) {
     error+='Por favor, indique su sexo.\n';
    }
    else {
     if (document.Registro.FechaNacimiento.value=="") {
      error+='Por favor, indique su fecha de nacimiento completa.\n';
      document.Registro.FechaNacimiento.focus();
     }
     else {
      if (document.Registro.Localidad.value=="") {
       error+='Por favor, introduzca su localidad.\n';
       document.Registro.Localidad.focus();
      }
      else {
       if (document.Registro.Ocupacion.value=="") {
        error+='Por favor, introduzca su ocupación.\n';
        document.Registro.Ocupacion.focus();
       }
      }
     }
    }
   }
  } 
  if (error!="") alert('Error:\n'+error);
  document.MM_returnValue = (error=="");
}

function validarParticipar()
{
  var error="";
  if (document.Participar.De.value=="") {
   error+='Por favor, introduzca su nombre.\n';
   document.Participar.De.focus();
  }
  else {
   if (document.Participar.Empresa.value=="") {
    error+='Por favor, introduzca el nombre de su empresa.\n';
    document.Participar.Empresa.focus();
   }
   else {
    if (document.Participar.DeMail.value=="") {
     error+='Por favor, introduzca su dirección de correo electrónico.\n';
     document.Participar.DeMail.focus();
    }
    else {
     if (document.Participar.Telefono.value=="") {
      error+='Por favor, introduzca un teléfono de contacto.\n';
      document.Participar.Telefono.focus();
     }
    }
   }
  } 
  if (error!="") alert('Error:\n'+error);
  document.MM_returnValue = (error=="");
}

//-->
