function limpia(){
document.form.reset();
limpiaElem();

}
function limpiaElem(){

	document.getElementById("lbl_mail").color="#000000"
	document.getElementById("lbl_mensaje").color="#000000"
	document.getElementById("lbl_nombre").color="#000000"
	document.getElementById("lbl_telefono").color="#000000"
	

	
}
function Validar(){
		limpiaElem();
			
		var arr = new Array();
		var Cuenta = document.form.mensaje.value
		if (Cuenta=="") {
			arr.push("mensaje");
		}
		
		
		if (document.form.telefono.value=="") {
			arr.push("telefono");
		}
		if (document.form.nombre.value=="") {
			arr.push("nombre");
		}
		

		if (validateEmail(document.form.mail.value)==false) {
			arr.push("mail");
		}
		if (document.form.mail.value=="") {
			arr.push("mail");
		}
		if (arr.length == 0) {
			return true;
		}
		
		for (x=0;x< arr.length;x++) {
			var A = document.getElementById("lbl_" + arr[x]);
			A.color="#9F0000";
		//	alert(arr[x]);		
		}
		alert("Por favor, complete los campos en rojo");return false
							
		}
 function validateEmail(email) {
 if(email.length <= 0){
  return false;
 }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) 
     return false;
    if(splitted[1] != null ) {
       var regexp_user=/^\"?[\w-_\.]*\"?$/;
       if(splitted[1].match(regexp_user) == null) 
        return false;
    }
    if(splitted[2] != null) {
     var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
       if(splitted[2].match(regexp_domain) == null) {
      var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
      if(splitted[2].match(regexp_ip) == null) 
       return false;
       }
       return true;
    }
 return false;
}  

function ValidaCampos(){
    if(Validar()== true) 
      document.form.submit();

	}



