///////////////////////////////////////
	//INITIALISATION VARIABLES

	// Navigateur: IE, Firefox et autre
	var gNavigator;
	if(-1 != navigator.userAgent.indexOf("MSIE")) {
		gNavigator = "explorer";
	} else if(-1 != navigator.userAgent.indexOf("Firefox")) {
		gNavigator = "firefox";
	} else {
		gNavigator = "other";
	}

	//OS : Win XP , Win Vista et autres
	var gSystem;
	if(-1 != navigator.userAgent.indexOf("Windows NT 5.1")) {
		gSystem = "xp";
	} else if(-1 != navigator.userAgent.indexOf("Windows NT 6.0")) {
		gSystem = "vista";
	} else {
		gSystem = "other";
	}


	// ActiveX compatible avec les scripts
	var gCompatible = false;
	if(gNavigator == "explorer" || (gNavigator == "firefox" && (gSystem == "vista" || gSystem == "xp"))) {
		gCompatible = true;
	}

	//Pour les navigateurs non compatibles
	// on récupère une variable en get
	// pour savoir si le flux doit être lu.
	// A modifier si la page reçoit déjà des variables en get
	var gAutostart = location.href.split("?autostart=");
	var etype = typeof(gAutostart[1]);
	if (etype!="undefined") {
		gAutostart = gAutostart[1];
	} else {
		gAutostart = 1;
	}
	///////////////////////////////////////


	///////////////////////////////////////
	//Affichage du plugin WMP
	// Attention à renseigner le flux à 3 endroits
	//mms://vipmms9.yacast.net/bfm_bfmtv
	if(gNavigator == "explorer") {
		document.write('<OBJECT id="wmp" ');
		document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
		document.write(' width="660" height="455">');
		document.write('<PARAM name="uimode" value="mini"/>');
		document.write('<PARAM name="url" value="mms://vipnrj.yacast.net/nrj_webtv02" />');
		document.write('<PARAM name="autostart" value="true" />');
		document.write('<param name="stretchToFit" value="true" />');
		document.write('</OBJECT>');
	} else if(gNavigator == "firefox" && (gSystem == "vista" || gSystem == "xp")) {
		document.write('<OBJECT id="wmp" ');
		document.write(' type="application/x-ms-wmp"'); 
		document.write(' width="660" height="455">');
		document.write('<PARAM name="uimode" value="mini"/>');
		document.write('<PARAM name="url" value="mms://vipnrj.yacast.net/nrj_webtv02" />');
		document.write('<param name="stretchToFit" value="true" />');
		document.write('<PARAM name="autostart" value="true" />');

		document.write('</OBJECT>');
	} else {
		document.write('<EMBED TYPE="application/x-mplayer2" PLUGINSPAGE="http://www.microsoft.com/Windows/MediaPlayer/" SRC="mms://vipnrj.yacast.net/nrj_webtv02" NAME="player" WIDTH="660" height="455" ');
		document.write('autostart="'+gAutostart+'" showstatusbar="0" showcontrols="1" showdisplay="0" showgotobar="0" autosize="0" showcaptioning="0" enabletracker="0" showtracker="0" enablecontextmenu="0" showpositioncontrols="0" showaudiocontrols="1"></EMBED>');
	}

	//document.write('<br/>Double-cliquez sur la vidéo pour la voir en plein écran');
	//document.write('<br/><a href="capter.html" style="font-family:Arial, Helvetica, sans-serif; color: #FFFFFF; font-size:14px; font-weight: bold;">Comment capter NRJ Hits >></a>');
	
	///////////////////////////////////////


	///////////////////////////////////////
	// Arrêt automatique
	function autoStop() {
		if(gCompatible) {
			//Pour les navigateurs compatible on fait un stop sur le wmp
			document.getElementById('wmp').controls.stop();
		} else {
			//Pour les navigateurs non compatible on recharge la page avec une variable en get pour désactiver l'autostart
			window.location.href = '?autostart=0';
		}
	}

	// ICI AU BOUT DE 10 SECONDES
	// 1200000 ms  = 20 minutes
	// var streamTimeout = window.setTimeout('autoStop();', 1200000);
	///////////////////////////////////////
