﻿$(document).ready(function() {

	// Afficher le controles PlayPause seulement si Flash installe et bonne version
	var flashVersion = swfobject.getFlashPlayerVersion();
	flashVersion = parseInt(flashVersion.major);
	if (flashVersion >= 8) 
	{
		$("li.btnControlesVideo").show();
	}
});

// Demarrer ou arreter l'animation et changer le look du bouton en consequence
function PlayPause() {

	// Changer le look du bouton
	switch (etatPlayer) 
	{
		case "EnLecture":
			ChangerBouton("lookPlay", titlePlay);
			etatPlayer = "EnPause";
			break;
		case "EnPause":
			ChangerBouton("lookPause", titlePause);
			etatPlayer = "EnLecture";
			break;
	}

	if (document.getElementById('FlashID') != null) {
	    if (document.getElementById('FlashID').sendTextFromHtml) {
	        document.getElementById('FlashID').sendTextFromHtml();
	    }
	}
	if (document.getElementById('FlashID2') != null) {
	    if (document.getElementById('FlashID2').sendTextFromHtml) {
	        document.getElementById('FlashID2').sendTextFromHtml();
	    }
	}
	

//	if ($.browser.msie) 
//		document.getElementById('FlashID').sendTextFromHtml();
//	else 
//		document.getElementById('FlashID2').sendTextFromHtml(); 
	

	return false;
}

// Helper interne
function ChangerBouton(strLook, strImageAlt) 
{

	$("a#btnPlayPause").attr("class", strLook);
	$("a#btnPlayPause").attr("title", strImageAlt);
	
}

function ArretVideo(intVal) 
{
	//cette fonction est appellée par le Flash à la fin du vidéo.
	ChangerBouton("lookPlay", titlePlay);
	etatPlayer = "EnPause";

	//var maDate = new Date();
	//alert("ArretVideo " + maDate);
}


