//*****************************************************************************
// Site menu code.
//
// Note: Requires common.js.
//*****************************************************************************

// Used to track the currently active menu.
var activeMenu;

// Set up page-level event capturing.
if (isIE)
	document.documentElement.attachEvent("onmousedown", pageMousedown);
else
	document.documentElement.addEventListener("mousedown", pageMousedown, true);

//-----------------------------------------------------------------------------
// Close any currently active menu if the page is clicked on elsewhere.
//-----------------------------------------------------------------------------
function pageMousedown(event)
{
	// If there is no currently active menu, exit.
	if (activeMenu == null)
		return;

	// Find the element that triggered the event.
	var el = (isIE ? window.event.srcElement : (event.target.tagName ? event.target : event.target.parentNode));

	// If the triggering element is not part of the menu bar or a menu, close
	// the currently active menu.
	while (el != null)
	{
		if (el.id == "menuBar" || (el.className != null && hasClassName(el, "menu")))
			return;
		el = el.parentNode;
	}
	closeMenu();
}

//-----------------------------------------------------------------------------
// Opens the designated menu.
//-----------------------------------------------------------------------------
function openMenu(linkEl, id)
{
	// If the specified menu is the currently active one, exit.
	if (activeMenu != null && activeMenu.id == id)
		return;

	// For IE, set the opener link up for highlight/restore on focus/bur.
	if (isIE)
	{
		if (window.event.type == "focus")
		{
			// The first time the link receives focus, do initialization.
			if (linkEl.onblur == null)
				linkEl.onblur = menuItemBlur;
				
			// Highlight it.
			addClassName(linkEl, "ieFocus");
		}
	}
	
	// Close any currently active menu.
	closeMenu();

	// Get the named menu and initialize it, if not already done.
	var menuEl = document.getElementById(id);
	if (menuEl.isInitialized == null)
		initializeMenu(menuEl, linkEl);

	// Position the menu and make it visible.
	var pt = getPageOffset(linkEl);
	menuEl.style.left = (pt.x + (isSafari ? 1 : 0)) + "px";
	menuEl.style.top  = (pt.y + linkEl.parentNode.offsetHeight) + "px";
	menuEl.style.visibility = "visible";

	// If the menu has an underlying IFRAME (IE browsers), position, size and
	// display it.
	if (menuEl.iframeEl != null)
	{
		menuEl.iframeEl.style.left = menuEl.style.left;
		menuEl.iframeEl.style.top  = menuEl.style.top;
		menuEl.iframeEl.width  = menuEl.offsetWidth + "px";
		menuEl.iframeEl.height = menuEl.offsetHeight + "px";
		menuEl.iframeEl.style.display = "";
	}

	// Mark this menu as the active one.
	activeMenu = menuEl;

	return false;
}

//-----------------------------------------------------------------------------
// Closes the currently active menu.
//-----------------------------------------------------------------------------
function closeMenu()
{
	// Exit if there is no active menu.
	if (activeMenu == null)
		return;

	// Make the active menu invisible.
	activeMenu.style.visibility = "";

	// If the menu has an underlying IFRAME (IE browsers), hide it as well.
	if (activeMenu.iframeEl != null)
		activeMenu.iframeEl.style.display = "none";

	// Remove focus from the menu's opener link.
	activeMenu.openerLink.blur();

	// Clear the active menu.
	activeMenu = null;
}

