	$(document).ready(function() {
				
				$("body").addClass("jse");
				
				// popups
					$("a[rel='popup']").click(function() {
						openRemote(this.href); return false;
					});
				
				// input focus
					$("form .userinput").focus(function() { $(this).addClass("focus"); });
					$("form .userinput").blur(function() { $(this).removeClass("focus"); });
				
				// quick search form
					var qsKeyWords_init = "Rechercher";
					$("form.qsearch").find("input[type='text']").val(qsKeyWords_init);
					$("form.qsearch").find("input[type='text']").focus(function () {
						if ($(this).val() == qsKeyWords_init) $(this).val("");
						$(this).addClass("focused");
					});
					$("form.qsearch").find("input[type='text']").blur(function () {
						
						if ($(this).val() == "") {
							$(this).val(qsKeyWords_init).removeClass("has-text");
						} else {
							$(this).addClass("has-text");
						}
						$(this).removeClass("focused");
					});
				
				// NL form
					var nlFormMail_init = "Votre adresse mail";
					$("form.nlregform").find("input[name='Sender']").val(nlFormMail_init);
					$("form.nlregform").find("input[name='Sender']").focus(function () {
						if ($(this).val() == nlFormMail_init) $(this).val("");
						$(this).addClass("focused");
					});
					$("form.nlregform").find("input[name='Sender']").blur(function () {
						if ($(this).val() == "") {
							$(this).val(nlFormMail_init).removeClass("has-text");
						} else {
							$(this).addClass("has-text");
						}
						$(this).removeClass("focused");
					});
				
				/*====== */	
				//$(".crnr").corner("10px");
				
				/*====== */	
				Cufon.replace('#p-home #blogrolls h2.title, #pageContent h2.title, .postcontent h2');
				//Cufon.replace('#p-home #blogrolls h2.title');
				/*====== */	
				
				$(function() { 
 				    // initialize scrollable 
				    $("#siteroll5 .scroll-testi").prepend("<a class='prev'></a><a class='next'></a>").scrollable({ size: 1 }).autoscroll({ autoplay: true, interval: 10000, steps: 1 }).circular(); 
				}); 
				
				//$("a.fplayer").text("");
				//flowplayer("a.fplayer", "/js/flowplayer/flowplayer-3.2.0.swf", { clip: { autoPlay: false, scaling: "fit" } });
				
				flowplayer("div.fplayer", "/js/flowplayer/flowplayer-3.2.0.swf", { clip: {scaling: "fit" } });
					
			/*====== */	
			
			//$("#cursusWrapper").find("div.preview").find("a").addClass("thickbox").attr("rel", "prev-gallery");
				$("#cursusWrapper .toc").addClass("jse")
				$("#cursusWrapper .toc ul>li>h3").siblings().hide();
				$("#cursusWrapper .toc ul>li>h3").mouseover(function(e) {
							$("<div id='niceTip'></div>").appendTo("body").append($(this).siblings().clone().show()).wrapInner("<div id='niceTipWrapper'></div>");
							
							
						})
					.mousemove(function(e) {
					if (!$("#niceTip").size() ) return;
					var xpos = e.pageX - ($("#niceTip").width()/2);
					var ypos = e.pageY+20;
					$("#niceTip").css("position", "absolute")
					.css("left", xpos+"px")
					.css("top", ypos+"px");
				})
				.mouseout(function(e) {
						$("#niceTip").remove();
					});
			
		});
	
	$(window).load(function  () {
		$(".thumb img").each(function() {
			$(this).css("marginTop", (($(this).parent().height() - $(this).height())/2)+"px");
				
			/*if ($(this).height()<$(this).parent().height()) {
				$(this).css("marginTop", (($(this).parent().height() - $(this).height())/2)+"px");
			} else {
				var ratio = $(this).width()/$(this).height();
				$(this).height($(this).parent().height());
				$(this).width($(this).height()*ratio);
				$(this).css("marginLeft", (($(this).parent().width() - $(this).width())/2)+"px");
				
			}*/
		});
	});
	
	
function openRemote(url) {
	rmtWin=window.open(url, window.name + 'rmt', 'status=yes,menubar=yes,width=600,height=500,scrollbars=yes,resizable=yes');
	window.setTimeout("if (rmtWin) rmtWin.focus();", 200);
}

function checkEmpty(fieldObj) {
	fieldObj.siblings(".fieldInfos").remove();
	fieldObj.parent().removeClass('format');
	if ( fieldObj.val() == '' ) 
		fieldObj.parent().addClass('errored').end()
			.after("<span class='fieldInfos'>* Information obligatoire</span>");
	else fieldObj.parent().removeClass("errored");
	return (fieldObj.val() != '');
}

function checkEmail(fieldObj) {
	var t;
	if (t=checkEmpty(fieldObj)) {
		fieldObj.siblings(".fieldInfos").remove();
		if (!isEmail(fieldObj.val())) {
			fieldObj.parent().addClass('errored').addClass('format').end()
				.after("<span class='fieldInfos'>* L'adresse e-mail que vous avez renseignée ne semble pas avoir un format valide.</span>");
		}
		else fieldObj.parent().removeClass('errored').removeClass('format');
	}
	return (t && isEmail(fieldObj.val()));
}
function isEmail(val) {
	var re = new RegExp("^\\w+((-\\w+)|(\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", "gi");
	return (re.test(val) || (val==""));
}			

			
function init_createForm() {
	$("form#pDemoCreate").submit(function() {
		var alright = true;
		$(this).find("p.required input").each(function() {
			if ($(this).attr("id").toLowerCase().indexOf("email")!=-1)
				alright = alright &  checkEmail($(this));
			else 
				alright = alright &  checkEmpty($(this));
		});
		
		if ( alright ) { this.submit(); }
		else {
			$(this)
				.find(".msg").remove().end()
				.find("h2").after("<p class='msg err'>Vous n'avez pas rempli tous les champs obligatoires</p>").end()
				.find(".msg").hide().fadeIn("slow").end()
				.find(".errored:first input")[0].focus();
				
		}
		return false;
	});
}

function init_loginForm() {
	$("form#elquickLogonX").submit(function() {
		var alright = true;
		$(this).find("p.required input").each(function() {
			alright = alright &  checkEmpty($(this));
		});
		
		if ( alright ) { this.submit(); }
		else {
			$(this)
				.find(".msg").remove().end()
				.find("h2").after("<p class='msg err'>Vous n'avez pas rempli tous les champs obligatoires</p>").end()
				.find(".msg").hide().fadeIn("slow").end()
				.find(".errored:first input")[0].focus();
				
		}
		return false;
	});
}

function init_contactForm() {
	$("form#contactFormX").submit(function() {
		var alright = true;
		$(this).find("p.required input, p.required textarea").each(function() {
			if ($(this).attr("id").toLowerCase().indexOf("email")!=-1)
				alright = alright &  checkEmail($(this));
			else 
				alright = alright &  checkEmpty($(this));
		});
		
		if ( alright ) { this.submit(); }
		else {
			$(this)
				.find(".msg").remove().end()
				.find("h2").after("<p class='msg err'>Vous n'avez pas rempli tous les champs obligatoires</p>").end()
				.find(".msg").hide().fadeIn("slow").end()
				.find(".errored:first input")[0].focus();
				
		}
		return false;
	});
}