// se encarga de eliminar espacios en blanco en ambas direcciones
String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g,""); }
// se encarga de validar una dir de E-Mail
String.prototype.esEmail = function () { 
     var rx = new RegExp("\\w+([-+.\’]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); 
	 var matches = rx.exec(this); return (matches != null && this == matches[0]); 
  }