//-----------------------------------------------------------------------------
// Initializes a menu.
//-----------------------------------------------------------------------------
function initializeMenu(menuEl, linkEl) {

	// Add a reference for the opener link to the menu.
	menuEl.openerLink = linkEl;

	// Handle special IE problems.
	if (isIE)
	{
		// Get all the menu item links.
		var linkEls = menuEl.getElementsByTagName("A");

		// Set up each menu link for highlight/restore on focus/blur.
		for (var i = 0; i < linkEls.length; i++)
		{
			linkEls[i].onblur = menuItemBlur;
			linkEls[i].onfocus = menuItemFocus;
		}

		// For pre-IE 7.
		if (window.XMLHttpRequest == null)
		{

			// Create an IFRAME element to place under the menu DIV. This will prevent
			// SELECT elements and other windowed controls from bleeding through.
			var iframeEl = document.createElement("IFRAME");
			iframeEl.frameBorder = 0;
			iframeEl.src = "javascript:false;document.write('');document.close();";
			iframeEl.style.display = "none";
			iframeEl.style.position = "absolute";
			iframeEl.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
			menuEl.iframeEl = menuEl.parentNode.insertBefore(iframeEl, menuEl);

			// Fix the hover problem by setting an explicit width on first item of
			// the menu.
			if (linkEls.length > 0)
			{
				var w = linkEls[0].offsetWidth;
				linkEls[0].style.width = w + "px";
				dw = linkEls[0].offsetWidth - w;
				w -= dw;
				linkEls[0].style.width = w + "px";
			}
		}
	}

	// Set event handlers for the menu and it's opener link.
	menuEl.onmouseout = menuMouseout;
	menuEl.onclick    = menuClick;
	linkEl.onmouseout = menuBarItemMouseout;

	// Mark the menu as initialized.
	menuEl.isInitialized = true;
}

//-----------------------------------------------------------------------------
// Handles a mouseout on a menu.
//-----------------------------------------------------------------------------
function menuMouseout(event)
{
	var current, related;

	try
	{
		if (window.event)
		{
			current = this;
			related = window.event.toElement;
		}
		else
		{
			current = event.currentTarget;
			related = event.relatedTarget;
		}

		// If the mouse has moved off the menu, close it.
		if (current != related && !contains(current, related))
			closeMenu();
	}
	catch (ex)
	{}
}

//-----------------------------------------------------------------------------
// Handles a click on a menu.
//-----------------------------------------------------------------------------
function menuClick(event)
{
	// Find the element that triggered the event.
	var el = (isIE ? window.event.srcElement : (event.target.tagName ? event.target : event.target.parentNode));
	
	// If it is not a link, exit.
	if (el.tagName != "A")
		return;

	// Close the menu.
	closeMenu();
}

//-----------------------------------------------------------------------------
// Handles a mouseout on a menu bar link.
//-----------------------------------------------------------------------------
function menuBarItemMouseout(event)
{
	var current, related;

	try
	{
		if (window.event)
		{
			current = this;
			related = window.event.toElement;
		}
		else
		{
			current = event.currentTarget;
			related = event.relatedTarget;
		}

		// If the mouse has moved off the menu bar link but not onto the menu, 
		// close it.
		if (!contains(current, related) && !contains(activeMenu, related))
		{
			closeMenu();
		}
	}
	catch (ex)
	{}
}

//-----------------------------------------------------------------------------
// Handles a blur on a menu link (needed for IE).
//-----------------------------------------------------------------------------
function menuItemBlur(event)
{
	// Unhighlight the link.
	removeClassName(window.event.srcElement, "ieFocus");
}

//-----------------------------------------------------------------------------
// Handles a focus on a menu link (needed for IE).
//-----------------------------------------------------------------------------
function menuItemFocus(event)
{
	// Highlight the link.
	addClassName(window.event.srcElement, "ieFocus");
}

//-----------------------------------------------------------------------------
// Determines if one node contains another.
//-----------------------------------------------------------------------------
function contains(nodeA, nodeB)
{
	// Return false if either node is null.
	if (nodeA == null || nodeB == null)
		return false;

	// Return true if nodes A and B are the same node.
	if (nodeA == nodeB)
		return true;

	// Return true if node B is a descendant of node A.
	while (nodeB.parentNode)
	{
		if ((nodeB = nodeB.parentNode) == nodeA)
			return true;
	}

	return false;
}

/* [SCORES MOD START] */
//*****************************************************************************
// Live scoreboard code.
//*****************************************************************************

// Create an XMLHttpRequest object for loading the scoreboard data.
var scoreboardRequest = new XHR();
scoreboardRequest.url = "getJson.asp";
scoreboardRequest.queryString = "url=" + escape("http://static.nfl.com/liveupdate/scorestrip/scorestrip.json");
scoreboardRequest.successCallback = scoreboardRequestSuccess;

// Define an interval timer for updating the scoreboard.
var scoreboardInterval = null;

// Used to throttle update requests. If no active games are found during a
// scoreboard update, this will hold the time that update was made. When active
// games are found, this set to null.
var scoreboardLastInactiveUpdate = null;

// Used to hold scoreboard game data.
var scoreboardGames = new Array();

