
var featuredcontentglider = {csszindex:100, ajaxloadingmsg:"<b>Fetching Content. Please wait...</b>", glide:function (c, d, h) {
	var e = parseInt(d);
	if (e >= c.$contentdivs.length) {
		alert("No content exists at page " + (e + 1) + "! Loading 1st page instead.");
		e = 0;
	}
	var b = c.$contentdivs.eq(e);
	if (c.$togglerdiv.attr("lastselected") == null || parseInt(c.$togglerdiv.attr("lastselected")) != e) {
		var g = c.$toc.eq(e);
		c.$next.attr("loadpage", (e < c.$contentdivs.length - 1) ? e + 1 + "pg" : 0 + "pg");
		c.$prev.attr("loadpage", (e == 0) ? c.$contentdivs.length - 1 + "pg" : e - 1 + "pg");
		var a = (h == "previous") ? -c.startpoint : c.startpoint;
		b.css(c.leftortop, a).css("zIndex", this.csszindex++);
		var f = (c.leftortop == "left") ? {left:0} : {top:0};
		b.animate(f, c.speed);
		c.$toc.removeClass("selected");
		g.addClass("selected");
		c.$togglerdiv.attr("lastselected", e + "pg");
	}
}, getremotecontent:function (b, a) {
	a.$glider.html(this.ajaxloadingmsg);
	b.ajax({url:a.remotecontent, error:function (c) {
		a.$glider.html("Error fetching content.<br />Server Response: " + c.responseText);
	}, success:function (c) {
		a.$glider.html(c);
		featuredcontentglider.setuptoggler(b, a);
	}});
}, aligncontents:function (b, a) {
	a.$contentdivs = b("#" + a.gliderid + " ." + a.contentclass);
	a.$contentdivs.css(a.leftortop, a.startpoint).css({height:a.$glider.height(), visibility:"visible"});
}, setuptoggler:function (c, b) {
	this.aligncontents(c, b);
	b.$togglerdiv.hide();
	b.$toc.each(function (d) {
		c(this).attr("pagenumber", d + "pg");
		if (d > (b.$contentdivs.length - 1)) {
			c(this).css({display:"none"});
		}
	});
	var a = c("#" + b.togglerid + " .next, #" + b.togglerid + " .prev");
	a.click(function (d) {
		featuredcontentglider.glide(b, this.getAttribute("loadpage"), this.getAttribute("buttontype"));
		d.preventDefault();
	});
	b.$toc.click(function (d) {
		featuredcontentglider.glide(b, this.getAttribute("pagenumber"));
		d.preventDefault();
	});
	b.$togglerdiv.fadeIn(1000, function () {
		featuredcontentglider.glide(b, b.selected);
		if (b.autorotate == true) {
			b.stepcount = 0;
			b.totalsteps = b.$contentdivs.length * b.autorotateconfig[1];
			featuredcontentglider.autorotate(b);
		}
	});
	b.$togglerdiv.click(function () {
		featuredcontentglider.cancelautorotate(b.togglerid);
	});
}, autorotate:function (a) {
	var b = a.speed + a.autorotateconfig[0];
	window[a.togglerid + "timer"] = setInterval(function () {
		if (a.totalsteps > 0 && a.stepcount >= a.totalsteps) {
			clearInterval(window[a.togglerid + "timer"]);
		} else {
			a.$next.triggerHandler("click");
			a.stepcount++;
		}
	}, b);
}, cancelautorotate:function (a) {
	if (window[a + "timer"]) {
		clearInterval(window[a + "timer"]);
	}
}, getCookie:function (a) {
	var b = new RegExp(a + "=[^;]+", "i");
	if (document.cookie.match(b)) {
		return document.cookie.match(b)[0].split("=")[1];
	}
	return null;
}, setCookie:function (a, b) {
	document.cookie = a + "=" + b;
}, init:function (a) {
	jQuery(document).ready(function (c) {
		a.$glider = c("#" + a.gliderid);
		a.$togglerdiv = c("#" + a.togglerid);
		a.$toc = a.$togglerdiv.find(".toc");
		a.$next = a.$togglerdiv.find(".next");
		a.$prev = a.$togglerdiv.find(".prev");
		a.$prev.attr("buttontype", "previous");
		var b = (a.persiststate) ? featuredcontentglider.getCookie(a.gliderid) : a.selected;
		a.selected = (isNaN(parseInt(b))) ? a.selected : b;
		a.leftortop = (/up/i.test(a.direction)) ? "top" : "left";
		a.heightorwidth = (/up/i.test(a.direction)) ? a.$glider.height() : a.$glider.width();
		a.startpoint = (/^(left|up)/i.test(a.direction)) ? -a.heightorwidth : a.heightorwidth;
		if (typeof a.remotecontent != "undefined" && a.remotecontent.length > 0) {
			featuredcontentglider.getremotecontent(c, a);
		} else {
			featuredcontentglider.setuptoggler(c, a);
		}
		c(window).bind("unload", function () {
			a.$togglerdiv.unbind("click");
			a.$toc.unbind("click");
			a.$next.unbind("click");
			a.$prev.unbind("click");
			if (a.persiststate) {
				featuredcontentglider.setCookie(a.gliderid, a.$togglerdiv.attr("lastselected"));
			}
			a = null;
		});
	});
}};
var tableWidget_tableCounter = 0;
var tableWidget_arraySort = new Array();
var tableWidget_okToSort = true;
var activeColumn = new Array();
var arrowImagePath = "/images/home";
function addEndCol(c) {
	if (document.all) {
		return;
	}
	var b = c.getElementsByTagName("TR");
	for (var d = 0; d < b.length; d++) {
		var a = b[d].insertCell(-1);
		a.innerHTML = " ";
		a.style.width = "13px";
		a.width = "13";
	}
}
function highlightTableHeader() {
	this.className = "tableWigdet_headerCellOver";
	if (document.all) {
		var a = this.parentNode.parentNode.parentNode.parentNode;
		this.parentNode.style.top = a.scrollTop + "px";
	}
}
function deHighlightTableHeader() {
	this.className = "tableWidget_headerCell";
}
function mousedownTableHeader() {
	this.className = "tableWigdet_headerCellDown";
	if (document.all) {
		var a = this.parentNode.parentNode.parentNode.parentNode;
		this.parentNode.style.top = a.scrollTop + "px";
	}
}
function sortNumeric(a, b) {
	a = a.replace(/,/, ".");
	b = b.replace(/,/, ".");
	a = a.replace(/[^\d\-\.\/]/g, "");
	b = b.replace(/[^\d\-\.\/]/g, "");
	if (a.indexOf("/") >= 0) {
		a = eval(a);
	}
	if (b.indexOf("/") >= 0) {
		b = eval(b);
	}
	return a / 1 - b / 1;
}
function sortString(d, c) {
	if (d.toUpperCase() < c.toUpperCase()) {
		return -1;
	}
	if (d.toUpperCase() > c.toUpperCase()) {
		return 1;
	}
	return 0;
}
function cancelTableWidgetEvent() {
	return false;
}
function sortTable() {
	if (!tableWidget_okToSort) {
		return;
	}
	tableWidget_okToSort = false;
	var c = this;
	var g = 0;
	while (c.previousSibling) {
		c = c.previousSibling;
		if (c.tagName == "TD") {
			g++;
		}
	}
	var h = this.getElementsByTagName("IMG");
	if (this.getAttribute("direction") || this.direction) {
		direction = this.getAttribute("direction");
		if (navigator.userAgent.indexOf("Opera") >= 0) {
			direction = this.direction;
		}
		if (direction == "ascending") {
			direction = "descending";
			this.setAttribute("direction", "descending");
			this.direction = "descending";
		} else {
			direction = "ascending";
			this.setAttribute("direction", "ascending");
			this.direction = "ascending";
		}
	} else {
		direction = "ascending";
		this.setAttribute("direction", "ascending");
		this.direction = "ascending";
	}
	if (direction == "descending") {
		h[0].style.display = "inline";
		h[0].style.visibility = "visible";
		h[1].style.display = "none";
	} else {
		h[1].style.display = "inline";
		h[1].style.visibility = "visible";
		h[0].style.display = "none";
	}
	var e = this.parentNode.parentNode.parentNode;
	var j = e.getElementsByTagName("TBODY")[0];
	var d = e.id.replace(/[^\d]/g, "");
	var l = tableWidget_arraySort[d][g];
	if (activeColumn[d] && activeColumn[d] != this) {
		var h = activeColumn[d].getElementsByTagName("IMG");
		h[0].style.display = "none";
		h[1].style.display = "inline";
		h[1].style.visibility = "hidden";
		if (activeColumn[d]) {
			activeColumn[d].removeAttribute("direction");
		}
	}
	activeColumn[d] = this;
	var i = new Array();
	var b = new Array();
	for (var k = 1; k < e.rows.length; k++) {
		var f = e.rows[k].cells[g].innerHTML + "";
		i.push(f);
		b.push(e.rows[k].cells[g]);
	}
	if (l == "N") {
		i = i.sort(sortNumeric);
	} else {
		i = i.sort(sortString);
	}
	if (direction == "descending") {
		for (var k = i.length; k >= 0; k--) {
			for (var a = 0; a < b.length; a++) {
				if (b[a].innerHTML == i[k] && !b[a].getAttribute("allreadySorted")) {
					b[a].setAttribute("allreadySorted", "1");
					j.appendChild(b[a].parentNode);
				}
			}
		}
	} else {
		for (var k = 0; k < i.length; k++) {
			for (var a = 0; a < b.length; a++) {
				if (b[a].innerHTML == i[k] && !b[a].getAttribute("allreadySorted")) {
					b[a].setAttribute("allreadySorted", "1");
					j.appendChild(b[a].parentNode);
				}
			}
		}
	}
	for (var a = 0; a < b.length; a++) {
		b[a].removeAttribute("allreadySorted");
	}
	tableWidget_okToSort = true;
}
function initTableWidget(a, c, i, f) {
	c = c + "";
	i = i + "";
	var e = document.getElementById(a);
	e.parentNode.className = "widget_tableDiv";
	if (navigator.userAgent.indexOf("MSIE") >= 0) {
		e.parentNode.style.overflowY = "auto";
	}
	tableWidget_arraySort[tableWidget_tableCounter] = f;
	if (c.indexOf("%") >= 0) {
		e.style.width = c;
		e.parentNode.style.width = c;
	} else {
		e.style.width = c + "px";
		e.parentNode.style.width = c + "px";
	}
	if (i.indexOf("%") >= 0) {
		e.parentNode.style.height = i;
	} else {
		e.parentNode.style.height = i + "px";
	}
	e.id = "tableWidget" + tableWidget_tableCounter;
	addEndCol(e);
	e.cellSpacing = 0;
	e.cellPadding = 0;
	e.className = "tableWidget";
	var k = e.getElementsByTagName("THEAD")[0];
	var j = k.getElementsByTagName("TD");
	for (var h = 0; h < j.length; h++) {
		j[h].className = "tableWidget_headerCell";
		j[h].onselectstart = cancelTableWidgetEvent;
		if (h == j.length - 1) {
			j[h].style.borderRight = "0px";
		}
		if (f[h]) {
			j[h].onmouseover = highlightTableHeader;
			j[h].onmouseout = deHighlightTableHeader;
			j[h].onmousedown = mousedownTableHeader;
			j[h].onmouseup = highlightTableHeader;
			j[h].onclick = sortTable;
			var d = document.createElement("IMG");
			d.src = arrowImagePath + "/arrow_up.jpg";
			j[h].appendChild(d);
			d.style.visibility = "hidden";
			var d = document.createElement("IMG");
			d.src = arrowImagePath + "/arrow_down.jpg";
			j[h].appendChild(d);
			d.style.display = "none";
		} else {
			j[h].style.cursor = "default";
		}
	}
	var g = e.getElementsByTagName("TBODY")[0];
	if (document.all && navigator.userAgent.indexOf("Opera") < 0) {
		g.className = "scrollingContent";
		g.style.display = "block";
	} else {
		g.className = "scrollingContent";
		if (g.offsetHeight > (g.parentNode.parentNode.offsetHeight - 50)) {
			g.style.height = (e.parentNode.clientHeight - k.offsetHeight) + "px";
		} else {
			g.style.overflow = "hidden";
		}
		if (navigator.userAgent.indexOf("Opera") >= 0) {
			e.parentNode.style.overflow = "auto";
		}
	}
	for (var h = 1; h < e.rows.length; h++) {
		e.rows[h].onmouseover = highlightDataRow;
		e.rows[h].onmouseout = deHighlightDataRow;
		for (var b = 0; b < f.length; b++) {
			if (f[b] && f[b] == "N") {
				e.rows[h].cells[b].style.textAlign = "right";
			}
		}
	}
	for (var b = 0; b < f.length; b++) {
		if (f[b] && f[b] == "N") {
			e.rows[0].cells[b].style.textAlign = "right";
		}
	}
	tableWidget_tableCounter++;
}
function highlightDataRow() {
	if (navigator.userAgent.indexOf("Opera") >= 0) {
		return;
	}
	this.className = "tableWidget_dataRollOver";
	if (document.all) {
		var b = this.parentNode.parentNode.parentNode;
		var a = b.getElementsByTagName("TR")[0];
		a.style.top = b.scrollTop + "px";
	}
}
function deHighlightDataRow() {
	if (navigator.userAgent.indexOf("Opera") >= 0) {
		return;
	}
	this.className = null;
	if (document.all) {
		var b = this.parentNode.parentNode.parentNode;
		var a = b.getElementsByTagName("TR")[0];
		a.style.top = b.scrollTop + "px";
	}
}
function goUp() {
	if (scrollLock) {
		return;
	}
	moveLock = true;
	scrollWay = "left";
	timeObj = setInterval("scrollGoUp();", scrollSpeed);
}
function ngoUp() {
	if (scrollLock) {
		return;
	}
	moveLock = true;
	scrollWay = "left";
	timeObj = setInterval("nscrollGoUp();", scrollSpeed);
}
function stopUp() {
	if (scrollWay == "right") {
		return;
	}
	clearInterval(timeObj);
	if ((getEl("scrollArea").scrollLeft - scrollFill) % scrollWidth != 0) {
		scrollComp = scrollFill - (getEl("scrollArea").scrollLeft % scrollWidth);
		compScroll();
	} else {
		scrollLock = false;
	}
}

