function unembed() {
	$("div.player").html("<p id='flv_player'>Vous devez mettre votre <strong>lecteur Adobe Flash</strong> &agrave; jour afin de profiter plainement du site et visionner cette bande annonce :<a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' title='Redirection vers le site officiel d\'Adobe'>Mettre &agrave; jour</a></p>");
}

function loadPlayer(story, flv_file, autostartornot, lang, splash) {
	// les variables story et lang sont devenues utiles uniquement pour le splash screen depuis le passage au "multi flv"
	// la variable flv_file contient le chemin complet vers un flv, ou LES chemins complets vers DES flv, s�par�s par des ,
	
	// ci dessous : inutiles depuis le passage au "multi flv"
	/*var videoUrl;
	if (lang == "no") {
		videoUrl = "../../histoires/"+story+"/flv/"+flv_file;
	} else {
		if (strpos(",", flv_file)) {
			arr = explode(",", flv_file);
			for (var i in arr) {
				videoUrl += "../../histoires/"+story+"/flv/"+arr[i]+",";
			}
			alert (videoUrl);
		} else {
			videoUrl = "../../histoires/"+story+"/flv/"+lang+"/"+flv_file;
		}
	}*/
	
	if (splash != "") {
		splash = "histoires/"+story+"/"+splash;
	} else {
		splash = "histoires/"+story+"/player_splash_"+lang+".jpg";
	}
	
	var flashvars =
	{
		serialKey: "dbd6e8107dbf87800e78be6ca86a9677efe1199e82c06c",
		//splashUrl: "histoires/"+story+"/player_splash_"+lang+".jpg",
		splashUrl: splash,
		videoUrl: flv_file,
		defaultVolume: "100",
		autoHideNavigation: "true",
		autoStart: autostartornot,
		autoLoop: "false",
		themeColor: "#0b4d59"
	};
	var params =
	{
		seamlesstabbing: "false",
		allowscriptaccess: "always",
		allowfullscreen: "true",
		allownetworking: "all"
	};
	var attributes =
	{
		id: "helena_flvplayer"
	};
	swfobject.embedSWF("resources/swf/flvplayer.swf", "flv_player", "320", "179", "9.0.0", "resources/swf/expressInstall.swf", flashvars, params, attributes);
}

function dl_episodes(chapitre) {
	$.get(
		"ajax.php",
		{action: "dl_episodes", chapitre: chapitre},
		function(data) {
			$("#ep-choice").html(data);
		}
	);
 }
 
 function vw_episodes(chapitre, autoall) {
	$.get(
		"../ajax.php",
		{action: "vw_episodes", chapitre: chapitre, autoall: autoall},
		function(data) {
			$(".video-switcher-content").html(data);
		}
	);
 }
 
 function tellafriend(name, email, message) {
	$.get(
		"ajax.php",
		{action: "tellafriend", name: name, email: email, message: message},
		function(data) {
			$("#TB_ajaxContent").html(data);
		}
	);
 }
 
 // testeur d'expressions regulieres
$.fn.regex = function(pattern) { 
    return ($(this[0]).val().match(pattern)) ? true : false; 
}
 
 function checkEmail(email) {
	var place = email.indexOf("@",1);
	var point = email.indexOf(".",place+1);
	if ((place > -1)&&(email.length >2)&&(point > 1)) {
		addEmail(email);
	} else {
		alert('Veuillez saisir une adresse e-mail valide!');
		return(false);
	}
}
 
 function addEmail(email) {    
	$.get("ajax.php", {action: "addemail", email: email},
		function(data){
			$("div#newsletter").html(data);
		}
	);
}

function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
