var premium = false;
var fileid;
var mirrorid;
var premium;
var bgcolor;
var root;
var mirrorlocation;
var mirrorserver;
var mirrorlink;
var mirrorname;
var downloadlink;
var redirUrl;
var winName;
var maxline = 9999;

var sortid;

var x = 0;	//var holds how many sub servers are displayed. If zero display CDN.

var y = 0; //How many servers evaluated on the page

var numDedicated = 0;
var numPartial = 0;
var numComplete = 0;

var win;

function fileWindow(link, windowname)
{
	if (!isLoginRequired || !isLoginOverlayEnabled) {
		if ( !isArcade ) { 
			window.open(link, windowname, 'height=328,width=600,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=no'); 
		} else {
			document.location = link;
		}
	} else {
	    initLoginOverlay();
	    loginOverlay.showUpsell();
	    isShowOnloadEnabled = false;
	}
	return false; 
}

function winClose()
{
    mywindow.close();
}

function fileWindowNull(link, windowname)
{
    
	if ( !isArcade )
	{
		window.open(link, windowname, 'height=1,width=1,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=no');
	}
	else
	{
		document.location = link;
	}
	return false; 
}

var serverType =
{
	Dedicated : 1,
	Partial : 2,
	Complete : 3,
	CDN : 4
}


function printLink()
{
	y++;
	if (present)
	{
		x++;
		if ( sortid == 1 )
			numDedicated++;	
		if ( sortid == 2 )
			numPartial++;
		if ( sortid == 3 )
			numComplete++;
	}
}


function printPubMirror()
{
	document.write("<table class=\"server_c\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
	document.write("<tr class=\"toprow\">");
	document.write("	<td class=\"col1\"><strong>"  + mirrorlocation + "</strong><br/>");
	document.write("</td>");
	document.write("	<td class=\"col2\"><a onClick=\"javascript:urchinTracker('/downloadpage/nonsub/C/queue_button');\" onmouseover=\"window.status='Download!';return true;\" onmouseout=\"window.status='';\" href=\"javascript:void(fileWindow('" + redirUrl + "', winName));\"><img src=\"/_img/download/queue_rounded.gif\" width=\"122\" height=\"21\" border=\"0\" alt=\"Queue File\" /></a><br/>");
	if ( waittime > 0)
	{
		document.write("<strong>");	
		document.write(( waittime == 1 ) ? waittime + " minute" : waittime);
		document.write("</strong> minutes</td>");	
	}
	else
		document.write("Wait Time: <strong>None</strong></td>");
	document.write("	<td class=\"col3\"><a onClick=\"javascript:urchinTracker('/downloadpage/nonsub/C/download_button_redirect');\" href=\"http://subscribe.igngamespy.com\"><img src=\"/_img/download/dl_red_rounded.gif\" width=\"135\" height=\"21\" border=\"0\" alt=\"Subscribe Now\" /></a><br/>");
	document.write("No Waiting for Subscribers</td>");
	document.write("</tr>");
	document.write("</table>");
}




function printSubMirror()
{	
	document.write("<table class=\"pserver_c\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
	document.write("<tr class=\"toprow\">");
	document.write("	<td class=\"col1\">" + mirrorlocation + "</td>");
	document.write("	<td rowspan=\"2\" class=\"col2\"><a onClick=\"javascript:urchinTracker('/downloadpage/sub/C/download_button');\" onmouseover=\"window.status='Download!';return true;\" onmouseout=\"window.status='';\" href=\"javascript:void(fileWindow('" + redirUrl + "', winName));\"><img src=\"/_img/download/dl_red_rounded.gif\" width=\"135\" height=\"21\" border=\"0\" alt=\"Download Now\" /></a></td>");
	document.write("</tr>");
	document.write("</table>");
}





function printCDNLink() 
{
	document.write("<table class=\"pserver\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
	document.write("<tr class=\"toprow\">");
	document.write("	<td class=\"col1\">Servicing:</td>");
	document.write("	<td class=\"col2\">" + mirrorlocation + "</td>");
	document.write("	<td rowspan=\"2\" class=\"col3\"><a onmouseover=\"window.status='Download!';return true;\" onmouseout=\"window.status='';\" href=\"javascript:void(fileWindow('" + redirUrl + "', winName));\"><img src=\"/_img/download/dl_red.jpg\" width=\"135\" height=\"21\" border=\"0\" alt=\"Download Now\" /></a></td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("	<td class=\"col1\">Wait Time:</td>");
	document.write("	<td><img src=\"/_img/download/nowait.jpg\" width=\"207\" height=\"14\" border=\"0\" alt=\"\" /></td>");
	document.write("</tr>");
	document.write("</table>");
}