//-----------------------------------------------------------------------------
// Initializes the scoreboard.
//-----------------------------------------------------------------------------
function scoreboardInit()
{
	// Exit if the request object could not be created.
	if (scoreboardRequest.xmlHttpRequest == null)
		return;

	// Handle some browser-specific quirks.
	var scoreboardContainerEl = document.getElementById("scoreboardContainer");
	if (isSafari)
		scoreboardContainerEl.style.width = "100%";
	if (isIE)
	{
		scoreboardContainerEl.style.bottom = "-1px";

		// For IE 6.
		if (window.XMLHttpRequest == null)
		{
			// No fixed positioning support, so do it manually.
			scoreboardContainerEl.style.position = "absolute";
			scoreboardContainerEl.style.bottom = null;
			window.onscroll = repositionScoreboard;
			window.onresize = repositionScoreboard;
		}
	}

	// If we have saved scoreboard data, write it to the display. This will
	// prevent it from being empty while we wait for the first update request
	// to complete.
	var lastData = getCookie("scoreboardData");
	if (lastData != "")
		processScoreboardData(lastData);

	// Show the link to toggle the display.
	var scoreboardTabEl = document.getElementById("scoreboardTab");
	if (scoreboardTabEl == null)
		return;
	scoreboardTabEl.style.visibility = "visible";

	// Check the cookie to see if the user had the scoreboard visible on the
	// previous page.
	if (getCookie("scoreboardOn") == "1")
	{
		// Yes, make it visible now.
		toggleScoreboardDisplay();
	}
	else if (lastData == "")
	{
		// No, and we have no saved data so go ahead and do an update so it
		// will be ready.
		updateScoreboard();
	}
}

// Initialize the scoreboard on page load.
window.addOnloadHandler(scoreboardInit);

//-----------------------------------------------------------------------------
// Called by the interval timer to update the scoreboard.
//-----------------------------------------------------------------------------
function updateScoreboard()
{
	// If no active games were found on the last update, we will wait at least
	// five minutes before making a new request.
	if (scoreboardLastInactiveUpdate != null)
	{
		var currentTime = new Date();
		if (currentTime.valueOf() - scoreboardLastInactiveUpdate.valueOf() < 300000)
			return;
	}

	// Initiate the request.
	try
	{
		scoreboardRequest.get();
	}
	catch(ex)
	{}
}

//-----------------------------------------------------------------------------
// Callback for the scoreboard data request.
//-----------------------------------------------------------------------------
function scoreboardRequestSuccess()
{
	try
	{
		// Save the current time.
		scoreboardLastInactiveUpdate = new Date();

		// Process the data.
		processScoreboardData(scoreboardRequest.responseText);
	}
	catch(ex)
	{}
}

//-----------------------------------------------------------------------------
// Processes the scoreboard data.
//-----------------------------------------------------------------------------
function processScoreboardData(jsonData)
{
	// Fix Jacksonville ID.
	jsonData = jsonData.replace("\"JAC\"", "\"JAX\"");

	// Save the scoreboard data in a cookie.
	setCookie("scoreboardData", jsonData);

	// Parse out the game data.
	var scoresObj;
	eval("scoresObj = " + jsonData);
	scoreboardGames = new Array();
	for (var i = 0; i < scoresObj.ss.length; i++)
		scoreboardGames.push(new ScoreboardGame(scoresObj.ss[i]));

	// Build the display.
	buildScoreboardDisplay();
}

//-----------------------------------------------------------------------------
// Creates the scores display.
//-----------------------------------------------------------------------------
function buildScoreboardDisplay()
{
	// Build the scoreboard HTML.
	var html = "<table cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"top\">";
	for (var i = 0; i < scoreboardGames.length; i++)
	{
		// Add the HTML for the individual game.
		html += "<td" + (i > 0 ? " class=\"leftEdge\"" : "") + ">" + scoreboardGames[i].toHtml() + "<\/td>";

		// If a game is active, clear the last update time.
		if (scoreboardGames[i].isActive)
			scoreboardLastInactiveUpdate = null;
	}

	// Handle the case where no scores are posted.
	if (scoreboardGames.length == 0)
		html += "<td>&nbsp;<br />No scores available.<br />&nbsp;</td>";

	html += "<\/tr><\/table>";

	// Clear any current content.
	var scoreboardEl = document.getElementById("scoreboard");
	while (scoreboardEl.firstChild != null)
		scoreboardEl.removeChild(scoreboardEl.firstChild);

	// Insert the new HTML.
	var divEl = document.createElement("DIV");
	divEl.innerHTML = html;
	scoreboardEl.appendChild(divEl);
}

