// JavaScript Document
//VERIFICACION DE CAMPOS 

////// VERIFICA CAMPOS GENERAL//////
function validaFormGeneral() {
			return verificaCamposGeneral();
		}
		function verificaCamposGeneral() {
			for (var i=0;i<document.form.length;i++) {
				o = document.form[i];
				if ((o.getAttribute('obligatorio')!=null) && (o.value.length == 0)) {
					alert('El campo "' + o.getAttribute('leyenda') + '" no fue llenado');
					o.focus();
					return false;
				}
			}
			return true;
		}
		



////// VERIFICA FORM enews//////
function validaFormEnews() {
			return verificaCamposEnews();
		}
		function verificaCamposEnews() {					
			for (var i=0;i<document.formEnews.length;i++) {
				o = document.formEnews[i];
				if ((o.getAttribute('obligatorio')!=null) && (o.value.length == 0)) {
						alert('El campo "' + o.getAttribute('leyenda') + '" no fue llenado');
						o.focus();
						return false;
					}
			}
			return checkEmail(formEnews);
		
		
		function checkEmail(formEnews) {
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formEnews.mail.value)){
			return (true)
			}
			alert("El e-mail es incorrecto.")
			return (false)
			}
		
}
//-->

////// VERIFICA FORM CONTACTO //////
function validaFormContacto() {
			return verificaCamposC();
		}
		function verificaCamposC() {					
			for (var i=0;i<document.formContacto.length;i++) {
				o = document.formContacto[i];
				if ((o.getAttribute('obligatorio')!=null) && (o.value.length == 0)) {
						alert('El campo "' + o.getAttribute('leyenda') + '" no fue llenado');
						o.focus();
						return false;
					}
			}
			return checkEmail(formContacto);
		
		
		function checkEmail(formContacto) {
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formContacto.email.value)){
			return (true)
			}
			alert("El e-mail es incorrecto.")
			return (false)
			}
		
}
//-->

