MBT.API.ApiId = "cb85f16122d2deb28e3a6948c2658492a37ed1d2";
var WIDGET_DEFAULT_LEAGUE = 230;
var WIDGET_DEFAULT_SEASON = 312;
var WIDGET_DEFAULT_LANG = 'de';

var WIDGET_LEAGUE_ID = null;
var WIDGET_SEASON_ID = null;
var WIDGETS_HOST_ROOT_URL = "http://www.oebl.at/staticsite/staticsite.php?";


MBT.API.History.enabled = false;

if (MBT.API.URL.CurrentQueryString.get("season_id")) {
	WIDGET_SEASON_ID = MBT.API.URL.CurrentQueryString.get("season_id");
} else {	
	if (MBT.API.URL.CurrentQueryString.get("league_id")) {
		WIDGET_LEAGUE_ID = MBT.API.URL.CurrentQueryString.get("league_id");
	} else {
		WIDGET_LEAGUE_ID = WIDGET_DEFAULT_LEAGUE;
	}	
}

MBT.API.Lang = WIDGET_DEFAULT_LANG;


handlePlayerClick = function (playerId) {
	var leagueSeasonStr = "";
	
	if (WIDGET_SEASON_ID) {
		leagueSeasonStr += "&season_id=" + WIDGET_SEASON_ID;
	}
	
	if (WIDGET_LEAGUE_ID) {
		leagueSeasonStr += "&league_id=" + WIDGET_LEAGUE_ID;
	}
	
	document.location.href = WIDGETS_HOST_ROOT_URL + "menuid=301&topmenu=2&player_id=" + playerId +  leagueSeasonStr;
}

handleGameClick = function (gameId) {
	var leagueSeasonStr = "";
	
	if (WIDGET_SEASON_ID) {
		leagueSeasonStr += "&season_id=" + WIDGET_SEASON_ID;
	}
	
	if (WIDGET_LEAGUE_ID) {
		leagueSeasonStr += "&league_id=" + WIDGET_LEAGUE_ID;
	}
	document.location.href = WIDGETS_HOST_ROOT_URL + "menuid=298&topmenu=2&game_id=" + gameId +  leagueSeasonStr;
}


handleTeamClick = function (teamId) {	
	var leagueSeasonStr = "";
	
	if (WIDGET_SEASON_ID) {
		leagueSeasonStr += "&season_id=" + WIDGET_SEASON_ID;
	}
	
	if (WIDGET_LEAGUE_ID) {
		leagueSeasonStr += "&league_id=" + WIDGET_LEAGUE_ID;
	}
	document.location.href = WIDGETS_HOST_ROOT_URL + "menuid=299&topmenu=2&team_id=" + teamId +  leagueSeasonStr;
}

handleSeasonClick = function (seasonId) {	
	document.location.href = WIDGETS_HOST_ROOT_URL + "menuid=2&topmenu=2&season_id=" + seasonId;
}

handleLeagueClick = function (leagueId) {	
	document.location.href = WIDGETS_HOST_ROOT_URL + "menuid=2&topmenu=2&league_id=" + leagueId;
}

handleSeasonChange = function (seasonId) {	
	document.location.href = document.location.href + "&season_id=" + seasonId;
}