$(document).ready(function() {
	
	//Mise en conformité W3C des liens avec un target _blank 
	$(".blank").attr("target", "_blank"); //Mise en place des target valides xhtml strict	
		
	$('.nospam').each(function(){
		var sEmail = $(this).html();
		sEmail = sEmail.replace("[arobase]","@");
		sEmail = sEmail.replace("[point]",".");
		$(this).html("<a href=\"mailto:" + sEmail + "\">" + sEmail + "</a>");
	});
	
	$('.slide_presentation').click(function() {

		var iChilds = $('.slides_presentation').children('li').length;
		var sElementBas = $(this).children('.bas');
		var iCount = $(sElementBas).html();
		
		if(iChilds == iCount) { var iDecallage = 0; }
		else { var iDecallage = iCount * 620; }
		$("#content.content_presentation .gauche .presentation ul").animate({
			left: "-" + iDecallage + "px"
		}, 750 );			   
	});
	
	$(".center_element").center();
	
	$(".references_clients li").click(function() {
	
		var iLength = $(this).attr('class').length;
		var sReferenceClient = $(this).attr('class').substr(36, iLength);
		var sIdElement = "#presentation_" + sReferenceClient;
		$(sIdElement).show();
	});
	
	
	$(".presentation_references_client .fermer").click(function() {
		$(this).parent().hide();
	});
	
	$("#pageflip").hover(function() { //On hover...
		$("#pageflip img , .msg_block").stop()
			.animate({ //Animate and expand the image and the msg_block (Width + height)
				width: '307px',
				height: '319px'
			}, 500);
		} , function() {
		$("#pageflip img").stop() //On hover out, go back to original size 50x52
			.animate({
				width: '50px',
				height: '52px'
			}, 220);
		$(".msg_block").stop() //On hover out, go back to original size 50x50
			.animate({
				width: '50px',
				height: '50px'
			}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
	});
	
	$( ".draggable" ).draggable();
});
