// Desarrollado por www.cesarcancino.com
//*****************************************************************************
//Valida correo
function valida_correo(correo) {
		  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(correo)){
			
		   return (true)
		  } else {
		   
		   return (false);
		  }
		 }
//*************************************************************************************************************************************
//valida números
function valida_numero(numero)
{
if (!/^([0-9])*$/.test(numero)){
		return false;
}else{
		return true;
	}
}
//*******************************************************************************************************
//función para validar cadenas de solo letras
function valida_cadena(texto)
	{
		var RegExPattern = "[1-9]";
		 if (texto.match(RegExPattern))
		 {
		 	return false;
		 }else
		 {
		 	return true;
		 }
	}
//************************************************************
function limpiar()
{
	document.form.reset();
	document.form.nom.focus();
}

function validar()
{
	var form =document.form;
	if (form.nombre.value==0)
	{
		alert("ingrese su nombre");
		form.nombre.value="";
		form.nombre.focus();
		return false;
	}
	
	if (valida_cadena(form.nombre.value)==false)
	{
		alert("ingrese un nombre correcto");
		form.nombre.value="";
		form.nombre.focus();
		return false;
	}
	
	if (form.telefono.value==0)
	{
		alert("ingrese su n\u00famero tel\u00e9fonico");
		form.telefono.value="";
		form.telefono.focus();
		return false;
	}
	
		if (valida_numero(form.telefono.value)==false)
	{
		alert("ingrese el n\u00famero tel\u00e9fonico correcto");
		form.telefono.value="";
		form.telefono.focus();
		return false;
	}
	
	if (form.correo.value==0)
	{
		alert("ingrese su correo electr\u00f3nico");
		form.correo.value="";
		form.correo.focus();
		return false;
	}
	if (valida_correo(form.correo.value)==false)
	{
		alert("ingrese su correo electr\u00f3nico correcto");
		form.correo.value="";
		form.correo.focus();
		return false;
	}
	if (form.comentario.value==0)
	{
		alert("ingrese informaci\u00f3n adicional o comentario al respecto.");
		form.comentario.value="";
		form.comentario.focus();
		return false;
	}
	document.form.submit();
}

