
/* This is to circumvent the IE embed restrictions applied after the EOLAS-debacle
 * As long as this function resides in an external js-file, we are ok. If this code is moved to
 * the main document, the control will have to be "activated" by clicking it.
 */

function writeToDiv(which){

// build the embed string based on variables written to js from server script. We use both URL and Filename params to cater for different
// versions of the WMP control/object, and to accommodate free selection of player plugin for non-IE users.
var WM_embed_string = '<object id="ctl00_ucPlayer_Player" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-ms-wmp" url="'+WM_url+'" standby="Laster avspiller..." height="'+WM_height+'" width="'+WM_width+'">' +
'<param name="Url" value="'+WM_url+'" />' +
'<param name="Filename" value="'+WM_url+'" />' +
'<param name="AutoStart" value="'+WM_autostart+'" />'+
'<param name="Audio" value="50" />'+
'<param name="Mute" value="'+WM_mute+'" />'+
'<param name="StretchToFit" value="'+WM_stretchToFit+'" />'+
'<param name="AutoSize" value="'+WM_stretchToFit+'" />'
if (WM_uimode == 'none'){
	WM_embed_string += '<param name="uiMode" value="'+WM_uimode+'" />'+
	'<param name="ShowControls" value="0" />'+
	'<param name="ShowGotoBar" value="0" />'+
	'<param name="ShowTracker" value="0" />'+
	'<param name="ShowStatusBar" value="0" />'
} else {
	WM_embed_string += '<param name="uiMode" value="'+WM_uimode+'" />'
}

WM_embed_string += '<EMBED type="application/x-mplayer2" src="' + WM_url + '" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="ctl00_ucPlayer_Player" height="356" width="512"></EMBED>';
WM_embed_string += '</obje';
WM_embed_string += 'ct>';


	if (WM_uimode == 'none'){
		which.innerHTML = WM_embed_string;
	} else {
		var div_content = '<div id="ctl00_ucPlayer_ObjectWrapper" class="object">' +	WM_embed_string + '</div>';
		//alert(which.id + '\n\n' + div_content);
		which.innerHTML = div_content;
		//which.innerHTML = "TEST";
	}
}//end function

function writeForMacToDiv(which){
// build the embed string based on variables written to js from server script. We use both URL and Filename params to cater for different
// versions of the WMP control/object, and to accommodate free selection of player plugin for non-IE users.

	var WM_embed_string = '';
	if (WM_uimode == 'none'){
		WM_embed_string = '<EMBED SRC="'+WM_url+'" BGCOLOR="" TYPE="application/x-mplayer2" SCALE="aspect" VOLUME="50" WIDTH="'+WM_width+'" HEIGHT="'+WM_height+'" AUTOPLAY="true" CONTROLLER="false" PLUGINSPAGE="http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx"></EMBED>';
	} else {
		WM_embed_string = '<EMBED SRC="'+WM_url+'" BGCOLOR="" TYPE="application/x-mplayer2" SCALE="aspect" VOLUME="50" WIDTH="'+WM_width+'" HEIGHT="'+WM_height+'" AUTOPLAY="true" CONTROLLER="true" PLUGINSPAGE="http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx"></EMBED>';
	}

	if (WM_uimode == 'none'){
		which.innerHTML = WM_embed_string;
		//alert(which.id);
	} else {
		var div_content = '<div id="ctl00_ucPlayer_ObjectWrapper" class="object">' +	WM_embed_string + '</div>';
		which.innerHTML = div_content;
	}
	
}//end function

