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.nombreusuario.value=='') 
	msgerror = '* Nombre completo\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.email.value=='') 
	msgerror += '* Email\n';
else
	{
	if (validarEmail(document.contacto.email.value)==false)
		msgerror = msgerror +'* El Email parece incorrecto\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{
	return true;

}
}
