function obj(id){
    return document.getElementById(id);
}

function validaDatos(){
	if(obj('asunto').value == 0){
		alert("Favor de elegir un asunto");
		obj('asunto').focus();
		return false;
	}
	if(obj('seccion').value == 0){
		alert("Favor de elegir una secci�n para canalizar su mensaje");
		obj('seccion').focus();
		return false;
	}
	if(obj('localidad').value == 0){
		alert("Favor de elegir su localidad");
		obj('localidad').focus();
		return false;
	}
	if(obj('asunto').value!=4){			
   		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   		var address = obj('email').value;
   		if(reg.test(address) == false){
      		alert('Su correo no es valido');
      		obj('email').focus();
      		return false;
   		}
	}
        if(obj('email').value != ""){
                if(obj('telefono')){
                    if(obj('telefono').value == ""){
                        alert("Favor de escribir tu telefono para facilitar el contacto");
                        obj('telefono').focus();
                        return false;
                    }
                }
        }
    if(obj('mensaje').value == ""){
		alert("El mensaje se encuentra vac�o");
		obj('mensaje').focus();
		return false;
	}    
    obj('datos').submit();	
    return 0;
}

function validaRespuesta(){	
    if(obj('mensaje').value == ""){
		alert("El mensaje se encuentra vacio");
		obj('mensaje').focus();
		return false;
	}    
    obj('datos').submit();	
    return 0;
}

function verifAsunto(valor){
    if(valor == 4){
		obj("nota").innerHTML = "Si desea hacer una denuncia an&oacute;nima, puede dejar<br>en blanco los campos <em>'Nombre'</em>, <em>'Tel&eacute;fono'</em> y <em>'Correo electr&oacute;nico'</em>.";
    }else{
        obj("nota").innerHTML = "";
    }   
}

