function valida_msg(theForm)
{
  if (theForm.txtNombre.value == "")
  {
    alert("Por favor Inserte un Valor para el campo \"Nombre\" ");
    theForm.txtNombre.focus();
    return (false);
  }
  if (theForm.txtEmail.value == "")
  {
    alert("Por favor inserta un valor en el campo \"Email\".");
    theForm.txtEmail.focus();
    return (false);
  }

// Email valitacion
	if(theForm.txtEmail.value!="")
		{
			 if ((theForm.txtEmail.value.indexOf(" ")!=-1)) {
	   	    	alert("Lo siento, pero el Email no debe contener espacios en blanco");
				theForm.txtEmail.select();
				theForm.txtEmail.focus();
			    return false;
			    }
		 	if ((theForm.txtEmail.value.indexOf("@")==-1)) {
				 alert("Lo siento, pero el Emaildebe contener el caracter @");
			   	 theForm.txtEmail.select();
			   	 theForm.txtEmail.focus();
			  	 return false;
			 	}
		 	if (theForm.txtEmail.value.indexOf("@")<2) {
			   	 alert("Lo siento, pero esta es una direccion invalida"+ "\n"+ "Por favor verifica el texto antes de '@'");
				 theForm.txtEmail.select();
				 theForm.txtEmail.focus();
				 return false ;
                 }	
		 	 if ((theForm.txtEmail.value.indexOf(".",theForm.txtEmail.value.indexOf("@")) - theForm.txtEmail.value.indexOf("@")) < 2 ) {
				 	alert("Lo siento, pero esta es una direccion invalida" + "\n"+ "el dominio no esta especificado")
				    theForm.txtEmail.select();
				    theForm.txtEmail.focus();
				    return false;
					}
 			if ((theForm.txtEmail.value.length - theForm.txtEmail.value.indexOf(".",theForm.txtEmail.value.indexOf("@"))) < 2 ) {
				 	alert("Lo siento, pero esta es una direccion invalida")
			 		theForm.txtEmail.select();
					theForm.txtEmail.focus();
				 	return false;
				    }
			if (theForm.txtEmail.value.charAt(theForm.txtEmail.value.length-1) == "." ) {
		 			alert("Lo siento, pero esta es una direccion invalida " + "\n"+ "el punto no puede ser el ultimo caracter")
				    theForm.txtEmail.select();
				    theForm.txtEmail.focus();
				    return false;
				   }
		 }

  if (theForm.txtMensage.value == "")
  {
    alert("Introduce un valor en el campo \"Mensaje\".");
    theForm.txtMensage.focus();
    return (false);
  }else
  {
  	if (ComprobarPalabra(theForm.txtMensage.value) == false)
	{
		alert("Tu Mensaje no puede ser almacenado, debido a su alto contenido altisonante. \nMEJORA TU LENGUAJE");
		return (false);
	}
  }
  //theForm.txtMensage.value = ComprobarPalabra(theForm.txtMensage.value);
  return (true);
}
function ComprobarPalabra(cadena) 
{
  var mudo="#@&*%!#@&*%!#@&*%!"; 
  var palabros="CACA CULOS CULO PEDO MIERDAS MIERDA VERGAS VERGA PUTITA PUTITO PUTITAS PUTITOS PUTOS PUTO PUTAS PUTA MAMADA MAMADAS COÑO MAYATE MAYATES PENDEJO PENDEJOS PENDEJA PENDEJAS PENDEJADA PENDEJADAS";
  cambios=false;
  cadena = cadena.toUpperCase();
  for (var i=0;i<26;i++)
     { posicion=palabros.indexOf(" ");
       taco = palabros.substring(0,posicion);
       palabros=palabros.substring(posicion+1,palabros.length);
       while (cadena.indexOf(taco)!=-1)
            { cambios=true;
              posicion=cadena.indexOf(taco);
              cadena=cadena.substring(0,posicion)+mudo.substring(0,taco.length) 
                     +cadena.substring((posicion+taco.length),cadena.length);
            }
     }
	if (cambios==false)
    { return (true); } else {return (false);}
  
}
function DoSmilie(addSmilie) {
			var revisedMessage;
			var currentMessage = document.tagform.txtMensage.value;
			revisedMessage = currentMessage+addSmilie;
			document.tagform.txtMensage.value=revisedMessage;
			document.tagform.txtMensage.focus();
		return;
		}
	function Contar() {
		textoArea = document.tagform.txtMensage.value;
		numeroCaracteres = 250 - (textoArea.length + 1);
		document.tagform.txtNumero.value = numeroCaracteres;
		if (numeroCaracteres <= 0){
			alert("Solo se pueden escribir 250 Caracteres y ya has llegado al Límite")
			document.tagform.txtNumero.value = 0;
			document.tagform.txtMensage.value = textoArea.substr(0,textoArea.length - 1);
			
		}
	}

