	
	var m_sStreamUrl;
	var m_sDomain;
	var m_sCooieName;
	var m_sMediaPlayerId;
	var m_bDisplayLink = true;
	var m_bExternalOpen = false;
	var m_oMediaplayer;
	var WMP7;
	var expdate = new Date ();
	
	m_sCooieName = "radioFFpopup";
	m_sMediaPlayerId = "MPRadioFolgefonn";
	m_sDomain = "http://www.radiofolgefonn.no/";
	//m_sStreamUrl = m_sDomain + "portals/radifolg/forms/radiofolgefonn.asx";
	m_sStreamUrl = "http://nettradio.grafisksenter.no/folgefonn-high.m3u";
	m_sStreamUrlHi = "http://nettradio.grafisksenter.no/folgefonn-high.m3u";
	m_sStreamUrlLo = "http://nettradio.grafisksenter.no/folgefonn-low.m3u";
	expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 timer
	
	if (navigator.appName == "Netscape") {
		navigator.plug-ins.refresh();
	} else {
		WMP7 = new ActiveXObject('WMPlayer.OCX');
	}
	
	function renderMiniPlayer() {
		document.write('<div align="center">');
		if (m_bDisplayLink) {

			AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'flashvars', '',
			'width', '180',
			'height', '72',
			'src', 'http://www.radiofolgefonn.no/portals/radifolg/filesystem/106',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'wmode', 'window',
			'devicefont', 'true',
			'id', 'OnAir_v1',
			'bgcolor', '#ffffff',
			'name', 'OnAir_v1',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','always',
			'movie', 'http://www.radiofolgefonn.no/portals/radifolg/filesystem/106'
			);

			if (readCookie(m_sCooieName) == 'true') {
				m_bExternalOpen = true;
			}


		} else {
			document.write('<img src="' + m_sDomain + '/portals/radifolg/filesystem/656.gif" id="imgPlayer" usemap="#player_mode"  border="0"><br>');
			document.write('<map name="ext_player" id="player_mode">');
			document.write('<area shape="rect" coords="93,58,180,76" href="JavaScript:playHi();" />');
			document.write('<area shape="rect" coords="197,59,247,76" href="JavaScript:playLo();" />');
			document.write('</map>');
			if (WMP7) {
			// Windows Media Player 7 Code
				document.write('<OBJECT id="' + m_sMediaPlayerId + '" ');
				document.write(' classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" ');
				document.write(' standby="Laster Radio Folgefonn..." ');
				document.write(' type="application/x-oleobject" ');
				document.write(' height="63" width="250"> ');
				document.write('  <param name="url"                       VALUE="' + m_sStreamUrl + '">');
				if (m_bExternalOpen) {
					document.write('  <param name="AutoStart"                 VALUE="false">');
					document.write('  <param name="Volume"                    VALUE="-1000">');
				} else {
					document.write('  <param name="AutoStart"                 VALUE="true">');
					document.write('  <param name="Volume"                    VALUE="7">');
				}
				document.write('  <param name="ShowControls"              VALUE="true">');
				document.write('  <param name="ShowStatusBar"             VALUE="true">');
				document.write('  <param name="uiMode"                    VALUE="mini">');
				document.write('  <param name="EnableContextMenu"         VALUE="false">');
				document.write('</OBJECT>');
			} else {
				// Windows Media Player 6.4 Code
				document.write('<OBJECT id="' + m_sMediaPlayerId + '" ');
				document.write(' classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ');
				document.write(' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
				document.write(' standby="Laster Radio Folgefonn..." ');
				document.write(' type="application/x-oleobject" ');
				document.write(' height="26" width="250">');
				document.write('  <param name="ShowControls"              VALUE="true">');
				document.write('  <param name="ShowStatusBar"             VALUE="true">');
				document.write('  <param name="ShowTracker"               VALUE="false">');
				document.write('  <param name="InvokeURLs"                VALUE="false">');
				document.write('  <param name="SHOWPOSITIONCONTROLS"      VALUE="false">');
				document.write('  <param name="ShowGotoBar"               VALUE="false">');
				document.write('  <param name="Visible"                   VALUE="false">');
				if (m_bExternalOpen) {
					document.write('  <param name="AutoStart"                 VALUE="false">');
				} else {
					document.write('  <param name="AutoStart"                 VALUE="true">');
				}
				document.write('  <param name="SendPlayStateChangeEvents" VALUE="false">');
				document.write('  <param name="SendOpenStateChangeEvents" VALUE="false">');
				document.write('  <param name="AnimationatStart"          VALUE="false">');
				document.write('  <param name="SendWarningEvents"         VALUE="false">');
				document.write('  <param name="SendErrorEvents"           VALUE="false">');
				document.write('  <param name="TransparentAtStart"        VALUE="false">');
				document.write('  <param name="Volume"                    VALUE="-1000">');
				document.write('  <param name="ShowDisplay"               VALUE="false">');
				document.write('  <param name="EnableContextMenu"         VALUE="false">');
				document.write('  <param name="ClickToPlay"               VALUE="false">');
				document.write('  <param name="AllowScan"                 VALUE="false">');
				document.write('  <param name="AutoSize"                  VALUE="false">');
				document.write('  <param name="SendErrorEvents"           VALUE="false">');
				document.write('  <param name="FileName"                  VALUE="' + m_sStreamUrl + '">');
			
				document.write('  <EMBED NAME="' + m_sMediaPlayerId + '"');
				document.write('     WIDTH="250"');
				document.write('     HEIGHT="50"');
				document.write('     PLUGINSPAGE="http://www.microsoft.com/Windows/MediaPlayer/"');
				document.write('     TYPE="application/x-mplayer2"');
				document.write('     SRC="' + m_sStreamUrl + '"');
				document.write('     SHOWCONTROLS="1"');
				document.write('     SHOWPOSITIONCONTROLS="0"');
				document.write('     VISIBLE="1"');
				if (m_bExternalOpen) {
					document.write('     AUTOSTART="0"');
				} else {
					document.write('     AUTOSTART="1"');
				}
				document.write('     ANIMATIONATSTART="0"');
				document.write('     TRANSPARENTATSTART="0"');
				document.write('     SHOWSTATUSBAR="1"');
				document.write('     SHOWDISPLAY="0"');
				document.write('     ENABLECONTEXTMENU="0"');
				document.write('     CLICKTOPLAY="0"');
				document.write('     ALLOWSCAN="0"');
				document.write('     xVOLUME="50"');
				document.write('     BORDER="0"');
				document.write('     SHOWTRACKER="0"');
				document.write('     DISPLAYSIZE="0"');
				document.write('     AUTOSIZE="0"');
				document.write('     SHOWGOTOBAR="0"');
				document.write('     SHOWCAPTIONING="0"');
				document.write('     AUTOREWIND="0"');
				document.write('     INVOKEURLS="1"');
				document.write('     >');
				document.write('  </EMBED>');
			
				document.write('</OBJECT>');
			}
		document.write('</div>');
		}
	}
	
	
	function setRadioCookie(value) {
		createCookie(m_sCooieName,value,1);
	}
	
	function createCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}
	
	
	function findMediaPlayer() {
		m_oMediaplayer = getMediaPlayerObject(m_sMediaPlayerId);
		if (typeof(m_oMediaplayer) == 'object') {
			return true;
		} else {
			return false;
		}
	}
	
	function launcRadioPopup() {
		if (WMP7) {
			open_window(m_sDomain + 'portals/radifolg/forms/radio.htm','frmRadioFF', 250, 143, 0, 0);
		} else {
			open_window(m_sDomain + 'portals/radifolg/forms/radio.htm','frmRadioFF', 250, 104, 0, 0);
		}
	}

	function launcMediaplayer() {
		setRadioCookie('true');
		location.href = m_sStreamUrl;
	}
	
	function launcMediaplayerHi() {
		setRadioCookie('true');
		location.href = m_sStreamUrlHi;
	}

	function launcMediaplayerLo() {
		setRadioCookie('true');
		location.href = m_sStreamUrlLo;
	}


	function playHi() {
		if (findMediaPlayer()) {
			document.getElementById('imgPlayer').src= m_sDomain + '/portals/radifolg/filesystem/656.gif';
			m_oMediaplayer.url = m_sStreamUrlHi;
		}
	}

	function playLo() {
		if (findMediaPlayer()) {
			document.getElementById('imgPlayer').src= m_sDomain + '/portals/radifolg/filesystem/657.gif';
			m_oMediaplayer.url = m_sStreamUrlLo;
		}
	}


	function getMediaPlayerObject(sName) {
		if (window.document[sName]) {
			return window.document[sName];
		}
		if (navigator.appName.indexOf("Microsoft Internet")==-1) {
			if (document.embeds && document.embeds[sName])
			return document.embeds[sName]; 
		} else {
			return document.getElementById(sName);
		}
	}

