// JavaScript Document
function ouvrirVideo(nomVideo, debit, mode) {
	
	// convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);
	var is_mac = (agt.indexOf("mac")!=-1);
	
	if (!is_mac) {
		//alert ("Lire video");
		var videoURL_WMV_HAUT = nomVideo + "_haut.wvx";
		var videoURL_WMV_BAS = nomVideo + "_bas.wvx";
		//alert (videoURL_WMV);
		var videoURL_RM = nomVideo + ".rpm";
		//document.write (videoURL);
	} else {
		var videoURL_WMV_HAUT = "mac/" + nomVideo + "_haut.wvx";
		var videoURL_WMV_BAS = "mac/" + nomVideo + "_bas.wvx";
		var videoURL_RM = nomVideo + ".rpm";
	}
	if (nomVideo != "") {
		if ((debit == "bas") && (mode == "wmv")) {
				document.write ('<br>');
				document.write ('<br>');
				document.write ("<OBJECT ID=\"MediaPlayer1\" width=\"192\" height=\"189\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" codebase= \"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Microsoft® Windows® Media Player components...\" type=\"application/x-oleobject\">");
				document.write ("<PARAM NAME=\"AutoStart\" VALUE=\"true\">");
				document.write ("<PARAM NAME=\"FileName\" VALUE=\"" + videoURL_WMV_BAS + "\">");
				document.write ("<PARAM NAME=\"ShowControls\" VALUE=\"true\">");
				document.write ("<PARAM NAME=\"ShowStatusBar\" VALUE=\"false\">");
				document.write ("<EMBED type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/\" SRC=\"" + videoURL_WMV_BAS + "\" name=\"MediaPlayer1\" width=\"192\" height=\"189\" autostart=\"1\" showcontrols=\"1\" ShowStatusBar=\"0\" swLiveConnect=\"true\">");
				document.write ("</EMBED>");
				document.write ("</OBJECT>");
			} else if ((debit == "haut") && (mode == "wmv")){
		document.write ('<OBJECT ID="MediaPlayer1" width=320 height=289 classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase= "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">');
		document.write ('<PARAM NAME="AutoStart" VALUE="true">');
		document.write ('<PARAM NAME="FileName" VALUE=' + videoURL_WMV_HAUT + '>');
			document.write ('<PARAM NAME="ShowControls" VALUE="true">');
			document.write ('<PARAM NAME="ShowStatusBar" VALUE="false">');
		document.write ('<PARAM NAME="stretchToFit " VALUE="True">');
		document.write ('<PARAM NAME="playbutton " VALUE="true">');
		document.write ('<EMBED type="application/-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" SRC=' + videoURL_WMV_HAUT + ' name="MediaPlayer1" width=320 height=289 autostart="1" showcontrols=1 ShowStatusBar=0 CONTROLS=smallconsole swLiveConnect="true">');
		document.write ('</EMBED>');
		document.write ('</OBJECT>');
		
			} else if ((debit == "bas") && (mode == "rm")) {
				
				//alert ("Lit RM bas
				document.write ('<br>');
				document.write ('<br>');
				document.write ('<object ID="vid" name="vid" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" WIDTH="192" HEIGHT="144">');
				document.write ('<param name="CONTROLS" value="ImageWindow">');
				document.write ('<param name="AUTOSTART" value="1">');
				document.write ('<param name="NOLABELS" value="TRUE">');
				document.write ('<param name="RESET" value="FALSE">');
				document.write ('<param name="CONSOLE" value="cons">');
				document.write ('<param name="SRC" value="'+ videoURL_RM + '">');
				document.write ('<embed type="audio/x-pn-realaudio-plugin" src="'+ videoURL_RM + '" name="vid" width="192" height="144" console="cons" controls="ImageWindow" autostart="true" nolabels="true"></embed>');
				document.write ('</object>');
				document.write('<object id="vid" classid="CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="200" height="36">');
				document.write('<param name="SRC" value="'+ videoURL_RM + '">');
				document.write('<param name="CONTROLS" value="ControlPanel">');
				document.write(' <param name="CONSOLE" value="cons">');
				document.write('<embed src="'+ videoURL_RM + '" type="audio/x-pn-realaudio-plugin" width="200" height="36" controls="ControlPanel" console="cons">');
				document.write(' </object>');
			} else if ((debit == "haut") && (mode == "rm")){
				//alert ("Lit RM haut");
				document.write('<object name="vid" id="vid" classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="320" height="240">');
				document.write('<param name="SRC" value="'+ videoURL_RM + '">');
				document.write('<param name="CONTROLS" value="ImageWindow">');
				document.write('<param name="CONSOLE" value="cons">');
				document.write('<embed name="vid" autostart="true" src="'+ videoURL_RM + '" type="audio/x-pn-realaudio-plugin" width="320" height="240" controls="ImageWindow" console="cons"></embed>');
				document.write('<param name="autostart" value="true">');
				document.write('</object>');
				
				document.write('<object id="vid" classid="CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="320" height="36">');
				document.write('<param name="SRC" value="'+ videoURL_RM + '">');
				document.write('<param name="CONTROLS" value="ControlPanel">');
				document.write(' <param name="CONSOLE" value="cons">');
				document.write('<embed src="'+ videoURL_RM + '" type="audio/x-pn-realaudio-plugin" width="320" height="36" controls="ControlPanel" console="cons">');
				document.write(' </object>');
			}
	} else if (nomVideo == "") {
		document.write ('<br>');
		document.write ('<br>');
		document.write ('<br>');
		document.write ('<br>');
		document.write ('<img src="images/selection.gif"></img>');
	}
			
}