// external_script.js

function wmpCreateAudioPlayer(DivID,objid,url,width,height){
	var d = document.getElementById(DivID);
	
	str = '<div  id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="'+width+'" height="'+height+'">';
	str+= '		<param name="source" value="/StreamPlayer.xap"/>';
	str+= '		<param name="background" value="black" />';
	str+= '		<param name="initParams" value="thestream='+url+',w='+width+',h='+height+',m=0,f=1,r=1,c=0,v=60" />';
	str+= '		<param name="minRuntimeVersion" value="2.0.31005.0" />';
	str+= '		<param name="autoUpgrade" value="true" />';
	str+= '</object>';
	str+= '</div>';
	
	//alert(str);
	d.innerHTML = str;
}
/*
function wmpCreateAudioPlayerold(DivID,objid,url,width,height) { 
	var d = document.getElementById(DivID);
	var is_ie = navigator.appName == 'Microsoft Internet Explorer';
	var is_op = navigator.appName == 'Opera' ? true : false;
	var is_ns = !is_ie && !is_op ? true : false;
    var str = ""; 
    if (is_ie) { 
         // create the WMP for IE onmouseover="JavaScript: alert( 'onmouseover event' )"
         str = '<OBJECT  id="'+objid+'" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" width="'+width+'" height="'+height+'">'; 
    } else { 
         // create it for FF. 
         str = '<OBJECT  id="'+objid+'" type="application/x-ms-wmp" data="'+url+'" width="'+width+'" height="'+height+'">'; 
    } 
   		str += '<PARAM NAME="URL" value="'+url+'" />'; 
   		str += '<PARAM NAME="SRC" value="'+url+'" />'; 
   		str += '<PARAM NAME="uiMode" value="mini">'; 
		str += '<PARAM NAME="mute" VALUE="0">'; 
    	str += '<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">'; 
		str += '<PARAM NAME="AutoStart" VALUE="True">';
		str += '<PARAM NAME="ShowControls" VALUE="1">'; 
		str += '<PARAM NAME="showtracker" VALUE="1">'; 
		str += '<PARAM NAME="ShowStatusBar" VALUE="false">'; 
		str += '<PARAM NAME="enableContextMenu" VALUE="false">'; 
		str += '<PARAM NAME="volume" VALUE="60">'; 
    str += '</object>'; 
    d.innerHTML = str;
}


*/



function wmpCreate(DivID,objid,url,width,height) { 
	var d = document.getElementById(DivID);
	
	var is_ie = navigator.appName == 'Microsoft Internet Explorer';
	var is_op = navigator.appName == 'Opera' ? true : false;
	var is_ns = !is_ie && !is_op ? true : false;
	
    var str = ""; 
    if (is_ie) { 
         // create the WMP for IE onmouseover="JavaScript: alert( 'onmouseover event' )"
         //6BF52A52-394A-11d3-B153-00C04F79FAA6
         str = '<OBJECT  id="'+objid+'" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+width+'" height="'+height+'">'; 
    } else { 
         // create it for FF. 
         str = '<OBJECT  id="'+objid+'" type="application/x-ms-wmp" data="'+url+'" width="'+width+'" height="'+height+'">'; 
    } 
   		str += '<PARAM NAME="URL" value="'+url+'" />'; 
   		str += '<PARAM NAME="SRC" value="'+url+'" />'; 
   		str += '<PARAM NAME="uiMode" value="none">'; 
   		str += '<PARAM NAME="LOOP" VALUE="true">'; 
   		str += '<PARAM NAME="repeat" VALUE="true">';
		str += '<PARAM NAME="mute" VALUE="False">'; 
		str += '<PARAM NAME="AutoRewind" VALUE="false">'; 
		str += '<PARAM NAME="ClickToPlay" VALUE="false">'; 
		str += '<PARAM NAME="AnimationAtStart" VALUE="false">'; 
		str += '<PARAM NAME="TransparentAtStart" VALUE="False">'; 
    	str += '<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">'; 
		str += '<PARAM NAME="AutoStart" VALUE="True">';
		str += '<PARAM NAME="ShowControls" VALUE="False">'; 
		str += '<PARAM NAME="ShowStatusBar" VALUE="false">'; 
		str += '<PARAM NAME="stretchToFit" VALUE="true">'; 
		str += '<PARAM NAME="enableContextMenu" VALUE="true">'; 
		str += '<PARAM NAME="volume" VALUE="60">'; 
		str += '<PARAM NAME="BufferingTime" VALUE="2">'; 
		str += '<PARAM NAME="PlayCount" VALUE="10">'; 
		
    str += '</object>'; 
    d.innerHTML = str;
}


