var teamsMap = {
	"COL" : "avalanche", "CHI" : "blackhawks", "CBJ" : "bluejackets", "STL" : "blues", "BOS" : "bruins", "MTL" : "canadiens",
	"VAN" : "canucks", "WSH" : "capitals", "PHX" : "coyotes", "NJD" : "devils", "ANA" : "ducks", "CGY" : "flames",
	"PHI" : "flyers", "CAR" : "hurricanes", "NYI" : "islanders", "LAK" : "kings", "TBL" : "lightning", "TOR" : "mapleleafs",
	"EDM" : "oilers", "FLA" : "panthers", "PIT" : "penguins", "NSH" : "predators", "NYR" : "rangers", "DET" : "redwings",
	"BUF" : "sabres", "OTT" : "senators", "SJS" : "sharks", "DAL" : "stars", "ATL" : "thrashers", "MIN" : "wild"
};

var teamsAbbrevMap = {
	"avalanche" : "COL", "blackhawks" : "CHI", "bluejackets" : "CBJ", "blues" : "STL", "bruins" : "BOS", "canadiens" : "MTL",
	"canucks" : "VAN", "capitals" : "WSH", "coyotes" : "PHX", "devils" : "NJD", "ducks" : "ANA", "flames" : "CGY",
	"flyers" : "PHI", "hurricanes" : "CAR", "islanders" : "NYI", "kings" : "LAK", "lightning" : "TBL", "mapleleafs" : "TOR",
	"oilers" : "EDM", "panthers" : "FLA", "penguins" : "PIT", "predators" : "NSH", "rangers" : "NYR", "redwings" : "DET",
	"sabres" : "BUF", "senators" : "OTT", "sharks" : "SJS", "stars" : "DAL", "thrashers" : "ATL", "wild" : "MIN"
	};

var teamsNameMap = {
	"avalanche" : "Colorado Avalanche", "blackhawks" : "Chicago Blackhawks", "bluejackets" : "Columbus Blue Jackets", "blues" : "St. Louis Blues", "bruins" : "Boston Bruins", "canadiens" : "Montreal Canadiens",
	"canucks" : "Vancouver Canucks", "capitals" : "Washington Capitals", "coyotes" : "Phoenix Coyotes", "devils" : "New Jersey Devils", "ducks" : "Anaheim Ducks", "flames" : "Calgary Flames",
	"flyers" : "Philadelphia Flyers", "hurricanes" : "Carolina Hurricanes", "islanders" : "New York Islanders", "kings" : "Los Angeles Kings", "lightning" : "Tampa Bay Lightning", "mapleleafs" : "Toronto Maple Leafs",
	"oilers" : "Edmonton Oilers", "panthers" : "Florida Panthers", "penguins" : "Pittsburgh Penguins", "predators" : "Nashville Predators", "rangers" : "New York Rangers", "redwings" : "Detroit Red Wings",
	"sabres" : "Buffalo Sabres", "senators" : "Ottawa Senators", "sharks" : "San Jose Sharks", "stars" : "Dallas Stars", "thrashers" : "Atlanta Thrashers", "wild" : "Minnesota Wild"	
}

function podcastPlayer(url) {
	if (url == null) return;
	var win = window.open(url,"podcastPlayer","resizable=yes,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=485,height=225");
	if(win!=null)
		win.focus();
}

function mediaGalleryPlayer(url) {
	if (url == null) return;
	var win = window.open(url,"mediaGalleryPlayer","resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,width=755,height=800");
	if(win!=null)
		win.focus();
}

function realTimeSB(url, name) {
	if (url == null || name == null) return;
	var win = window.open(url,name,"width=428,height=228,resizable=no,location=no,menubar=no,scrollbars=auto,status=yes,toolbar=no,fullscreen=no,dependent=no");
	if(win!=null)
		win.focus();
}

function printPage(url) {
	if (url == null) return;
	var win = window.open(url,"printpage","resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,width=708,height=800");
	if(win!=null)
		win.focus();
}

function printStatsPage(url) {
	if (url == null) return;
	var win = window.open(url,"printpage","resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,width=972px,height=800");
	if(win!=null)
		win.focus();
}

function podcastPlayer(url) {
	if (url == null) return;
	var win = window.open(url,"podcastPlayer","resizable=yes,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=485,height=225");
	if(win!=null)
		win.focus();
}

function playDLVideo(caption,src) {
	if (swfobject != null) swfobject.getObjectById("nhl").playVideo(caption, src);
}

function livePlayer(url) {
	if (url == null) return;
	var win = window.open(url,"livePlayer","resizable=yes,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=650,height=260");
	if(win!=null)
		win.focus();
}

function gameCenterLive(url) {
	if (url == null) return;
	var win = window.open(url,"nhlgcconsole","scrollbars=yes,menubar=no,height=698,width=1010,top=0,left=0,resizable=yes,toolbar=no,location=no,status=no");
	if(win!=null)
		win.focus();
}

function toggleCommentView(divId, linkElementId, hiddenLabel, showLabel) {
	jQuery('#' + divId).slideToggle("slow", toggleLabel(divId, linkElementId, hiddenLabel, showLabel));							
}

function toggleLabel(divId, linkElementId, hiddenLabel, showLabel) {
	if (jQuery('#' + divId).is(":hidden")) {
		var state = showLabel;
    } else {
    	var state = hiddenLabel;
    } 
	jQuery('#' + linkElementId).html(state);
}

function showModal(ajaxUrl, posA, posB) {
	jQuery.post(ajaxUrl, {}, function(data) { jQuery('#basicModalContent').html(data); }, 'html');
	jQuery('#basicModalContent').modal({
		position : [posA, posB],
		dataCss : { 'padding' : '0px' },
		zIndex: 1000001
	});
}
function toggleStatsReports(id) {
	jQuery("#" + id).toggle();
}
function closeModalIfVisible() {
	if(jQuery.modal) { jQuery.modal.close(); }
}

jQuery(document).bind('keydown',function(e){if(e.keyCode==27){
	if(jQuery.modal) { jQuery.modal.close(); } 
	jQuery('#rfanLoginBubble').hide(); 
}
});
