function trim(fld){
	l=fld.value.length-1;
	v=fld.value;
	if((v.lastIndexOf(' ')==l)&&(l>0)){fld.value=v.substr(0,l);trim(fld)}
	if(v.indexOf(' ')==0){fld.value=v.slice(1);trim(fld)}
	fld.focus();
}
function clean(fld,i){
	trim(fld);
	if(fld.value.length<i){
		alert('The '+fld.name.toLowerCase( )+' must be at least '+i+' characters long!');
		return false;
	}
	return true;
}
function isNaE(fld){
	e=fld.value;
	if(!clean(fld,5))return true;
	if(e.indexOf('@')==-1){
		alert('Please, check the email!\nIt is missing the arobas (@ sign).');
		return true;
	}else{
		p=e.indexOf('@');
		l=e.length-1;
		if((p==0)||(p==l)){
			if(p==0)alert('Please, check the email!\nIt is missing the username');
			if(p==l)alert('Please, check the email!\nIt is missing the domain name');
			return true;
		}else{
			d=e.substr(p+1)
			dl=d.length-1;
			dp=d.indexOf('.');
			if((d.length<3)||(dp==-1)||(dp==0)||(dp==dl)){
				if(dp==-1)alert('Please, check the email domain!\nIt is missing the separator(.).');
				if((dp==0)||(dp==dl))alert('Please, check the email!\nThe domain name is incomplete.');
				return true;
			}
		}
		return false
	}
}
function isNaP(fld,c){
	if(!clean(fld,c))return true;
	fld.value=fld.value.replace(' ','');
	if((fld.value.length>0)&&(isNaN(fld.value))){
		alert('Please, check your phone number.');
		return true;
	}
	return false;
}