var enviar ='no';
	function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
	function IsNumeric(valor) 
		{ 
			var log=valor.length; var sw="S"; 
			for (x=0; x<log; x++) 
				{ v1=valor.substr(x,1); 
				v2 = parseInt(v1); 
				//Compruebo si es un valor numérico 
				if (isNaN(v2)) { sw= "N";} 
				} 
				if (sw=="S") {return true;} else {return false; } 
		} 
		function validarEmail(valor) {
			  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
			   return (true)
			  } else {
			      return (false);
			  }
			 }		
	function comprobarcontacto(){
	var msgerror='';
	var telefono = trim(document.contacto.telefono.value);
	
	if (document.contacto.nombre.value=='') 
		msgerror = '* Nombre y apellidos\n';
		
	if (telefono=='') 
		{
		msgerror += msgerror +'* Teléfono\n';
		}
	else
		{
		if (!IsNumeric(telefono)) 
			msgerror += msgerror +'* El teléfono ha de ser un número\n';
		}
		
	
		
	if (document.contacto.mensaje.value=='') 
		msgerror = msgerror +'* Debes escribir algún mensaje\n';
		
	if (msgerror==''){
	 if ((telefono.length)<9)
	 	msgerror = '* El teléfono ha de tener 9 cifras como mínimo\n';
		document.contacto.telefono.focus();
	}
	if (msgerror!=''){
		alert('Los siguientes campos son obligatorios:\n\n'+msgerror);
		return false;
		}
	else{
		document.contacto.action="enviarformx.php";
		document.contacto.submit();
		return false;
	
	}
	}