/**
 * Global Function to Prototypes
 *
 * This section add new features to diferent objects.  As Netscape, Microsoft Internet
 * Explorer and other browser work diferent, the form to add prototypes is diferent.
 */
 
 /**
  * Left Trim, Right Trim and Trim functions:
  *
  * This function work equal as to other languages.  This, delete the
  * blank spaces to left, right and complete string.
  */ 

function leftTrim()
{
	var xlefttrimregexp = /\s*((\S+\s*)*)/;
	var xstring         = new String(this);
	
	return xstring.replace(xlefttrimregexp, "$1");
}

function rightTrim()
{
	var xrighttrimregexp = /((\s*\S+)*)\s*/;
	var xstring          = new String(this);
	
	return xstring.replace(xrighttrimregexp, "$1");
}

function trim() 
{
	xstring = new String(this);
	return xstring.leftTrim().rightTrim();
}

String.prototype.leftTrim  = leftTrim;
String.prototype.rightTrim = rightTrim;
String.prototype.trim      = trim;