//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function popup(win_url,win_handle,x,y) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href=win_url;
	else
	{
   winhandle=window.open(win_url,win_handle,"menubar=no,resizable=yes,scrollbars=yes,status=no,width=" + x + ",height=" + y);   
   winhandle.focus();
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function profile(UID) 
{
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href="../locker/profile.asp?uid=" + escape(UID);
	else
		window.open("../locker/profile.asp?uid=" + UID,"profile","menubar=no,scrollbars=no,status=no,width=508,height=398,resizable=no");
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function playerstats(TeamID) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href="stats.asp?teamid=" + TeamID;
	else
	{
   winhandle=window.open("stats.asp?teamid=" + TeamID,"teaminfo","menubar=no,scrollbars=yes,status=no,width=700,height=440,resizable=yes");
   winhandle.focus();
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function playerprofile(tid, pid) {
	popupwin=window.open("indiv_player.asp?tid=" + tid +"&pid=" + pid,"popupwin","menubar=no,scrollbars=yes,status=no,width=600,height=450");
	popupwin.focus();
	if (!popupwin.opener)
	      popupwin.opener = self; 
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function scoreboard(LeagueID, DisplayDate, TimeofGame) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href="scoreboard.asp?leagueid=" + LeagueID + "&date=" + DisplayDate + "&ampm=" + TimeofGame;
	else
	{
   winhandle=window.open("scoreboard.asp?leagueid=" + LeagueID + "&date=" + DisplayDate + "&ampm=" + TimeofGame,"leaguescores","menubar=no,scrollbars=yes,status=no,width=655,height=500");
   winhandle.focus();
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function leaders(LeagueID) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href="stats/" + LeagueID + ".asp";
	else
	{
   winhandle=window.open("stats/" + LeagueID + ".asp","leaders","menubar=no,scrollbars=yes,status=no,width=550,height=440");
   winhandle.focus();
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ir(InjuryID) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href="ir.asp?injuryid=" + InjuryID;
	else
	{
   window.open("ir.asp?injuryid=" + InjuryID,InjuryID,"menubar=no,scrollbars=no,status=no,width=410,height=180,resizable=no");
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function boxscore(GameID,TeamFee) 
{
   window.open("../nhl/boxscore.asp?GameID=" + GameID + "&teamfee=" + TeamFee,"boxscore","menubar=no,scrollbars=yes,status=no,width=720,height=550,resizable=yes");
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function pbp(qtr, GameID, TeamFee) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href="pbp.asp?gameid=" + GameID + "&period=" + qtr + "&teamfee=" + TeamFee;
	else
	{
		winhandle=window.open("../nhl/pbp.asp?gameid=" + GameID + "&period=" + qtr + "&teamfee=" + TeamFee,"nhlpbp","menubar=no,scrollbars=yes,status=no,width=620,height=470");
		winhandle.focus();
	}
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function SwitchTeams(NewTeamID) 
{
	var pageUrl = window.location.pathname.split('/');
	
	document.getElementById('pageName').value = pageUrl[pageUrl.length-1];
	document.switchTeams.submit();
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ValidateNote()
{
  if (document.frmnotes.note.value.length > 250)
  {
    alert("Note is " + (document.frmnotes.note.value.length - 250) + " characters too long. 250 characters max.");
    document.frmnotes.note.focus();
    return (false);
  }
  
  if (document.frmnotes.note.value.indexOf('<') > -1)
  {
    alert("Invalid character '<' in note.");
    document.frmnotes.note.focus();
    return (false);
  }
  
  document.frmnotes.submit();
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ShowObj(ObjID, CookieID) {
	var obj = document.all ? document.all[ObjID] :
			document.getElementById ? document.getElementById(ObjID) : null;
	var cookievar = document.all ? document.all[CookieID] :
			document.getElementById ? document.getElementById(CookieID) : null;
		
	obj.style.display='block';
	cookievar.value=1;		
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function HideObj(ObjID, CookieID) {
	var obj = document.all ? document.all[ObjID] :
			document.getElementById ? document.getElementById(ObjID) : null;
	var cookievar = document.all ? document.all[CookieID] :
			document.getElementById ? document.getElementById(CookieID) : null;
		
	obj.style.display='none';
	cookievar.value=0;		
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function printme() {
   window.print();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function faq(ArticleID) 
{
	if (ArticleID != "")
	{
		window.open("../knowledgebase/KB_Article_Details.aspx?kbid="+ArticleID,"faq","menubar=no,scrollbars=yes,status=no,width=800,height=600,resizable=yes");
	}
	else
	{
		window.open("../knowledgebase/KnowledgeBase.aspx?pid=10","faq","menubar=no,scrollbars=yes,status=no,width=800,height=600,resizable=yes");
	}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function showDiv(layerName) {
	document.getElementById(layerName).style.display="block";
} 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function hideDiv(layerName) {
	document.getElementById(layerName).style.display="none";
} 
