/***************************************************************************
 * standard.js
 *     :
 ***************************************************************************/

/***************************************************************************
 * Class String
 ***************************************************************************/
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

/***************************************************************************
 * Object document
 ***************************************************************************/
document.Redirect = function(url)
{
// Parameter validation:
	if (url == null)
	{	return;	}

// Expand to the URL to include the <base/> URL (IE does not respect it).
	if (url.match(/^\w+:\/\//) == null)
	{
		var b = document.getElementsByTagName('base');
		if (b && b[0] && b[0].href)
		{
			var base = b[0].href;
			if (base.length && base.charAt(base.length-1) != '/')
			{	base += '/';	}
			if (url.charAt(0) == '/')
			{	url = url.substr(1);	}
			url = base + url;
		}
	}

// Redirect the document.
	location.href = url;
}
