
$(document).ready(function() {
	//Lecteur mp3
	$("a[href*=.mp3]").each(function() {
		//var color1 = "491019";
		var color1 = "1f2029";
		var color2 = "bbc3d3";
		var color3 = "FFFFFF";
		//var href = "http://www.theskywascandy.com/mp3s/april/chick-habit.mp3";
		var href = $(this).attr("href");
		href = href.substring(0, href.lastIndexOf(".mp3"))+".mp3";
		var downloadable = 1;
		var link = 'zplayer.swf?mp3='+href+'&c1='+color1+'&c2='+color2+'&c3='+color3+'&down='+downloadable;
		var code = "";
		
		if (jQuery.browser.msie,1) code= '<embed type="application/x-shockwave-flash" src="'+link+'" width="200" height="20"></embed>';
		else {
		
			code = '<object type="application/x-shockwave-flash" data="'+link+'" width="200" height="20"/>';
			code+= '<param name="movie" value="'+link+'" /><param name="wmode" value="transparent">';
			code+= '</object>';
		}
		code+= '<strong class="mp3Title">'+$(this).html()+'</strong>';		

		$(this).html(code);
		return $(this);
	});
	
	//Message sur l'accueil
	$("div.notice").css({"visibility":"visible", "height": $(this).parent().height()}).hide().fadeIn();
	
	//Gallery shadowbox
	Shadowbox.init();
	
	//Chargement des galleries
	$("a.zoomGallery").shadowbox({width:800, height:700});
	
	//Affichage du pays concerné uniquement si étranger
	$("#addressZone select:first").each(function() {
		//Si a choisi la france, on masque le pays
		$(this).change(function() {
			var country = $("#addressCountry");
			var input = $("input:first", country);
			var value = $(this).attr("value");
			if (value==74 || value=="") {
				country.hide();
				input.attr("value", "France");
			}
			else {
				country.show();
				input.attr("value", "");
			}
		}).change();
	});
	
	//Affichage du champ du nom du professeur si sélectionné dans la liste
	$("#entryFrom select").change(function() {
		if ($(this).attr("value")=="professeur") {
			$("#entryFromTeacher input").attr("value", " ");
			$("#entryFromTeacher").show();
		}
		else {
			$("#entryFromTeacher").hide();
		}
	});
	

});

//TinyMCE dans l'admin
tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		editor_selector : "mceEditor",
		language: "fr",
		theme_advanced_buttons1 : "bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : ""
	});





