/*

AT - 19 Nov 2002 - modified jumpURL() to take javascript functions
AT - 27 May 2003 - modified OpenWindow() to take status bar variable
AT - 29 May 2003 - modified OpenWindow() to take menubar variable
AT - 30 Jul 2004 - added SAFC to videolounge common code
AT - 11 Feb 2005 - modified videolounge code to go to root for spurs WR050211-TO-01
*/

function matchreport(fxid) 
{
	// open the generic match report template for each site.
	window.open('/commonfiles/matchreport/index.asp?fix=' + fxid, fxid, 'resizable=no,scrollbars=yes,width=637,height=550,screenX=0,screenY=0,top=0,left=0');
}

function scorecentre()
{ 
	//open the generic live scorecentre
	window.open('http://www.planetfootball.com/soccerscore/test.htm', "scorecentre", 'resizable=no,scrollbars=no,width=445,height=525,screenX=0,screenY=0,top=0,left=0') ;
}

function pfbscorecentre()
{ 			
	// open the planetfootball only scorecentre with a link back to planetfootball.com
	window.open('http://www.planetfootball.com/soccerscore/pfb.htm', "scorecentre", 'resizable=no,scrollbars=no,width=445,height=525,screenX=0,screenY=0,top=0,left=0') ;
}

function Homepage()
{
	// generic microsoft function used on all error pages
	DocURL = document.URL;
	protocolIndex=DocURL.indexOf("://",4);
	serverIndex=DocURL.indexOf("/",protocolIndex + 3);
	BeginURL=DocURL.indexOf("#",1) + 1;
	urlresult=DocURL.substring(BeginURL,serverIndex);
	displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
	document.write( '<A HREF="/">' + displayresult + "</a>");
}