//-----------------------------------------------------------------------------
// Shows or hides the scoreboard.
//-----------------------------------------------------------------------------
function toggleScoreboardDisplay()
{
	var scoreboardEl = document.getElementById("scoreboard");
	var arrowEl = document.getElementById("scoreboardArrow");

	if (scoreboardEl.style.display == "none")
	{
		// Begin an update request.
		scoreboardLastInactiveUpdate = null;
		updateScoreboard();

		// Show the scoreboard.
		scoreboardEl.style.display = "";
		arrowEl.firstChild.nodeValue = "\u25bc";

		// Fix positioning for IE 6.
		if (isIE && window.XMLHttpRequest == null)
			repositionScoreboard();

		// Set the scoreboard display cookie.
		setCookie("scoreboardOn", "1");

		// Set the interval timer for 30 second updates.
		if (scoreboardInterval == null)
				scoreboardInterval = setInterval(updateScoreboard, 30000);
	}
	else
	{
		// Hide the scoreboard.
		scoreboardEl.style.display = "none";
		arrowEl.firstChild.nodeValue = "\u25b2";

		// Fix positioning for IE 6.
		if (isIE && window.XMLHttpRequest == null)
			repositionScoreboard();

		// Stop the interval timer.
		if (scoreboardInterval != null)
		{
			clearInterval(scoreboardInterval);
			scoreboardInterval = null;
		}

		// Set the scoreboard display cookie.
		setCookie("scoreboardOn", "0");
	}
}

//=============================================================================
// Scoreboard helper functions.
//=============================================================================

//-----------------------------------------------------------------------------
// Sets a cookie with the given name and value.
//-----------------------------------------------------------------------------
function setCookie(name, value, expires)
{
	document.cookie = name + "=" + escape(value) +
		(expires != null ? "; expires=" + expires.toGMTString() : "");
}

//-----------------------------------------------------------------------------
// Returns the value of the given cookie.
//-----------------------------------------------------------------------------
function getCookie(name)
{
	var start = document.cookie.indexOf(name + "=")
	if (start != -1)
	{
		start = start + name.length + 1;
		var end = document.cookie.indexOf(";", start);
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(start, end))
    } 
    return "";
}

//-----------------------------------------------------------------------------
// For IE 6 browsers, repositions the scoreboard display.
//-----------------------------------------------------------------------------
function repositionScoreboard()
{
	// Position the scoreboard at the bottom of the viewport.
	var el = document.getElementById("scoreboardContainer");
	var y = document.documentElement.clientHeight + document.documentElement.scrollTop - el.offsetHeight + 1;
	el.style.top = y + "px";
}

//=============================================================================
// Defines an object for holding game data.
//=============================================================================

//-----------------------------------------------------------------------------
// Constructor.
//-----------------------------------------------------------------------------
function ScoreboardGame(list)
{
	// Get game data.
	this.day      = list[0];	// Game day.
	this.time     = list[1];	// Kickoff time.
	this.status   = list[2];	// "Pregame", "Halftime", "Final", "Final Overtime", "1" - "8".
	this.timeLeft = list[3];	// Time left in quarter/overtime.
	this.vid      = list[4];	// Visitor team ID.
	this.vscore   = list[5];	// Visitor score.
	this.hid      = list[6];	// Home team ID.
	this.hscore   = list[7];	// Home score.
	this.pid      = list[8];	// ID of team with possesion.
	this.redzone  = list[9];	// "0" or "1"
	this.gameId   = list[10];	// Game center ID.
	this.event    = list[11];	// "TD", "FG", "SAF", "INT".
	this.week     = list[12];	// ("PRE0"?,) "PRE1" - "PRE4", "REG1" - "REG17", "POST18" - "POST21".
	this.season   = list[13];	// "2006", "2007", ...

	// Add custom properties.
	this.isActive = false;
	this.isOver   = false;
	this.isOT     = false;

	// Determine the game status.
	switch(this.status.toUpperCase())
	{
		case "PREGAME":
			break;
		case "FINAL":
			this.isOver = true;
			break;
		case "FINAL OVERTIME":
			this.isOver = true;
			this.isOT   = true;
			break;
		default:
			this.isActive = true;
			break;
	}

	// Set the method to generate HTML.
	this.toHtml = ScoreboardGameToHtml;
}

