function ComprobarSubCategoria(){
    save_in_textarea_all();
    bool = false; 
    if(document.getElementById('sub_nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('sub_nombre').focus();
    }
    else{
        bool = true;
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarHerramientas(){
    bool = false; 
    if(document.getElementById('her_plazo').value == "") {
        bool = false;
        alert("El plazo es obligatorio");
        document.getElementById('her_plazo').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('her_descuento').value == "") {
            bool = false;
            alert("El descuento es obligatorio");
            document.getElementById('her_descuento').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }    
}
function ComprobarProducto(){
    save_in_textarea_all();
    bool = false; 
    if(document.getElementById('pro_nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('pro_nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('pro_referencia').value == "") {
            bool = false;
            alert("La referencia es obligatoria");
            document.getElementById('pro_referencia').focus();
        }
        else{
            bool = true;
        }
    } 
    if(bool){
        if(document.getElementById('pro_preciodesde').value == "") {
            bool = false;
            alert("El precio desde es obligatorio");
            document.getElementById('pro_preciodesde').focus();
        }
        else{
            bool = true;
        }
    } 
    if(bool){
        if(document.getElementById('pro_preciooferta').value == "") {
            bool = false;
            alert("El precio oferta es obligatorio");
            document.getElementById('pro_preciooferta').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('pro_descripcion').value == "") {
            bool = false;
            alert("La descripcion es obligatoria");
            document.getElementById('pro_descripcion').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarBoletin(){
    bool = false; 
    if(document.getElementById('asunto').value == "") {
        bool = false;
        alert("El asunto es obligatorio");
        document.getElementById('asunto').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('mensaje').value == "") {
            bool = false;
            alert("El mensaje es obligatorio");
            document.getElementById('mensaje').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarCaracteristica(){
    bool = false; 
    if(document.getElementById('car_nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('car_nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('car_descripcion').value == "") {
            bool = false;
            alert("La descripcion es obligatoria");
            document.getElementById('car_descripcion').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarCaracteristicaAccesorio(){
    bool = false; 
    if(document.getElementById('cara_nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('cara_nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('cara_descripcion').value == "") {
            bool = false;
            alert("La descripcion es obligatoria");
            document.getElementById('cara_descripcion').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarMedidas(){
    bool = false; 
    if(document.getElementById('med_medida').value == "") {
        bool = false;
        alert("La medida es obligatoria");
        document.getElementById('med_medida').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('med_precio').value == "") {
            bool = false;
            alert("El precio es obligatorio");
            document.getElementById('med_precio').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarMedidasAccesorios(){
    bool = false; 
    if(document.getElementById('meda_medida').value == "") {
        bool = false;
        alert("La medida es obligatoria");
        document.getElementById('meda_medida').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('meda_precio').value == "") {
            bool = false;
            alert("El precio es obligatorio");
            document.getElementById('meda_precio').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function ComprobarAccesorio(){
    bool = false; 
    if(document.getElementById('acc_nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('acc_nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('acc_referencia').value == "") {
            bool = false;
            alert("La referencia es obligatoria");
            document.getElementById('acc_referencia').focus();
        }
        else{
            bool = true;
        }
    } 
    if(bool){
        if(document.getElementById('acc_descripcion').value == "") {
            bool = false;
            alert("La descripcion es obligatoria");
            document.getElementById('acc_descripcion').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmdatos').submit();
    }
}
function MandarCarrito(id,id2){
    window.location.href = "modulos/metercarrito.php?id="+id+"&idm="+id2;
}
function MandarCarrito2(id,id2){
    window.location.href = "modulos/metercarrito2.php?id="+id+"&idm="+id2;
}
function MandarCarritoMas(id2,cantidad){
    window.location.href = "modulos/metercarrito.php?cantidad="+cantidad+"&idm="+id2;
}
function MandarCarritoMas2(id2,cantidad){
    window.location.href = "modulos/metercarrito2.php?cantidad="+cantidad+"&idm="+id2;
}
function MandarCarritoBorrar(id2,borrar){
    window.location.href = "modulos/metercarrito.php?borrar="+borrar+"&idm="+id2;
}
function MandarCarritoBorrar2(id2,borrar){
    window.location.href = "modulos/metercarrito2.php?borrar="+borrar+"&idm="+id2;
}
function MismosDatos(){
    bool = false; 
    if(document.getElementById('Nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('frmdatos').elements[8].checked = true;
         
        document.getElementById('Nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('Apellidos').value == "") {
            bool = false;
            alert("Los apellidos son obligatorios");
            document.getElementById('frmdatos').elements[8].checked = true;
             
            document.getElementById('Apellidos').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Direccion').value == "") {
            bool = false;
            alert("La direccion es obligatoria");
            document.getElementById('frmdatos').elements[8].checked = true;
             
            document.getElementById('Direccion').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('CP').value == "") {
            bool = false;
            alert("El C.P. es obligatorio");
            document.getElementById('frmdatos').elements[8].checked = true;
             
            document.getElementById('CP').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Localidad').value == "") {
            bool = false;
            alert("La localidad es obligatoria");
            document.getElementById('frmdatos').elements[8].checked = true;
             
            document.getElementById('Localidad').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Provincia').value == "") {
            bool = false;
            alert("La provincia es obligatoria");
            document.getElementById('frmdatos').elements[8].checked = true;
             
            document.getElementById('Provincia').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('NombreF').value = document.getElementById('Nombre').value;
        document.getElementById('ApellidosF').value = document.getElementById('Apellidos').value;
        document.getElementById('DireccionF').value = document.getElementById('Direccion').value;
        document.getElementById('CPF').value = document.getElementById('CP').value;
        document.getElementById('LocalidadF').value = document.getElementById('Localidad').value;
        document.getElementById('ProvinciaF').value = document.getElementById('Provincia').value;
    }
}
function EnviarDatos(){
    bool = false; 
    if(document.getElementById('NombreF').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('NombreF').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('ApellidosF').value == "") {
            bool = false;
            alert("Los apellidos son obligatorios");
            document.getElementById('ApellidosF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('DireccionF').value == "") {
            bool = false;
            alert("La direccion es obligatoria");
            document.getElementById('DireccionF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('CPF').value == "") {
            bool = false;
            alert("El C.P. es obligatorio");
            document.getElementById('CPF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('LocalidadF').value == "") {
            bool = false;
            alert("La localidad es obligatoria");
            document.getElementById('LocalidadF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('ProvinciaF').value == "") {
            bool = false;
            alert("La provincia es obligatoria");
            document.getElementById('ProvinciaF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('NifF').value == "") {
            bool = false;
            alert("El NIF/CIF es obligatorio");
            document.getElementById('NifF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Movil').value == "") {
            bool = false;
            alert("El teléfono de contacto es obligatorio");
            document.getElementById('Movil').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        document.getElementById('frmconfirmadatos').submit();
    }
}
function EnviarDatos2(){
    bool = false; 
    if(document.getElementById('NombreF').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('NombreF').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('ApellidosF').value == "") {
            bool = false;
            alert("Los apellidos son obligatorios");
            document.getElementById('ApellidosF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('DireccionF').value == "") {
            bool = false;
            alert("La direccion es obligatoria");
            document.getElementById('DireccionF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('CPF').value == "") {
            bool = false;
            alert("El C.P. es obligatorio");
            document.getElementById('CPF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('LocalidadF').value == "") {
            bool = false;
            alert("La localidad es obligatoria");
            document.getElementById('LocalidadF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('ProvinciaF').value == "") {
            bool = false;
            alert("La provincia es obligatoria");
            document.getElementById('ProvinciaF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('NifF').value == "") {
            bool = false;
            alert("El NIF/CIF es obligatorio");
            document.getElementById('NifF').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Movil').value == "") {
            bool = false;
            alert("El teléfono de contacto es obligatorio");
            document.getElementById('Movil').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('email').value == "") {
            bool = false;
            alert("El email es obligatorio");
            document.getElementById('email').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('check').checked != 1){
            alert('Debes aceptar la política de privacidad');
            document.getElementById('check').focus();
            bool = false;
        }
        else{
            document.getElementById('frmconfir').submit();
        }
    }
}
function EnviarConfirmacionDatos(){
    document.getElementById('frmconfirmadatosparaenviar').submit();
}
function ComprobarRegistro(){
    bool = false; 
    if(document.getElementById('Nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('Nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('Apellidos').value == "") {
            bool = false;
            alert("Los apellidos son obligatorios");
            document.getElementById('Apellidos').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Movil').value == "") {
            bool = false;
            alert("El teléfono de contacto es obligatorio");
            document.getElementById('Movil').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('email').value == "") {
            bool = false;
            alert("El email es obligatorio");
            document.getElementById('email').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        document.getElementById('frmregistro').submit();
    }
}
function ComprobarContacto(){
    bool = false; 
    if(document.getElementById('Nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('Nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('Apellidos').value == "") {
            bool = false;
            alert("Los apellidos son obligatorios");
            document.getElementById('Apellidos').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Movil').value == "") {
            bool = false;
            alert("El teléfono de contacto es obligatorio");
            document.getElementById('Movil').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('email').value == "") {
            bool = false;
            alert("El email es obligatorio");
            document.getElementById('email').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Observaciones').value == "") {
            bool = false;
            alert("Las observaciones son obligatorias");
            document.getElementById('Observaciones').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        document.getElementById('frmcontacto').submit();
    }
}
function CambiarMedida(valor,pagina){
    if(valor.value != ''){
        location.href = "modulos/sesionmedida.php?medida="+valor.value+"&pagina="+pagina;
    }
}
function Mandarcoockiexpos(){
   document.getElementById('frmconfircookie').submit();
}
function FocoPrecio(){
    document.getElementById('med_precio').focus();
    document.getElementById('med_precio').select();
}

function ComprobarProductoMedida(){
    bool = false; 
    if(document.getElementById('Nombre').value == "") {
        bool = false;
        alert("El nombre es obligatorio");
        document.getElementById('Nombre').focus();
    }
    else{
        bool = true;
    }
    if(bool){
        if(document.getElementById('email').value == "") {
            bool = false;
            alert("El email es obligatorio");
            document.getElementById('email').focus();
        }
        else{
            bool = true;
        }
    }
    if(bool){
        if(document.getElementById('Telefono').value == "") {
            bool = false;
            alert("El teléfono de contacto es obligatorio");
            document.getElementById('Telefono').focus();
        }
        else{
            bool = true;
        }
    }        
    if(bool){
        document.getElementById('frmcontacto').submit();
    }    
}