function nstopUp() {
	if (scrollWay == "right") {
		return;
	}
	clearInterval(timeObj);
	if ((getEl("nscrollArea").scrollLeft - scrollFill) % scrollWidth != 0) {
		scrollComp = scrollFill - (getEl("nscrollArea").scrollLeft % scrollWidth);
		ncompScroll();
	} else {
		scrollLock = false;
	}
}

function scrollGoUp() {
	getEl("scrollArea").scrollLeft -= scrollSpace;
}
function nscrollGoUp() {
	getEl("nscrollArea").scrollLeft -= scrollSpace;
}
function goDown() {
	clearInterval(timeObj);
	if (scrollLock) {
		return;
	}
	scrollLock = true;
	scrollWay = "right";
	timeObj = setInterval("scollGoDown()", scrollSpeed);
}

function ngoDown() {
	clearInterval(timeObj);
	if (scrollLock) {
		return;
	}
	scrollLock = true;
	scrollWay = "right";
	timeObj = setInterval("nscollGoDown()", scrollSpeed);
}

function stopDown() {
	if (scrollWay == "left") {
		return;
	}
	clearInterval(timeObj);
	if (getEl("scrollArea").scrollLeft % scrollWidth - (scrollFill >= 0 ? scrollFill : scrollFill + 1) != 0) {
		scrollComp = scrollWidth - getEl("scrollArea").scrollLeft % scrollWidth + scrollFill;
		compScroll();
	} else {
		scrollLock = false;
	}
}

