var ventana;
var ventana_mail;
function abrir_pop(ancho,alto,ruta){
if(ventana){ventana.close()}
ventana=window.open (ruta, "", 'resize=no,scrollbars=no,resizable=no');
//ventana.document.write("<title>fsdfsdfdf</title>");
ventana.resizeTo(ancho,alto)
var hz=window.screen.height
var wz=window.screen.width
ventana.moveTo((wz-ancho)/2,(hz-ancho)/2)
}
function abrir_pop_mail(ruta){
if(ventana_mail){ventana_mail.close()}
ventana_mail=window.open (ruta, "", 'resize=no,scrollbars=no,resizable=yes');
var hz=window.screen.height
var wz=window.screen.width
ventana_mail.resizeTo(wz-30,hz-30)
ventana_mail.moveTo(0,0)
}
function abrir_pop_digital_v(ruta){
if(ventana){ventana.close()}
ventana=window.open (ruta, "", 'resize=yes,scrollbars=yes,resizable=yes');
var hz=window.screen.height
var wz=window.screen.width
ventana.resizeTo(wz-30,hz-30)
ventana.moveTo(0,0)
}

function valida_envia(c){ 
    //valido el nombre 
    if (document.fvalida.nombre.value.length==0){ 
       alert("Tiene que escribir su nombre") 
       document.fvalida.nombre.focus() 
       return 0; 
    } 

    //valido la edad. tiene que ser entero mayor que 18 
    edad = document.fvalida.edad.value 
    edad = validarEntero(edad) 
    document.fvalida.edad.value=edad 
    if (edad==""){ 
       alert("Tiene que introducir un número entero en su edad.") 
       document.fvalida.edad.focus() 
       return 0; 
    }else{ 
       if (edad<18){ 
          alert("Debe ser mayor de 18 años.") 
          document.fvalida.edad.focus() 
          return 0; 
       } 
    } 

    //valido el interés 
    if (document.fvalida.interes.selectedIndex==0){ 
       alert("Debe seleccionar un motivo de su contacto.") 
       document.fvalida.interes.focus() 
       return 0; 
    } 

    //el formulario se envia 
    alert("Muchas gracias por enviar el formulario"); 
    document.fvalida.submit(); 
} 
