
function enviar()
{
	 if(validar())
	 {
	 	document.getElementById("forma").submit();
	 }
}
function validar()
{

	
	var tema = document.getElementById("tema");
	var comment = document.getElementById("comment");
	var nombre1 = document.getElementById("nombre1");
	var email = document.getElementById("email");
	var ciudad1 = document.getElementById("ciudad1");
	var estado = document.getElementById("estado");
	var cp = document.getElementById("cp");
	var pais = document.getElementById("pais");

	if(!is_empty(tema.value)){ aviso("tema"); return false;}
	if(!is_empty(comment.value)){ aviso("comment"); return false;}	
	if(!is_empty(nombre1.value)){ aviso("nombre1"); return false;}	 
	if(!is_email(email.value)){ aviso("email"); return false;}
	if(!is_empty(ciudad1.value)){ aviso("ciudad1"); return false;}
	if(!is_empty(estado.value)){ aviso("estado"); return false;}
	if(!is_empty(cp.value)){ aviso("cp"); return false;}	
	if(!is_empty(pais.value)){ aviso("pais"); return false;}	
	
	return true;	
}

function aviso(campo)
{

	var field = "w"+campo;
	document.getElementById(field).style.display = "inline";
	setTimeout("quitar(\""+field+"\")",2000);
}
function quitar(campo)
{
	document.getElementById(campo).style.display = "none";
}
function is_email(email)
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   return (reg.test(email) == false)? false : true;
}

function vacio(q)
{  
	for(i=0;i<q.length;i++)
	{  
		if(q.charAt(i)!="")
		{  
			return true;
		}  
	}  
	return false;
}  
   
function is_empty(campo)
{  
	if(vacio(campo)==false)
	{  
		return false;  
	}else{  
		return true;
	}  
}
  