//-----------------------------------------------------------------------------
// Outputs game data to HTML.
//-----------------------------------------------------------------------------
function ScoreboardGameToHtml(showEdge)
{
	var vid    = this.vid;
	var hid    = this.hid;
	var vpos   = "";
	var hpos   = "";
	var vscore = "&nbsp;";
	var hscore = "&nbsp;";
	var status = "";
	var vclass = "";
	var hclass = "";

	// Get the scores, if available.
	if (this.isActive || this.isOver)
	{
		vscore = parseInt(this.vscore);
		hscore = parseInt(this.hscore);
	}

	// Determine the game's status.
	if (this.isOver)
	{
		// Game is over, highlight the winner.
		if (vscore > hscore)
		{
			vid    = scoreboardHighlightText(vid);
			vscore = scoreboardHighlightText(vscore);
		}
		if (hscore > vscore)
		{
			hid    = scoreboardHighlightText(hid);
			hscore = scoreboardHighlightText(hscore);
		}
		status = "Final" + (this.isOT ? "-OT" : "");
	}
	if (this.isActive)
	{
		// Game is underway, show current situation.
		if (this.status.toUpperCase() == "HALFTIME")
		{
			// Game is at halftime.
			status = "Half";
		}
		else
		{
			// Mark the team with possession and set a style class attribute
			// if they are in the red zone.
			if (this.vid == this.pid)
			{
				vid += scoreboardHighlightText("&#9642;");
				if (this.redzone == "1")
					vclass = " class=\"redzone\"";
			}
			if (this.hid == this.pid)
			{
				hid += scoreboardHighlightText("&#9642;");
				if (this.redzone == "1")
					hclass = " class=\"redzone\"";
			}

			// Use the quarter and time remaining as the status.
			var quarter = "";
			switch (this.status)
			{
				case "1":
					quarter = "1st";
					break;
				case "2":
					quarter = "2nd";
					break;
				case "3":
					quarter = "3rd";
					break;
				case "4":
					quarter = "4th";
					break;
				default:
					quarter = "OT";
					break;
			}
			status = this.timeLeft + " " + quarter;
		}
	}
	if (!this.isActive && !this.isOver)
	{
		// Game has not started, show game day and start time.
		status = this.day + " " + this.time;
	}

	// Build and return the HTML.
	var html = "<table cellpadding=\"0\" cellspacing=\"0\">";
	html += "<tr" + vclass + " valign=\"top\"><td>" + vid + "<\/td><td align=\"right\">" + vscore + "<\/td><\/tr>";
	html += "<tr" + hclass + " valign=\"top\"><td>" + hid + "<\/td><td align=\"right\">" + hscore + "<\/td><\/tr>";
	html += "<tr valign=\"top\"><td align=\"center\" colspan=\"2\">" + status + "<\/td><\/tr>";
	html += "<\/table>";
	
	return html;
}

//-----------------------------------------------------------------------------
// Wraps the given text in a span with the highlight class.
//-----------------------------------------------------------------------------
function scoreboardHighlightText(s)
{
	// Wrap the given string in a SPAN to highlight it.
	return "<span class=\"highlight\">" + s + "<\/span>";
}

//=============================================================================
// Defines a cross-browser XMLHttpRequest object.
//=============================================================================

// Define constants.
XHR.prototype.READY_STATE_UNINITIALIZED = 0;
XHR.prototype.READY_STATE_LOADING       = 1;
XHR.prototype.READY_STATE_LOADED        = 2;
XHR.prototype.READY_STATE_INTERACTIVE   = 3;
XHR.prototype.READY_STATE_COMPLETED     = 4;

// Define properties.
XHR.prototype.successCallback = null;
XHR.prototype.failureCallback = null;
XHR.prototype.url             = null;
XHR.prototype.username        = null;
XHR.prototype.password        = null;
XHR.prototype.requestHeaders  = new Array();
XHR.prototype.status          = null;
XHR.prototype.statusText      = null;
XHR.prototype.responseXML     = null;
XHR.prototype.responseText    = null;

