// Fichier source: http://www.dylandanielou.ch/js/jq.plugins.source.js

(function(c){c.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(e,d){c.fx.step[d]=function(f){if(f.state==0){f.start=b(f.elem,d);f.end=a(f.end)}f.elem.style[d]="rgb("+[Math.max(Math.min(parseInt((f.pos*(f.end[0]-f.start[0]))+f.start[0]),255),0),Math.max(Math.min(parseInt((f.pos*(f.end[1]-f.start[1]))+f.start[1]),255),0),Math.max(Math.min(parseInt((f.pos*(f.end[2]-f.start[2]))+f.start[2]),255),0)].join(",")+")"}});function a(e){var d;if(e&&e.constructor==Array&&e.length==3){return e}if(d=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e)){return[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]}if(d=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e)){return[parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55]}if(d=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e)){return[parseInt(d[1],16),parseInt(d[2],16),parseInt(d[3],16)]}if(d=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e)){return[parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16),parseInt(d[3]+d[3],16)]}}function b(f,d){var e;do{e=c.curCSS(f,d);if(e!=""&&e!="transparent"||c.nodeName(f,"body")){break}d="backgroundColor"}while(f=f.parentNode);return a(e)}})(jQuery);var font=(function(){var a="mmmmmmmmmmmmmmmwwwwwwwwwww";var d='"Arial"';var e=0;var c=null;var b=0;return{setup:function(){if($("#fontInstalledTest").length){return}$("head").append("<style> #fontInstalledTest, #fontTestBed { position: absolute; left: -9999px; top: 0; visibility: hidden; } #fontInstalledTest { font-size: 50px!important; font-family: "+d+";}</style>");$("body").append('<div id="fontTestBed"></div>').append('<span id="fontInstalledTest" class="fonttest">'+a+"</span>");c=$("#fontTestBed");e=$("#fontInstalledTest").width()},isInstalled:function(f){b++;var g='<style id="fonttestStyle"> #fonttest'+b+" { font-size: 50px!important; font-family: "+f+", "+d+"; } </style>";$("head").find("#fonttestStyle").remove().end().append(g);c.empty().append('<span id="fonttest'+b+'" class="fonttest">'+a+"</span>");return(c.find("span").width()!=e)}}})();$.fn.smoothScroll=function(a,c,b){a=a||200;c=c||"easeInOutExpo";b=typeof(b)=="function"?b:function(){};$(this).click(function(d){d.preventDefault();target=$(this).attr("href");posx=$(target).offset().top;$("body,html").animate({scrollTop:posx},a,c,b.call()).queue(function(){window.location.hash=target;$(this).dequeue()})})};jQuery.extend(jQuery.easing,{easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a}});$.fn.lightBox=function(f){var x,k,n,m,i,g,v,w,y,t=undefined,j=undefined,s=undefined,l=undefined,o,A,h,p,r,a,c,b,q,u,C,e,d,B,z,f=typeof(f)=="function"?f:function(){};$(this).hover(function(){x=$(this).find("img");z=x.attr("alt");x.removeAttr("alt");$(this).css({position:($(this).css("position")=="absolute"?"absolute":"relative")});$("#lightbox-enlarge").remove();$('<div id="lightbox-enlarge"></div>').prependTo($(this));n=$("#lightbox-enlarge");n.hide().css({"margin-top":x.innerHeight()/2-n.innerHeight()/2,"margin-left":x.innerWidth()/2-n.innerWidth()/2});n.stop().fadeIn(20)},function(){n.stop().fadeOut(80);x.attr("alt",z)});$(this).click(function(D){D.preventDefault();e=$(this).attr("href");u=$(this).attr("title").length>0?$(this).attr("title"):($(this).attr("alt")>0?$(this).attr("alt"):"");C=typeof(u.split(" | ")[0])!="undefined"?u.split(" | ")[0]:"";d=$(this).attr("rel");$group=(d.length>0)?$("a[rel="+d+"]"):"";$("body").append('<div id="lightbox"><div id="lightbox-container"><div id="lightbox-image"></div><div id="lightbox-caption"><div id="lightbox-close"><a href="#" title="Fermer (esc)">Fermer</a></div></div></div></div>');k=$("#lightbox");m=$("#lightbox-container");i=$("#lightbox-caption");m.css({top:$(window).scrollTop()+(($(window).height()/2)-50)});k.css({height:$(document).height()});k.fadeIn(500,function(){B=new Image();B.onload=function(){t=undefined;j=undefined;s=undefined;l=undefined;t=B.height;j=B.width;B.style.display="none";var E=j/t;if($(window).height()<=B.height){s=$(window).height();l=$(window).height()*E;o=0}else{o=($(window).height()/2)-(t/2);s=t;l=j}m.animate({height:s,width:l,top:$(window).scrollTop()+o},200,function(){g=$("#lightbox-image");g.find("img").remove();g.append(B);g.find("img").css({height:s,width:l});g.fadeIn(200).find("img").fadeIn(200);i.find("p").remove();i.append('<p class="lightbox-title">'+C+"</p>");if($group.length>1){current=0;for(var F=0;F<$group.length;F++){if($group.eq(F).attr("href")==e){current=F;A=$group.eq(F-1).attr("href");prevCaption=$group.eq(F-1).attr("title");if(typeof(prevCaption)!="undefined"){a=prevCaption.split(" | ")[0];b=typeof(prevCaption.split(" | ")[1])!="undefined"?prevCaption.split(" | ")[1]:""}h=$group.eq(F+1).attr("href");nextCaption=$group.eq(F+1).attr("title");if(typeof(nextCaption)!="undefined"){c=nextCaption.split(" | ")[0];q=typeof(nextCaption.split(" | ")[1])!="undefined"?nextCaption.split(" | ")[1]:""}}}$("#lightbox-controls,#lightbox-prev,#lightbox-next").remove();p=(current>0)?'<div id="lightbox-prev"><a href="'+A+'" title="Image pr&eacute;c&eacute;dente"><img src="img/lb-prev.png" /></a></div>':'<div id="lightbox-prev" class="lightbox-disabled"><a title="Premi&egrave;re Image"><img src="img/lb-prev.png" /></a></div>';r=(current<($group.length)-1)?'<div id="lightbox-next"><a href="'+h+'" title="Image suivante"><img src="img/lb-next.png" /></a></div>':'<div id="lightbox-next" class="lightbox-disabled"><a title="Derni&egrave;re Image"><img src="img/lb-next.png" /></a></div>';i.prepend("<div id='lightbox-controls' class='clearfix'>");$("#lightbox-controls").append(p).append(r);v=$("#lightbox-controls").size()>0?$("#lightbox-controls"):"undefined";w=$("#lightbox-prev,#lightbox-prev a").filter(":has(a[href])");y=$("#lightbox-next,#lightbox-next a").filter(":has(a[href])");w.click(function(G){C=a;e=A});y.click(function(G){C=c;e=h});y.add(w).click(function(G){G.preventDefault();G.stopPropagation();i.hide();g.find("img").fadeOut(200);setTimeout(function(){B.src=e},200);m.css("-webkit-box-shadow","none")})}m.hover(function(G){G.stopPropagation();$(this).addClass("hovered");i.fadeIn(200)},function(G){G.stopPropagation();$(this).removeClass("hovered");i.fadeOut(200)});$(window).resize(function(){m.css({top:$(window).scrollTop()+($(window).height()/2-B.height/2)});if($(window).height()<=t){s=$(window).height();l=$(window).height()*E;g.find("img").css({height:s,width:l});m.height($(window).height()).width(g.find("img").width())}else{g.find("img").css({width:j,height:t})}});i.fadeIn(200);m.css({"-webkit-box-shadow":"0 0 30px rgba(0,0,0,0.4)","-moz-box-shadow":"0 0 30px rgba(0,0,0,0.4)","box-shadow":"0 0 30px rgba(0,0,0,0.4)"});f.call();if(u.length>0&&$group.length>1){v.css("height",i.height());setTimeout(function(){if(!m.hasClass("hovered")){m.mouseleave()}},1500)}else{if(u.length==0){i.css("background","transparent")}}})};B.src=e});$(window).bind("keydown",function(E){if(E.keyCode==27){$("#lightbox-close a").click()}if(E.keyCode==37){w.click()}if(E.keyCode==39){y.click()}});k.add("#lightbox-close").click(function(E){E.preventDefault();m.remove();k.fadeOut(500,function(){k.remove();B=""});$(window).unbind("resize")})})};$.fn.verify=function(){var d="",h="",i=$(this).closest("form"),b=i.find("input[type=submit]"),a,f,g,e,c;i.find(".required").addClass("notValidated");$(this).live("focus blur",function(j){if(j.type=="focusin"||j.type=="focus"){$(this).closest("li").addClass("beingTypedIn")}else{$(this).closest("li").removeClass("beingTypedIn");$(this).keyup();$(this).removeAttr("style")}});$(this).bind("keyup",function(j){if(typeof(a)=="undefined"){a=$(this).css("border-top-color"),f=$(this).css("border-right-color"),g=$(this).css("border-bottom-color"),e=$(this).css("border-left-color"),c=$(this).css("background-color")}d=$(this).closest("li");h=$(this).prevAll("label");$.fn.markAsInvalid=function(){$(this).removeAttr("style").addClass("notValidated");d.removeClass("empty").addClass("empty");d.find(".required-star,.required-ok").remove();d.append("<span class='required-star'><img src='img/required-star.png' alt='*' /></span>");b.attr("disabled","disabled").addClass("submit-disabled")};$.fn.markAsValid=function(){d.removeClass("empty").find(".required-star,.required-ok").remove();d.append("<span class='required-ok'><img src='img/required-ok.png' alt='v' /></span>");if($(this).hasClass("notValidated")){$(this).animate({borderTopColor:"#0a0",borderBottomColor:"#0a0",borderLeftColor:"#0a0",borderRightColor:"#0a0",backgroundColor:"#cfc"},100,"easeInExpo",function(){$(this).animate({borderTopColor:a,borderBottomColor:a,borderLeftColor:a,borderRightColor:a,backgroundColor:c},500,"easeInExpo",function(){if(!($(this).hasClass("beingTypedIn"))){$(this).removeAttr("style")}})})}$(this).removeClass("notValidated");if(i.find(".notValidated").size()==0){b.removeAttr("disabled").removeClass("submit-disabled")}};$.fn.doCheck=function(){if($(this).val().length>0){if($(this).hasClass("email")){var k=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);if(k.test($(this).val())){$(this).markAsValid()}else{$(this).markAsInvalid()}}else{$(this).markAsValid()}}else{$(this).markAsInvalid()}};if(!(j.keyCode==9)){$(this).doCheck()}})};