function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, AUTOSTART){
	var d = document.getElementById(DivID);
	var str = "";
	str +=	'<OBJECT id="mediaPlayer" width="' +WIDTH+ '" height="' +HEIGHT+ '" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" ';
	str +=	'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
	str +=	'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> ';
	str +=	'<param name="fileName" value="' +URL+ '"> ';
	str +=	'<param name="animationatStart" value="true"> ';
	str +=	'<param name="transparentatStart" value="true"> ';
	str +=	'<param name="autoStart" value="' +AUTOSTART+ '"> ';
	str +=	'<param name="EnableContextMenu" value=false> ';
	str +=	'<param name="showControls" value="false"> ';
	str +=	'<param name="ShowStatusBar" value="false"> ';
	str +=	'<PARAM name="ShowDisplay" VALUE="false"> ';
	str +=	'<param name="loop" value="false"> ';
	str +=	'<EMBED type="application/x-mplayer2" ';
	str +=	'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" ';
	str +=	'id="mediaPlayer" name="mediaPlayer" displaysize="4" autosize="-1" ';
	str +=	' enablecontextmenu="0" transparentatstart="1" showcontrols="false" autostart="1" uiMode="none" showtracker="0" ';
	str +=	' showdisplay="0" showstatusbar="0" videoborder3d="0" width="' +WIDTH+ '" height="' +HEIGHT+ '" ';
	str +=	' src="' +URL+ '" autostart="' +AUTOSTART+ '" designtimesp="5311" loop="0"> ';
	str +=	'</EMBED> ';
	str +=	'</OBJECT> ';
	d.innerHTML = str;
}

//x-mplayer2 or x-ms-wmp
   // d.innerHTML +=	'<param name="showDisplay" VALUE="False">';
   // d.innerHTML +=	'<param name="ShowStatusBar" VALUE="False">';
    //d.innerHTML +=	'<param name="autoSize" VALUE="True">';

//<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
//<PARAM NAME="AutoStart" VALUE="True">
//<PARAM name="uiMode" value="none">
//<PARAM name="PlayCount" value="9999">


/*
Parameter			Default			Description
autoStart			true			Specifies or retrieves a value indicating whether the current media item begins playing automatically.
balance				0				Specifies the current stereo balance.
									Values range from –100 to 100.
baseURL 							Specifies the base URL used for relative path resolution with URL script commands that are embedded in media items.
captioningID 		0 				Specifies the name of the element displaying the captioning.
currentMarker 		0 				Specifies the current marker number.
currentPosition 	0 				Specifies the current position in the media item in seconds.
defaultFrame 		- 				Specifies the name of the frame used to display a URL.
enableContextMenu 	true 			Specifies a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.
enabled 			false 			Specifies whether the Windows Media Player control is enabled.
fullScreen 			false 			Specifies whether video content is played back in full-screen mode.
InvokeURLs 			true 			Specifies a value indicating whether URL events should launch a Web browser.
Mute 				false 			Specifies if audio is muted.
PlayCount 			1 				Specifies the number of times a media item will play. Minimum value of one.
Rate 				1.0 			Specifies the playback rate.
									0.5 equates to half the normal playback speed, 2 equates to twice.
stretchToFit 		false 			Specifies whether video displayed by the control automatically sizes to fit the video window, when the video window is larger than the dimensions of the video image.
uiMode 				full 			Specifies which controls are shown in the user interface.
									Possible values: invisible, none, mini, full.
URL 				- 				Specifies the name of the media item to play.
									You can specify a local filename or a URL.
Volume 				Last setting 	Zero specifies no volume and 100 specifies full volume.
windowlessVideo 	false 			Specifies or retrieves a value indicating whether the Windows Media Player control renders video in windowless mode.
									When windowlessVideo is set to true, the Player control renders video directly in the client area, so you can apply special effects or layer the video with text.
									Supported by Windows Media Player for Windows XP or later.


VIDEO.URL="filename";		#Start playback:
VIDEO.controls.stop();		#Stop playback:


*/