function nstopDown() {
	if (scrollWay == "left") {
		return;
	}
	clearInterval(timeObj);
	if (getEl("nscrollArea").scrollLeft % scrollWidth - (scrollFill >= 0 ? scrollFill : scrollFill + 1) != 0) {
		scrollComp = scrollWidth - getEl("nscrollArea").scrollLeft % scrollWidth + scrollFill;
		ncompScroll();
	} else {
		scrollLock = false;
	}
}

function scollGoDown() {
	getEl("scrollArea").scrollLeft += scrollSpace;
}

function nscollGoDown() {
	getEl("nscrollArea").scrollLeft += scrollSpace;
}
function compScroll() {
	if (scrollComp == 0) {
		scrollLock = false;
		return;
	}
	var a, c = scrollSpeed, b = scrollSpace;
	if (Math.abs(scrollComp) < scrollWidth / 2) {
		b = Math.round(Math.abs(scrollComp / scrollSpace));
		if (b < 1) {
			b = 1;
		}
	}
	if (scrollComp < 0) {
		if (scrollComp < -b) {
			scrollComp += b;
			a = b;
		} else {
			a = -scrollComp;
			scrollComp = 0;
		}
		getEl("scrollArea").scrollLeft -= a;
		setTimeout("compScroll()", c);
	} else {
		if (scrollComp > b) {
			scrollComp -= b;
			a = b;
		} else {
			a = scrollComp;
			scrollComp = 0;
		}
		getEl("scrollArea").scrollLeft += a;
		setTimeout("compScroll()", c);
	}
}

