// Fonction javascript pour les vidéos

//Detection du navigateur 
/* renvoi un objet qui contient comme propriété les noms des navigateurs (ie6, ns4...).
* Chaque propriété est positionnée à VRAI ou FAUX en fonctions du navigateur.
* version 1.1
*/
function NavCheck()
{ 
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.gecko=(this.dom && parseInt(this.ver) >= 5 && this.agent.indexOf("Gecko")>-1) ?1:0;
	this.firefox=(this.gecko && this.agent.indexOf("Firefox")>-1) ?1:0;
	this.mozilla=(!this.firefox && this.gecko) ?1:0;
	this.NC=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.firefox || this.gecko || this.mozilla);
	return this
}

// Controles de la video (arret, pause, lecture ...)
function controlVideo(action)
{
	// Vérification que l'objet vidéo existe bien : evite les erreus javascript si il n'existe pas
	if (window.document.getElementById('mediaPlayer'))
	{
		lecteurVideo = window.document.getElementById('mediaPlayer');
		switch (action)
		{
			// Pour jouer les vidéos
			case "play":
				lecteurVideo.play();
			break;
			// Pour mettre en pause si la video est en train de jouer
			case "pause":
				if (lecteurVideo.PlayState == 2)
					lecteurVideo.pause();
			break;
			// Pour arreter la video
			case "stop":
				lecteurVideo.stop();
				lecteurVideo.CurrentPosition = 0;
			break;
			default: alert('Commande non reconnue !');
		}
	}
}