﻿function back() {
	history.go(-1);
}
function getGametype(m, g) {
	masterfloat.innerHTML = '<embed src="images/loading2.swf" style="width: 20px; height: 20px;" wmode="transparent"></embed>';
	masterfloat.style.width = "128px";
	masterfloat.style.height = "45px";
	ajax("showgametype.aspx?m=" + m + "&g=" + g, null, null, "GET", "masterfloat");
}
function confirmAction(msg, type, action)
{
	if (confirm(msg) == true)
	{
		if (type == "link")
		{
			window.location.href = baseurl + action;
		}
		else if (type == "script")
		{
//			eval('(' + action + ')');
		}
	}
}
function moveGametype() {
	masterfloat.style.visibility = "visible";
	masterfloat.style.top = event.y + document.body.scrollTop + 220;
	masterfloat.style.left = event.x + ((document.body.offsetWidth - 830) / 2) + 10;
}
function hideGametype() {
	masterfloat.innerHTML = "";
	masterfloat.style.visibility = "hidden";
}
function hideNotification(id) {
	document.getElementById("mainalert").style.display = "none";
	ajax("hidealert.aspx?id=" + id, null, null, "GET", null);
}
function idleauth() {
	ajax("idleauth.aspx", null, null, "GET", null);
	var t = setTimeout("idleauth()", 150000);
}
function disableButton(which, formid) {
	document.forms["formid"].submit();
	which.value = "Working...";
	which.disabled = true;
}
function GlobalCheckLoginForm() {
	if (document.forms["gloginform"].elements["gamertag"].value != "") {
		GlobalGetLoginHalocard();
	}
}
function GlobalGetLoginHalocard(result) {
	var xmlquery;
	var xmlresponse;
	
	if (document.forms["gloginform"].elements["gamertag"].value != "") {
		if (result == "" || result == null) {	
			askingforcard = "gl";
			document.getElementById("glgamertagload").style.display = "block";
			xmlquery = document.forms["gloginform"].elements["gamertag"].value + "&ref=login&side=l";
			ajax('halocard.aspx?gamertag=' + xmlquery, "glhalocard", null, "GET", "glgamertagload");
		}
		else {
			if (result.replace("images/carderror.jpg", "") == result) {
				document.getElementById("glgamertagload").style.display = "none";
				document.getElementById("glhalocardouter").style.display = "block";
		        document.getElementById("glhalocard").style.display = "block";
			    document.getElementById("glhalocard").innerHTML = result;
				document.getElementById("glgamertagtr").style.display = "none";
				try {
					document.getElementById("gloginerrs").style.width = "287px";
					document.getElementById("glerrpad").style.height = "2px";
				}
				catch (Error) {
				
				}
				document.forms["gloginform"].elements["gamertag"].value = document.getElementById("glgamertag").innerHTML;
			}
			else {
				document.getElementById("glgamertagload").style.display = "none";
				document.getElementById("glhalocardouter").style.display = "block";
			    document.getElementById("glhalocard").style.display = "block";
			    document.getElementById("glhalocard").innerHTML = result;
			}
			result = "";
		}
	}
}
function GlobalHideLoginHalocard() {
	document.getElementById("glhalocardouter").style.display = "none";
    document.getElementById("glhalocard").style.display = "none";
    document.getElementById("glhalocard").innerHTML = "";
    document.getElementById("glgamertagtr").style.display = "block";
    document.forms["gloginform"].elements["gamertag"].focus();
    document.forms["gloginform"].elements["gamertag"].select();
    try {
		document.getElementById("gloginerrs").style.width = "100%";
		document.getElementById("glerrpad").style.height = "2px";
	}
	catch (Error) {
	
	}
}
var Menus = {
	"Timers": {
		"alerts": null,
		"profile": null,
		"login": null
	},
	"Show": function (sDiv) {
		var Divs = new Array("alerts", "profile", "mm");
		
		this.ClearTimer(sDiv);
		
		for (var i = 0; i <= Divs.length - 1; i++)
		{
			this.Hide(Divs[i]);
		}
		
		document.getElementById(sDiv + "arrow").src = "images/design/arrowlit.jpg";
		document.getElementById(sDiv + "dropdown").style.display = "inline";
	},
	"Hide": function (sDiv) {
		document.getElementById(sDiv + "arrow").src = "images/design/arrow2.jpg";
		document.getElementById(sDiv + "dropdown").style.display = "none";
	},
	"Timer": function (sDiv) {
		this.ClearTimer(sDiv);
		this.Timers[sDiv] = setTimeout("Menus.Hide('" + sDiv + "')", 1000);	
	},
	"ClearTimer": function (sDiv) {
		clearTimeout(this.Timers[sDiv]);
	}
};