String.prototype.ltrim=function() { return this.replace(/^[\s\r\n\t]+/,''); }
String.prototype.rtrim=function() { return this.replace(/[\s\r\n\t]+$/,''); }
String.prototype.trim=function() { return this.ltrim().rtrim(); }

function getcookie(name) {
	var i, x, dcs = document.cookie.split(/;\s*/);
	for (i = 0; i < dcs.length; i++) {
		x = dcs[i].split('=');
		if (x[0] == name)
			return (x.length == 1)? '' : unescape(x[1]);
	}
	return null;
}

/*
var org_auth = getcookie('org_auth');
if (!org_auth || org_auth == '') {
	document.cookie = 'cookietest=cookiesenabled; path=/';
	if (getcookie('cookietest') == 'cookiesenabled') {
		document.write('<script src="https://auth.orgnetwork.com/javascript"></scr'+'ipt>');
		document.write('<script>if (org_auth && org_auth != "") { document.cookie="org_auth="+org_auth+"; path=/; domain=warcraft.org"; window.location.replace(window.location); } else { window.location.replace("https://auth.orgnetwork.com/bounce?r="+escape(window.location)); }</scr'+'ipt>');
	}
}
*/


function changeskin(newskin) {
	if (!newskin) return;
	document.cookie = 'skin='+newskin+'; path=/; expires=Sunday, 01-May-2010 00:00:00 GMT';
	window.location.reload(true);
}


var isWidthForced = false;
function force_minwidth() {
	var w = document.documentElement? document.documentElement.clientWidth
					: document.body.clientWidth;
	var m = parseInt(document.body.currentStyle['min-width']);
	if (w == m || isWidthForced == (w < m))
		return;
	if (w < m) {
		isWidthForced = true;
		document.body.style.width = ''+m+'px';
	} else {
		isWidthForced = false;
		document.body.style.width = '';
	}
}
function set_minwidth() {
	if (!document.body) {
		setTimeout('set_minwidth()', 200);
		return;
	}
	if (document.body.currentStyle && !document.body.style.minWidth
			&& window.attachEvent
			&& document.body.currentStyle['min-width']) {
		window.attachEvent('onload',force_minwidth);
		window.attachEvent('onresize',force_minwidth);
		force_minwidth();
	}
}
set_minwidth();


var wcpopup = false;
function popup(href,w,h,scroll) {
	if (wcpopup) wcpopup.close();
	if (scroll) { scroll='yes'; } else { scroll='no'; }
	if (window.screenTop || window.screenLeft) {
		x = window.screenLeft + 90;
		y = window.screenTop + 80;
	} else {
		x = window.screenX + 90;
		y = window.screenY + 80;
	}
	wcpopup = window.open(href, '', 'width='+w+',height='+h+',scrollbars='+scroll+',top='+y+',left='+x);
}
function popup_close() {
	if (wcpopup) { wcpopup.opener = null; wcpopup.close(); }
}
if (window.addEventListener)
	window.addEventListener('unload',popup_close,false);
else if (window.attachEvent)
	window.attachEvent('onunload',popup_close);

function goparent(url) {
	if (window.opener) { window.opener.location=url; window.close(); }
}



