// ************************************************************************************************************************
// ****************************       WEBRADIO PLAYER-SCRIPT FOR MTG RADIO V1.0      **************************************
// ************************************************************************************************************************
// 
// This functions opens a popup-window containing the web player for one of MTG Radios online radio stations.
//
// This function can be called using a HTML href-element or a HTML input-button. 
// When calling the function you need to use 1 string-parameter, the strStation-parameter which decides which 
// stations web player to show. The current available parameter values are:
// 		
// 			- lugna,lugnafavoriter opens Lugna Favoriters web player
// 			- rix,rixfm opens RIX FMs web player
// 			- nrj opens NRJ Swedens web player
// 			- bandit opens Bandits web player
// 			- svenska,svenskafavoriter opens Svenska Favoriters web player
// 
// 			NOTE: all the parameter values are case sensitive which means that you most use lowercase chars.

//
// Code example for calling using a href-element:
// 
// <a href="javascript:openPlayer('rixfm')">Open Web player</a>
// 
// 
// Code example for calling using a button.
// 
// <input id="btWebplayer" type="button" value="Open Web player" onclick="openPlayer('rixfm')">
// 
// 
// Changelog for WEBRADIO PLAYER-SCRIPT
// V 1.0 - First release by Markus Johansson
// 
// For support, please contact: webguru@mtgradio.com
// *******************************************************************************************************************


function openPlayer(strStation) {
	
	//Making Sure that the call to open-command byvaled proper strStation-string.
	if(strStation == "rixfm" | strStation == "rix" | strStation == "lugnafavoriter" | strStation == "lugna" | strStation == "nrj" | strStation == "svenska" | strStation == "svenskafavoriter" | strStation == "bandit" | strStation == "power_ee") {
		
		// strStation was fine, setting global settings for webbplayer popup
		strUrl = "/stream/streamingplayer.php";
				
		// Now walking thru stations rix, nrj, lugna, svenska, bandit and setting settings.
		if(strStation=="power_ee")										{strStationUrl = "http://power-ee.mtgradio.bahnhof.se";}
		
		// Setting URL-variable to open in the player.
		strPlayerUrl = strStationUrl + strUrl;
		
		// Opening player based on above variables.
		var player = window.open(strPlayerUrl, "Webbradio", "width=335,height=560,scrollbars=no,resizable=no,status=yes,location=no,toolbar=no,directories=no, menubar=no");
	}
	else {
		// The parametervalue for strStation didnt match any of the stations. Informing developer with a alert-box.
		alert("Error: Incorrect stationstring in strStation (" + strStation + " is not available as a radiostream)");
	}

}