function ncompScroll() {
	if (scrollComp == 0) {
		scrollLock = false;
		return;
	}
	var a, c = scrollSpeed, b = scrollSpace;
	if (Math.abs(scrollComp) < scrollWidth / 2) {
		b = Math.round(Math.abs(scrollComp / scrollSpace));
		if (b < 1) {
			b = 1;
		}
	}
	if (scrollComp < 0) {
		if (scrollComp < -b) {
			scrollComp += b;
			a = b;
		} else {
			a = -scrollComp;
			scrollComp = 0;
		}
		getEl("nscrollArea").scrollLeft -= a;
		setTimeout("ncompScroll()", c);
	} else {
		if (scrollComp > b) {
			scrollComp -= b;
			a = b;
		} else {
			a = scrollComp;
			scrollComp = 0;
		}
		getEl("nscrollArea").scrollLeft += a;
		setTimeout("ncompScroll()", c);
	}
}

var mousePos = null;
document.onmousemove = mouseMove;
function clearTable(c) {
	var b = c.rows.length;
	for (var a = 0; a < b; a++) {
		c.deleteRow(-1);
	}
}
function strBeginWith(b, a) {
	return b.match("^" + a) == a;
}
function strEndWith(b, a) {
	return b.match(a + "$") == a;
}
function mousePosition(a) {
	if (a.pageX || a.pageY) {
		return {x:a.pageX, y:a.pageY};
	}
//	return {x:a.clientX + document.body.scrollLeft - document.body.clientLeft, y:a.clientY + document.body.scrollTop - document.body.clientTop};
}
function mouseMove(a) {
	a = a || window.event;
	mousePos = mousePosition(a);
}