function VideoLounge()
{
	window.open('/log_vl.asp', 'clipwin', 'width=770,height=500,resizable=no,scrollbars=no,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function videolounge()
{
	window.open('/log_vl.asp', 'clipwin', 'width=770,height=500,resizable=no,scrollbars=no,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function videoloungelogin()
{
	window.open('/log_vl_login.asp', 'clipwin', 'width=770,height=500,resizable=no,scrollbars=no,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function videolounge2()
{
	window.open('/log_vl2.asp', 'clipwin', 'width=770,height=500,resizable=no,scrollbars=no,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function qandapop()
{
	window.open('/questionnaire/index.asp', 'clipwin', 'width=635,height=410,resizable=no,scrollbars=yes,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function qandapop2()
{
	window.open('/qanda/index.asp', 'clipwin', 'width=635,height=410,resizable=no,scrollbars=yes,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function qandapop3()
{
	window.open('/foodsurvey.asp', 'clipwin', 'width=635,height=410,resizable=no,scrollbars=yes,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

function LoadTeamTeaser()
{
	location.href="http://www.planetfootball.com/fungames.asp?article=79434";
}

//=========================================================

function OpenWindow()
{

	// order of arguments:
	// PageToLoad,Width,Height,ScollBars,Resizable,WindowName,Status,MenuBar,top,left
	//
	// scrollbars(yes/no),resizable(yes/no),status(yes/no)
	// PageToLoad is mandatory, all other optional


	var PageToLoad = arguments[0];
	var Width = arguments[1];
	var Height = arguments[2];
	var ScollBars = arguments[3];
	var Resizable = arguments[4];
	var WindowName = arguments[5];
	var Status = arguments[6];
	var MenuBar = arguments[7];
	var intTop = arguments[8];
      var intLeft = arguments[9];
	var WindowVars = "";


	Width = ( (""+Width) == "undefined" || Width=="" || (""+Width) == "0" ) ? "640" : Width;
	Height = ( (""+Height) == "undefined" || Height=="" || (""+Height) == "0" ) ? "400" : Height;
	ScrollBar = ( (""+ScollBars) == "undefined" || ScollBars=="" ) ? "yes" : ScollBars;
	Resize = ( (""+Resizable) == "undefined" || Resizable=="" ) ? "yes" : Resizable;
	Status = ( (""+Status) == "undefined" || Status=="" ) ? "no" : Status;
	MenuBar = ( (""+MenuBar) == "undefined" || MenuBar=="" ) ? "no" : MenuBar;
	intTop = ( (""+intTop) == "undefined" || intTop=="" || (""+intTop) == "0" ) ? "0" : intTop;
	intLeft = ( (""+intLeft) == "undefined" || intLeft=="" || (""+intLeft) == "0" ) ? "0" : intLeft;		
	WindowVars = "width="+Width+",height="+Height+",scrollbars="+ScrollBar+",resizable="+Resize+",status="+Status+",menubar="+MenuBar+",top="+intTop+",left="+intLeft+",toolbar=no,location=no,directories=no,titlebar=no";
	WindowName = ( (""+WindowName) == "undefined" || WindowName=="" ) ? "_blank" : WindowName;
	PopUpWindow = window.open(PageToLoad,WindowName,WindowVars);
}

//=========================================================

function BrowserInfo()
{
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns6=(this.dom && parseInt(this.ver) >= 5 && parseInt(this.ver) < 7)?1:0;
	this.ns7=(this.dom && parseInt(this.ver) >= 7 && parseInt(this.ver) < 8)?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.w3c=(this.ie5 || this.ie6 || this.ns6);
	this.ie=(this.ie4 || this.ie5 || this.ie6);
	this.ns=(this.ns4 || this.ns6);
	this.bw=(this.ie4 || this.ie5 || this.ie6 || this.ns4 || this.ns6);
	this.dhtml=(this.ie || this.ns7);
	return this;
}

var UserBrowser = new BrowserInfo();

//=========================================================

function jumpURL(selection)
{
	var tempIndex, selectedURL;
	//get the index of the chosen link
	tempIndex = selection.selectedIndex;
	//get the value of the selected index
	selectedURL = selection.options[tempIndex].value;
	
	if(selectedURL == "-1")
	{
		alert("Please make a selection!");
		//document.selection.focus();
		return false;
	}
	else 
	{
		//alert(selectedURL.indexOf("javascript:") + ", " + selectedURL.substring(11));
		
		if(selectedURL.indexOf("javascript:")>-1)
		{
			eval(selectedURL.substring(11));
		}
		else
			window.top.location.href = selectedURL;
	}
	
}

//=========================================================
function videoloungeEntry()
{

  //alert(document.domain);
  var strDomain = document.domain;
  var strPath = "";
  var strQS = "";
  if(strDomain.indexOf("safc") > -1 ) {
    strPath = "http://safc.videoloungetv.com";
    strQS = "/do/preLogin?clubSiteCode=SAFC"; 
  } 
    else if (strDomain.indexOf("mcfc") > -1) {
    strPath = "http://mcfc.videoloungetv.com";
    strQS = "/do/preLogin?clubSiteCode=MCFC";
  } 
    else if (strDomain.indexOf("saintsfc") > -1) {
    strPath = "http://saintsfc.videoloungetv.com";
    strQS = "/do/preLogin?clubSiteCode=SAINTSFC";
  }
  	
    else if (strDomain.indexOf("leedsunited") > -1) {
    strPath = "http://lufc.videoloungetv.com";
    strQS = "/do/preLogin?clubSiteCode=LUFC";
  }
    else if (strDomain.indexOf("spurs") > -1) {
    strPath = "http://spurs.videoloungetv.com";
    strQS = "/do/preLogin?clubSiteCode=SPURS";
  }
	
 
  if(strPath != "") {
      //found a site
      var strArea = arguments[0];
      var strCode = "";
      
      switch (strArea) {
      case "splashpage":
        strCode = "AFC-001";
        break;
      case "article":
        strCode = "AFC-002";
        break;
      case "banner":
        strCode = "AFC-003";
        break;	
      case "navigation":
        strCode = "AFC-004";
        break;
      case "advert":
        strCode = "AFC-005";
        break;
      }
      
      if(strCode != "" && strQS!="" ) {
        strPath = strPath + strQS + "&CMP=" + strCode;
      } 
      else if (strCode != "" ) {
        strPath = strPath + "?CMP=" + strCode;
      } 
      else if (strQS != "" ) {
        strPath = strPath + strQS;
      } 
      
  } else {  
      strPath = "/log_vl.asp";
      //alert(strPath);	
  }
  
  //alert("strPath = " + strPath);
  window.open(strPath, 'clipwin', 'width=770,height=500,resizable=no,scrollbars=no,toolbar=no,menubar=no,statusbar=no,locationbar=no');
}

//=========================================================

function surfto(url) {
/*
       var myindex=form.select1.selectedIndex
       if (form.select1.options[myindex].value != "0") {
        document.location.href=form.select1.options[myindex].value;}
*/
if (url != '0') {document.location.href = url};
}
