//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ReloadWindow() {
    window.location.href = window.location.href;    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function CloseWindow() {
    window.close();    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height) {
    OpenWindow(url, name, height, width, false);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height, enableScrollbars) {
    OpenWindow(url, name, height, width, enableScrollbars, false);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height, enableScrollbars, resizable) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href=url;
	else
	{
		winhandle=window.open(url, name, "width=" + width + ",height=" + height + ",scrollbars=" + GetWindowBoolString(enableScrollbars) + ",resizable=" + GetWindowBoolString(enableScrollbars) + ",status=no,menubar=no");
		winhandle.focus();
	}
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function GetWindowBoolString(value) {
    if(value) 
        return "yes";
    else
        return "no";   
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenPlayerProfile(playerid, prospect, playoffTeam, initialStatType) 
{
	OpenWindow("../mlb-l/PlayerProfile.asp?ID=" + playerid + "&pr=" + prospect + "&pl=" + playoffTeam + "&type=" + initialStatType, "playerprofile_" + playerid, 770, 550);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenPlayerDraftProfile(PlayerID)
{
	OpenWindow("../mlb-l/profile_player.asp?pid=" + PlayerID, "profile", 830, 700, true, true);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenTeamProfile(teamid) {
    OpenWindow("../mlb-l/playerstats.asp?teamid=" + teamid, "pstats", 743, 550, true);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenTeamDraftProfile(HistoricFranchiseID, Season) {
    OpenWindow("../mlb-l/player_draft_team.asp?hfid=" + HistoricFranchiseID + "&Season=" + Season & " &ad=0&inf=1", "tdstats", 830, 700, true, true);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenUserProfile(uid) 
{
    OpenWindow("../locker/profile.asp?uid=" + uid,"profile", 508, 398);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenBoxscore(GameID, ProductID) 
{
    OpenWindow("Boxscore.aspx?gid=" + GameID + "&pid=" + ProductID, "boxscore_" + GameID, 773, 550, true);
}

function OpenSupport()
{
	window.open("http://www.whatifsports.com/knowledgebase/SubmitTicket.aspx");
}
function ViewDebugInfo(Team, GameID, ProductTag) 
{
	if (Team == 0)
	{
		document.location	= "Boxscore.aspx?gid=" + GameID + "&pid=" + ProductTag + "&dbaway=1";
	}
	else if (Team == 1)
	{
		document.location	= "Boxscore.aspx?gid=" + GameID + "&pid=" + ProductTag + "&dbhome=1";
	}
} 