function setHomePage() {
	this.style.behavior = "url(#default#homepage)";
	this.sethomepage("http://www.ngamebar.com");
}

function onFavorite() {
	window.external.AddFavorite("http://www.ngamebar.com");
}

function goTo(a) {
	window.open(a);
}


function skinCheck(d, c) {
	for (var b = 0; b < d.length; b++) {
		if (d[b] == c) {
			return true;
		}
	}
	var a = /^[a-zA-Z0-9]+.club$/;
	if (a.test(c)) {
		return true;
	}
	return false;
}
function browserinfo() {
	var k = navigator.appName;
	var c = parseFloat(navigator.appVersion);
	var h = navigator.userAgent;
	var e, i;
	var b = (k == "Microsoft Internet Explorer");
	var n = (k == "Netscape");
	if (n) {
		if (c >= 5) {
			var l = h.lastIndexOf("/");
			var a = h.indexOf(" ", l);
			var d = h.lastIndexOf(" ", l);
			e = h.substring(l + 1, a);
			i = h.substring(d + 1, l);
		} else {
			e = c;
			i = k;
		}
	} else {
		if (b) {
			var m = h.indexOf("MSIE");
			var j = h.indexOf(";", m);
			e = h.substring(m + 5, j);
			i = k;
			if (h.indexOf("Maxthon") != -1) {
				i += "(Maxthon)";
			} else {
				if (h.indexOf("Opera") != -1) {
					i = "Opera";
					var f = h.indexOf("Opera");
					var g = h.length;
					e = h.substring(f + 6, g);
				}
			}
		} else {
			i = "Unknown Navigator";
			e = "Unknown Version";
		}
	}
	navigator.Actual_Name = i;
	navigator.Actual_Version = e;
	this.Name = i;
	this.Version = e;
}