// Define methods.
XHR.prototype.abort                 = XHRAbort;
XHR.prototype.setRequestHeader      = XHRSetRequestHeader;
XHR.prototype.clearRequestHeaders   = XHRClearRequestHeaders;
XHR.prototype.get                   = XHRGet;
XHR.prototype.post                  = XHRPost;
XHR.prototype.getResponseHeader     = XHRGetResponseHeader;
XHR.prototype.getAllResponseHeaders = XHRGetAllResponseHeaders;
XHR.prototype.initiateRequest       = XHRInitiateRequest;

//-----------------------------------------------------------------------------
// Contructor.
//-----------------------------------------------------------------------------
function XHR()
{
	// Create an XMLHttpRequest object.
	this.xmlHttpRequest = null;
	try
	{
		// Standard XMLHttpRequest object.
		this.xmlHttpRequest = new window.XMLHttpRequest();
		return;
	}
	catch (ex)
	{}
	try
	{
		// Microsoft XMLHttpRequest object.
		this.xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		return;
	}
	catch (ex)
	{}
	try
	{
		// Microsoft XMLHttpRequest object.
		this.xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		return;
	}
	catch (ex)
	{}
}

//-----------------------------------------------------------------------------
// XHR Methods.
//-----------------------------------------------------------------------------

function XHRAbort()
{
	this.xmlHttpRequest.abort();
}

function XHRSetRequestHeader(name, value)
{
	// If the header name already exists, replace the value.
	for (var i = 0; i < this.requestHeaders.length; i++)
	{
		var pair = this.requestHeaders[i].split("\n");
		if (pair[0].toLowerCase() == name.toLowerCase())
		{
			this.requestHeaders[i] = name + "\n" + value;
			return;
		}
	}

	// Otherwise, add it as a new item.
	var n = this.requestHeaders.length;
	this.requestHeaders.push(name + "\n" + value);
}

function XHRClearRequestHeaders()
{
	this.requestHeaders = new Array();
}

function XHRGet()
{
	this.initiateRequest("GET", null);
}

function XHRPost(data)
{
	this.initiateRequest("POST", data);
}

function XHRGetResponseHeader(name)
{
	return this.xmlHttpRequest.getResponseHeader(name);
}

function XHRGetAllResponseHeaders()
{
	return this.xmlHttpRequest.getAllResponseHeaders();
}

//-----------------------------------------------------------------------------
// Internal XHR method to make the actual request.
//-----------------------------------------------------------------------------
function XHRInitiateRequest(method, data)
{
	// For IE, abort any current request.
	if (isIE)
		this.abort();

	// Clear all response fields.
	this.status       = null;
	this.statusText   = null;
	this.responseText = null;
	this.responseXML  = null;

	// Set up the callback functions.
	var refObj = this;
	this.xmlHttpRequest.onreadystatechange =
		function()
		{
			try
			{
				refObj.readyState = refObj.xmlHttpRequest.readyState
				if (refObj.readyState == XHR.prototype.READY_STATE_COMPLETED)
				{
					refObj.status       = refObj.xmlHttpRequest.status;
					refObj.statusText   = refObj.xmlHttpRequest.statusText;
					refObj.responseText = refObj.xmlHttpRequest.responseText;
					refObj.responseXML  = refObj.xmlHttpRequest.responseXML;
					if (refObj.status == 200)
					{
						if (refObj.successCallback != null)
							refObj.successCallback(refObj);
					}
					else
					{
						if (refObj.failureCallback != null)
							refObj.failureCallback(refObj);
					}
				}
			}
			catch(ex)
			{}
		}

	// Initialize the request.
	var url = this.url;
	if (this.queryString != null)
		url = url + "?" + this.queryString;
	this.xmlHttpRequest.open(method, url, true, this.username, this.password);

	// Set request headers (this must be done after the request is opened).
	for (var i = 0; i < this.requestHeaders.length; i++)
	{
		var pair = this.requestHeaders[i].split("\n");	
		this.xmlHttpRequest.setRequestHeader(pair[0], pair[1]);
	}

	// Start the request, passing any POST data.
	this.xmlHttpRequest.send(data);
}
/* [SCORES MOD END] */

