function openWindow(url, name, width, height, resizable, scrollbars, statusbar, menubar, toolbar)
{
	var win = null;
	var optionString = "";
	if (width) optionString += "width=" + width + ",";
	if (height) optionString += "height=" + height + ",";
	if (resizable) optionString += "resizable=1,";
	if (scrollbars) optionString += "scrollbars=1,";
	if (statusbar) optionString += "status=1,";
	if (menubar) optionString += "menubar=1,";
	if (toolbar) optionString += "toolbar=1,";
	if (optionString != "") optionString = optionString.substr(0, optionString.length - 1);
	win = window.open(url, name, optionString);
	if (win) win.focus();
	return win;
}

function printPage()
{
	if (window.print) window.print();
	else alert("Please select \"Print...\" from the File menu.");
}

var liveResultsWin = null;
function liveResults()
{
	liveResultsWin = openWindow("LiveResults.aspx", liveResultsWin, 502, 418, 1, 1, 0, 0, 0);
}

var competitionWin = null;
function openCompetition()
{
	competitionWin = openWindow("Competition.aspx", competitionWin, 445, 418, 1, 1, 0, 0, 0);
}

var videoWin = null;
function openVideo()
{
	videoWin = openWindow("VideoPopup.aspx", videoWin, 800, 600, 1, 1, 0, 0, 0);
}

var PoyWin = null;
function openPoy()
{
	PoyWin = openWindow("PlayerOfYearPopup.aspx", PoyWin, 790, 880, 1, 1, 0, 0, 0);
}

var xmlRequest;
function getXml(url, handler)
{
	xmlRequest = null;
	
	// Branch for native XMLHttpRequest object
	if (window.XMLHttpRequest)
	{
		try
		{
			xmlRequest = new XMLHttpRequest();
		}
		catch(e)
		{
			xmlRequest = null;
		}
    // branch for IE/Windows ActiveX version
	}
	else if (window.ActiveXObject)
	{
		try
		{
			xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
				xmlRequest = null;
			}
		}
	}
	if (xmlRequest != null)
	{
		xmlRequest.onreadystatechange = handler;
		xmlRequest.open("GET", url, true);
		xmlRequest.send(null);
	}
}

function getObjectWidth(obj)
{
	var result = 0;
	if (obj.offsetWidth)
		result = obj.offsetWidth;
	else if (obj.clip && obj.clip.width)
		result = obj.clip.width;
	else if (obj.style && obj.style.pixelWidth)
		result = obj.style.pixelWidth;
	return parseInt(result);
}