/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function valida(){

}


function numero(id){
  
    elemento=document.getElementById(id);
    
    if(isNaN(elemento.value)){

        alert('Debes introducir un valor numerico');
        elemento.style.borderColor='red';
    }else
        elemento.style.borderColor='white';

}





function validaEnvio(){
    valor = document.getElementById("correo").value;

    if( document.getElementById("nombre").value==null||document.getElementById("nombre").value==0 ||/^\s+$/.test(document.getElementById("nombre").value) ) {

    alert('[ERROR] El campo nombre  es obligatorio');
    return false;
}else if( document.getElementById("telefono").value==null||document.getElementById("telefono").value==0 ||!(/^\d{7}$/.test(document.getElementById("telefono").value) )) {
    alert('[ERROR] Por favor introduce  un telefono válido\nDe la forma: 3698978');
    return false;
}else if( document.getElementById("direccion").value==null||document.getElementById("direccion").value==0 ||/^\s+$/.test(document.getElementById("direccion").value) ) {
    alert('[ERROR] El campo  direccion  es obligatorio');
    return false;
}else if( !(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(valor)) )     {
    alert('[ERROR] Debes introducir un correo electronico valido    ');
    return false;

}else if( document.getElementById("comentario").value==null||document.getElementById("comentario").value==0 ||/^\s+$/.test(document.getElementById("comentario").value) ) {
    alert('[ERROR] El campo  comentario  es obligatorio');
    return false;
}
return true;
}


