/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
 
 ////////////////////////////////*
 /* formvalidation.js
 * http://www.rainbow-studio.net/
 *
 * Pré-validation de formulaire
*/

validation = function() {
	$('#subForm').before('<div class="error_message error-nl"></div>'); // Créé le bloc d'affichage des erreurs
	
	$(".error-nl").hide(); // Cache le bloc d'affichage des erreurs
	
	$("#subForm").submit(function() 
	{ 
		// Si un champ est vide ou incorrect:
		if ($("#name").val() == '' || $("#vktllr-vktllr").val() == '' || !$("#vktllr-vktllr").val().match(/^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-zA-Z]{2,4}$/)) {
			
			$(".error_message").html('<ul></ul>');
			
			//////////////////////////// Nom ////////////////////////////////
			if ($("#name").val() == '' ) {
				$("#name").parent('div').addClass("fb_invalid");
				$(".error_message ul").append("<li>Veuillez indiquer vos nom et prénom.</li>");						
			}
			
								
			//////////////////////////////// Mail ////////////////////////////////////
			
			if (($("#vktllr-vktllr").val() == '' )){
				$("#vktllr-vktllr").parent('div').addClass("fb_invalid");
				$(".error_message ul").append("<li>Veuillez indiquer votre adresse email.</li>");
			} 
			
			
			//////////////// Vérifie si l'adresse mail est valide ////////////////////
			
			else if ((!$("#vktllr-vktllr").val().match(/^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-zA-Z]{2,4}$/))){
				$("#vktllr-vktllr").parent('div').addClass("fb_invalid");
				$(".error_message ul").append("<li>Votre adresse email est erronée. Veuillez la corriger.</li>");
			}
					
			
			$(".error_message").fadeIn(); // Affiche la boite d'erreur
			
			
			return false; // bloque l'envoi du formulaire
			
		}
		else {
			
			return true; // Envoi du formulaire
			
		}
	}); 
};


///////////////////////
//     Menu hover    //
///////////////////////

(function($) {
	
	var methods = {
			init 	: function( options ) {
				
				if( this.length ) {
					
					var settings = {
						// configuration for the mouseenter event
						animMouseenter		: {
							'mText' : {speed : 350, easing : 'easeOutExpo', delay : 140, dir : 1},
							'sText' : {speed : 350, easing : 'easeOutExpo', delay : 0, dir : 1},
							'icon'  : {speed : 350, easing : 'easeOutExpo', delay : 280, dir : 1}
						},
						// configuration for the mouseleave event
						animMouseleave		: {
							'mText' : {speed : 300, easing : 'easeInExpo', delay : 140, dir : 1},
							'sText' : {speed : 300, easing : 'easeInExpo', delay : 280, dir : 1},
							'icon'  : {speed : 300, easing : 'easeInExpo', delay : 0, dir : 1}
						},
						// speed for the item bg color animation
						boxAnimSpeed		: 150,
						// default text color (same defined in the css)
						defaultTextColor	: '#ff',
						// default bg color (same defined in the css)
						defaultBgColor		: '#68AF22',
						// Couleur du fond lors du rollover
						hoverBgColor 		: '#7FBF36'
					};
					
					return this.each(function() {
						
						// if options exist, lets merge them with our default settings
						if ( options ) {
							$.extend( settings, options );
						}
						
						var $el 			= $(this),
							// the menu items
							$menuItems		= $el.children('li'),
							// save max delay time for mouseleave anim parameters
						maxdelay	= Math.max( settings.animMouseleave['mText'].speed + settings.animMouseleave['mText'].delay ,
												settings.animMouseleave['sText'].speed + settings.animMouseleave['sText'].delay ,
												settings.animMouseleave['icon'].speed + settings.animMouseleave['icon'].delay
											  ),
							// timeout for the mouseenter event
							// lets us move the mouse quickly over the items,
							// without triggering the mouseenter event
							t_mouseenter;
						
						// save default top values for the moving elements:
						// the elements that animate inside each menu item
						$menuItems.find('.sti-item').each(function() {
							var $el	= $(this);
							$el.data('deftop', $el.position().top);
						});
						
						// ************** Events *************
						// mouseenter event for each menu item
						$menuItems.bind('mouseenter', function(e) {
							
							clearTimeout(t_mouseenter);
							
							var $item		= $(this),
								$wrapper	= $item.children('a'),
								wrapper_h	= $wrapper.height(),
								// the elements that animate inside this menu item
								$movingItems= $wrapper.find('.sti-item'),
								// the color that the texts will have on hover
								hovercolor	= '#fff';
							
							t_mouseenter	= setTimeout(function() {
								// indicates the item is on hover state
								$item.addClass('sti-current');
								
								$movingItems.each(function(i) {
									var $item			= $(this),
										item_sti_type	= $item.data('type'),
										speed			= settings.animMouseenter[item_sti_type].speed,
										easing			= settings.animMouseenter[item_sti_type].easing,
										delay			= settings.animMouseenter[item_sti_type].delay,
										dir				= settings.animMouseenter[item_sti_type].dir,
										// if dir is 1 the item moves downwards
										// if -1 then upwards
										style			= {'top' : -dir * wrapper_h + 'px'};
									
									if( item_sti_type === 'icon' ) {
										// this sets another bg image for the icon
										style.backgroundPosition	= 'bottom left';
									} else {
										style.color					= hovercolor;
									}
									// we hide the icon, move it up or down, and then show it
									$item.hide().css(style).show();
									clearTimeout($item.data('time_anim'));
									$item.data('time_anim',
										setTimeout(function() {
											// now animate each item to its default tops
											// each item will animate with a delay specified in the options
											$item.stop(true)
												 .animate({top : $item.data('deftop') + 'px'}, speed, easing);
										}, delay)
									);
								});
								// animate the bg color of the item
								$wrapper.stop(true).animate({
									backgroundColor: settings.hoverBgColor
								}, settings.boxAnimSpeed );
							
							}, 100);	

						})
						// mouseleave event for each menu item
						.bind('mouseleave', function(e) {
							
							clearTimeout(t_mouseenter);
							
							var $item		= $(this),
								$wrapper	= $item.children('a'),
								wrapper_h	= $wrapper.height(),
								$movingItems= $wrapper.find('.sti-item');
							
							if(!$item.hasClass('sti-current')) 
								return false;		
							
							$item.removeClass('sti-current');
							
							$movingItems.each(function(i) {
								var $item			= $(this),
									item_sti_type	= $item.data('type'),
									speed			= settings.animMouseleave[item_sti_type].speed,
									easing			= settings.animMouseleave[item_sti_type].easing,
									delay			= settings.animMouseleave[item_sti_type].delay,
									dir				= settings.animMouseleave[item_sti_type].dir;
								
								clearTimeout($item.data('time_anim'));
								
								setTimeout(function() {
									
									$item.stop(true).animate({'top' : -dir * wrapper_h + 'px'}, speed, easing, function() {
										
										if( delay + speed === maxdelay ) {
											
											$wrapper.stop(true).animate({
												backgroundColor: settings.defaultBgColor
											}, settings.boxAnimSpeed );
											
											$movingItems.each(function(i) {
												var $el				= $(this),
													style			= {'top' : $el.data('deftop') + 'px'};
												
												if( $el.data('type') === 'icon' ) {
													style.backgroundPosition	= 'top left';
												} else {
													style.color					= settings.defaultTextColor;
												}
												
												$el.hide().css(style).show();
											});
											
										}
									});
								}, delay);
							});
						});
						
					});
				}
			}
		};
	
	$.fn.iconmenu = function(method) {
		if ( methods[method] ) {
			return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
			return methods.init.apply( this, arguments );
		} else {
			$.error( 'Method ' +  method + ' does not exist on jQuery.iconmenu' );
		}
	};
	
})(jQuery);



/////////////////////////
//      SudoSlider     //
/////////////////////////

/* Sudo Slider v. 2.1.6 */
(function(i){i.fn.sudoSlider=function(aa){var c=false,e=!c,g=this,aa=i.extend({controlsShow:e,controlsFadeSpeed:400,controlsFade:e,insertAfter:e,firstShow:c,lastShow:c,vertical:c,speed:800,ease:"swing",auto:c,pause:2E3,continuous:c,prevNext:e,numeric:c,numericAttr:'class="controls"',numericText:[],clickableAni:c,history:c,speedhistory:400,autoheight:e,customLink:c,fade:c,crossFade:e,fadespeed:1E3,updateBefore:c,ajax:c,preloadAjax:100,startSlide:c,ajaxLoadFunction:c,beforeAniFunc:c,afterAniFunc:c,
uncurrentFunc:c,currentFunc:c,prevHtml:'<a href="#" class="prevBtn"> previous </a>',nextHtml:'<a href="#" class="nextBtn"> next </a>',loadingText:"Loading Content...",firstHtml:'<a href="#" class="firstBtn"> first </a>',controlsAttr:'id="controls"',lastHtml:'<a href="#" class="lastBtn"> last </a>',autowidth:e,slideCount:1,resumePause:c,moveCount:1},aa);return this.each(function(){function fa(d,p){l=0;for(b in I)a[l]=I[b],l++;w=c;E=e;r=d.children("ul");m=r.children("li");k=m.length;if(a[25]&&(r.length==
0&&d.append(r=i("<ul></ul>")),a[25].length>k)){for(b=1;b<=a[25].length-k;b++)r.append("<li><p>"+a[35]+"</p></li>");m=r.children("li");k=m.length}z=h=0;J=k-1;o=e;K=s=ba=c;U=[];w=c;d.css("position")=="static"&&d.css("position","relative");m.css({"float":"left",display:"block"});a[40]=n(a[40]);a[42]--;u=a[40];a[21]||(a[40]+=a[42]);a[27]=n(a[27])||1;L=a[11]&&(!a[21]||a[40]>1);for(b=0;b<k;b++)a[15][b]=a[15][b]||b+1,a[25][b]=a[25][b]||c;for(f=0;f<k;f++)v[f]==void 0&&(v[f]=[]),v[f].push(m.eq(f));if(L){for(f=
a[40];f>=1;f--){var M=t(-a[40]+f-1),q=t(a[40]-f),j=m.eq(M).clone(),N=m.eq(q).clone();v[M].push(j);v[q].push(N);r.prepend(j).append(N)}x=r.children("li");if(a[25])for(b=k-a[40];b<k;b++)a[25][b]&&b!=a[27]-1&&A(b,c,0,c)}a[2]=a[2]&&!a[11];r[a[6]?"height":"width"](1E7);x=r.children("li");B=c;if(a[0]){B=i("<span "+a[37]+"></span>");i(d)[a[3]?"after":"before"](B);if(a[13]){ga=B.prepend("<ol "+a[14]+"></ol>").children();l=a[13]=="pages"?u:1;for(b=0;b<k-(a[11]||a[13]=="pages"?1:u)+1;b+=l)U[b]=i("<li rel='"+
(b+1)+"'><a href='#'><span>"+a[15][b]+"</span></a></li>").appendTo(ga).click(function(){F(i(this).attr("rel")-1,e);return c})}a[4]&&(ha=V(a[36],"first"));a[5]&&(ia=V(a[38],"last"));a[12]&&(ja=V(a[34],"next"),ka=V(a[33],"prev"))}if(a[26]===e)for(f=0;f<=J;f++)a[25][f]&&a[27]-1!=f&&A(f,c,0,c);l=[1,7,10,18,23];for(b in l)a[n(l[b])]=ta(a[n(l[b])]);a[20]&&i(a[20]).live("click",function(){if(b=i(this).attr("rel"))b=="stop"?(a[9]=c,clearTimeout(y),O=c):b=="start"?(y=P(a[10]),a[9]=e):b=="block"?o=c:b=="unblock"?
o=e:o&&F(b==n(b)?b-1:b,e);return c});ca(x.slice(0,a[40]),e,function(){a[9]&&(y=P(a[10]));p?C(p,c,c,c):a[17]?(b=i(window),(f=b.hashchange)?f(W):(f=i.address)?f.change(W):b.bind("hashchange",W),W()):C(a[27]-1,c,c,c)})}function W(){a:{var d=location.hash.substr(1);for(f in a[15])if(a[15][f]==d)break a;f=d?h:0}E?C(f,c,c,c):f!=h&&F(f,c)}function la(){if(a[25]&&n(a[26]))for(b in a[25])if(a[25][b]){clearTimeout(X);X=setTimeout(function(){A(b,c,0,c)},n(a[26]));break}}function P(a){O=e;return setTimeout(function(){F("next",
c)},a)}function ta(a){return n(a)||a==0?n(a):a=="fast"?200:a=="normal"||a=="medium"?400:a=="slow"?600:400}function V(a,b){return i(a).prependTo(B).click(function(){F(b,e);return c})}function F(d,p,M){Q=c;if(!w){if(a[9]){var q=a[7];s&&a[22]?q=n(q*0.6):s&&(q=0);p?(clearTimeout(y),O=c,a[41]&&(y=P(q+a[41]))):y=P(a[10]+q)}a[21]?ma(d,p,M):(a[11]?(d=b=R(d),q=Math.abs(h-b),b<a[40]-u+1&&Math.abs(h-b-k)<q&&(d=b+k,q=Math.abs(h-b-k)),b>J-a[40]&&Math.abs(h-b+k)<q&&(d=b-k)):d=R(d),C(d,p,e,c,M))}}function na(d,
b,c){if(c)var c=ja,e=ia,j="next",N="last",h=a[5];else c=ka,e=ha,j="prev",N="first",h=a[4];if(a[0]){if(a[12])c[d?"fadeIn":"fadeOut"](b);if(h)e[d?"fadeIn":"fadeOut"](b)}if(a[20])i(a[20]).filter(function(){return i(this).attr("rel")==j||i(this).attr("rel")==N})[d?"fadeIn":"fadeOut"](b)}function oa(a,b){na(a,b,c);na(a<k-u,b,e)}function da(d){d=t(d)+1;if(a[13])for(b in U)pa(U[b],d);a[20]&&pa(i(a[20]),d)}function pa(d,p){d.filter&&(d.filter(".current").removeClass("current").each(function(){i.isFunction(a[31])&&
a[31].call(this,i(this).attr("rel"))}),d.filter(function(){l=i(this).attr("rel");if(a[13]=="pages")for(b=0;b<u;b++){if(l==p-b)return e}else return l==p;return c}).addClass("current").each(function(){i.isFunction(a[32])&&a[32].call(this,p)}))}function ca(a,b,c){function e(a,d){i(a).unbind("load").unbind("error");a.naturalHeight&&!a.clientHeight&&i(a).height(a.naturalHeight).width(a.naturalWidth);d?(d=="both"&&c(),j--,j==0&&c()):c()}var a=a.add(a.find("img")).filter("img"),j=a.length;if(!j)return c(),
this;a.each(function(){var a=this;i(a).load(function(){e(a)}).error(function(){e(a)});if(a.readyState=="complete")e(a);else if(a.readyState)a.src=a.src;else if(a.complete)e(a);else if(a.complete===void 0){var d=a.src;a.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";a.src=d}})}function Y(d,b){a[19]&&qa(d,b,e);a[39]&&qa(d,b,c)}function qa(a,b,e){S.ready(function(){ra(a,b,e);ca(m.eq(a),c,function(){ra(a,b,e)})})}function ra(d,b,e){d=t(d);l=m.eq(d)[e?"height":"width"]();
S.animate(e?{height:l}:{width:l},{queue:c,duration:b,easing:a[8]})}function ea(){r.css("margin-left",Z(h,false)).css("margin-top",Z(h,true))}function Z(d,b){d=x.eq(d+(L?a[40]:0));return d.length?-d.position()[b?"top":"left"]:0}function ua(){h=t(h);a[24]||da(h);ea();o=e;if(a[17]&&ba)window.location.hash=a[15][h];!s&&Q&&D(h,e)}function D(a,c){a=t(a);for(b in v[a])(c?va:wa)(v[a][b],a+1)}function va(d,b){i.isFunction(a[30])&&a[30].call(d,b)}function wa(d,b){i.isFunction(a[29])&&a[29].call(d,b)}function R(d){return d==
"next"?t(h+1+a[42]):d=="prev"?t(h-1-a[42]):d=="first"?0:d=="last"?J:n(d)}function A(d,b,h,q){X&&clearTimeout(X);var j=a[25][d],g=m.eq(d),f=h===e,h=h===e?0:h;s&&!a[22]&&n(a[23]*0.4);var k=c;i.ajax({url:j,success:function(a,j,i){i.getResponseHeader("Content-Type").substr(0,5)!="image"&&(k=e,g.html(a),sa(d,h,q,b,f,c))},complete:function(){if(!k)image=new Image,g.html("").append(image),image.src=j,sa(d,h,q,b,f,e)}});a[25][d]=c;I.ajax[d]=c}function sa(d,h,g,q,j,f){var k=m.eq(d);if(L){var o=c;for(b in v[d])o&&
v[d][b].replaceWith(i(k).clone()),o=e;x=r.children("li")}q&&Y(d,h);ca(k,e,function(){j===e&&ea();i.isFunction(g)&&g();la()});i.isFunction(a[28])&&a[28].call(k,n(d)+1,f);g==2&&(D(d,c),Q||(D(d,e),Q=e))}function ma(d,p,g){if(R(d)!=h&&!w&&o){K=c;a[24]&&da(R(d));if(!(f||f==0))var f=!p&&!a[9]&&a[17]?a[23]*(a[18]/a[7]):a[23],j=R(d);a[2]&&oa(j,a[1]);if(g)f=$,G&&G--;else if(a[25]){G=0;$=f;for(b=j;b<j+u;b++)a[25][b]&&(A(t(b),c,f,function(){ma(d,p,e)}),G++)}else G=c;if(!G)if(o=!p,Y(j,a[23]),D(j,c),a[22]){var k=
e,g=0;for(b=j;b<j+u;b++)f=m.eq(t(b)).clone().prependTo(S),i.isFunction(a[29])&&a[29].call(f,t(b)+1),f.css({"z-index":"100000",position:"absolute","list-style":"none",top:a[6]?g:0,left:a[6]?0:g}).hide().fadeIn(a[23],a[8],function(){screen.fontSmoothingEnabled&&this.style.removeAttribute("filter");s=o=e;if(k){C(j,c,c,c);if(a[17]&&p)window.location.hash=a[15][h];D(j,e);k=c}i(this).remove();s=c}),g+=m.eq(b)[a[6]?"outerHeight":"outerWidth"](e)}else{var l=n(f*0.6),r=f-l;x.each(function(){i(this).animate({opacity:1.0E-4},
{queue:c,duration:r,easing:a[8],complete:function(){s=o=e;C(j,c,c,c);o=!p;i(this).animate({opacity:1},{queue:c,duration:l,easing:a[8],complete:function(){screen.fontSmoothingEnabled&&this.style.removeAttribute("filter");if(a[17]&&p)window.location.hash=a[15][h];o=e;s=c;D(j,e)}})}})})}}}function C(d,f,g,i,j){if(o&&!w&&(d!=h||E)&&k>t(d)||i){i||(K=c);o=!f&&!a[9]?e:a[16];ba=f;z=h;h=d;a[24]&&da(h);var l=Math.sqrt(Math.abs(z-h));if(!(j||j==0))var j=!g?0:!f&&!a[9]?n(l*a[18]):n(l*a[7]),m=t(h);if(i)j=$,T&&
T--;else if(a[25]){a[25][m]&&(A(m,e,E||j,2),K=e);if(!s){i=z>h?h:z;l=z>h?z:h;T=0;$=j;for(b=i;b<=l;b++)b<=J&&b>=0&&a[25][b]&&(A(b,c,j,function(){C(d,f,g,e)}),T++)}for(b=m+1;b<=m+u;b++)a[25][b]&&A(b,c,0,c)}T||(!s&&!K&&(D(m,c),Q=e),s||Y(h,j),r.animate({marginTop:Z(h,true),marginLeft:Z(h,false)},{queue:c,duration:j,easing:a[8],complete:ua}),a[2]&&(j=a[1],!f&&!a[9]&&(j=a[18]/a[7]*a[1]),g||(j=0),s&&(j=n(a[23]*0.6)),oa(h,j)),E&&(a[25][m]||la()),E=c)}}function t(a){for(a=n(a);a<0;)a+=k;return a%k}function n(a){return parseInt(a,
10)}var E,r,m,x,k,h,z,J,o,ba,s,K,U,ga,w,B,ha,ia,ja,ka,y,H,$,T,G,O,b,l,f,L,u,Q=c,X,v=[],S=i(this),I=aa,a=[];fa(S,c);g.getOption=function(a){return I[a]};g.setOption=function(a,b){g.destroy();I[a]=b;g.init();return g};g.insertSlide=function(b,c,e){g.destroy();c>k&&(c=k);b="<li>"+b+"</li>";!c||c==0?r.prepend(b):m.eq(c-1).after(b);(c<=H||!c||c==0)&&H++;if(a[15].length<c)a[15].length=c;a[15].splice(c,0,e||n(c)+1);g.init();return g};g.removeSlide=function(b){b--;g.destroy();m.eq(b).remove();a[15].splice(b,
1);b<H&&H--;g.init();return g};g.goToSlide=function(a,b){F(a==n(a)?a-1:a,e,b);return g};g.block=function(){o=c;return g};g.unblock=function(){o=e;return g};g.startAuto=function(){a[9]=e;y=P(a[10]);return g};g.stopAuto=function(){a[9]=c;clearTimeout(y);O=c;return g};g.destroy=function(){H=h;B&&B.remove();w=e;i(a[20]).die("click");if(L)for(b=1;b<=a[40];b++)x.eq(b-1).add(x.eq(-b)).remove();ea();return g};g.init=function(){w&&fa(S,H);return g};g.adjust=function(a){a||(a=0);Y(f,a);return g};g.getValue=
function(a){return a=="currentSlide"?h+1:a=="totalSlides"?k:a=="clickable"?o:a=="destroyed"?w:a=="autoAnimation"?O:void 0}})}})(jQuery);


/*
History.js
https://github.com/balupton/history.js
*/
window.JSON||(window.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";return e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)d=rep[c],typeof d=="string"&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"use strict",typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var JSON=window.JSON,cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(a,b){"use strict";var c=a.History=a.History||{},d=a.jQuery;if(typeof c.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");c.Adapter={bind:function(a,b,c){d(a).bind(b,c)},trigger:function(a,b,c){d(a).trigger(b,c)},extractEventData:function(a,c,d){var e=c&&c.originalEvent&&c.originalEvent[a]||d&&d[a]||b;return e},onDomLoad:function(a){d(a)}},typeof c.init!="undefined"&&c.init()}(window),function(a,b){"use strict";var c=a.document,d=a.setTimeout||d,e=a.clearTimeout||e,f=a.setInterval||f,g=a.History=a.History||{};if(typeof g.initHtml4!="undefined")throw new Error("History.js HTML4 Support has already been loaded...");g.initHtml4=function(){if(typeof g.initHtml4.initialized!="undefined")return!1;g.initHtml4.initialized=!0,g.enabled=!0,g.savedHashes=[],g.isLastHash=function(a){var b=g.getHashByIndex(),c;return c=a===b,c},g.saveHash=function(a){return g.isLastHash(a)?!1:(g.savedHashes.push(a),!0)},g.getHashByIndex=function(a){var b=null;return typeof a=="undefined"?b=g.savedHashes[g.savedHashes.length-1]:a<0?b=g.savedHashes[g.savedHashes.length+a]:b=g.savedHashes[a],b},g.discardedHashes={},g.discardedStates={},g.discardState=function(a,b,c){var d=g.getHashByState(a),e;return e={discardedState:a,backState:c,forwardState:b},g.discardedStates[d]=e,!0},g.discardHash=function(a,b,c){var d={discardedHash:a,backState:c,forwardState:b};return g.discardedHashes[a]=d,!0},g.discardedState=function(a){var b=g.getHashByState(a),c;return c=g.discardedStates[b]||!1,c},g.discardedHash=function(a){var b=g.discardedHashes[a]||!1;return b},g.recycleState=function(a){var b=g.getHashByState(a);return g.discardedState(a)&&delete g.discardedStates[b],!0},g.emulated.hashChange&&(g.hashChangeInit=function(){g.checkerFunction=null;var b="",d,e,h,i;return g.isInternetExplorer()?(d="historyjs-iframe",e=c.createElement("iframe"),e.setAttribute("id",d),e.style.display="none",c.body.appendChild(e),e.contentWindow.document.open(),e.contentWindow.document.close(),h="",i=!1,g.checkerFunction=function(){if(i)return!1;i=!0;var c=g.getHash()||"",d=g.unescapeHash(e.contentWindow.document.location.hash)||"";return c!==b?(b=c,d!==c&&(h=d=c,e.contentWindow.document.open(),e.contentWindow.document.close(),e.contentWindow.document.location.hash=g.escapeHash(c)),g.Adapter.trigger(a,"hashchange")):d!==h&&(h=d,g.setHash(d,!1)),i=!1,!0}):g.checkerFunction=function(){var c=g.getHash();return c!==b&&(b=c,g.Adapter.trigger(a,"hashchange")),!0},g.intervalList.push(f(g.checkerFunction,g.options.hashChangeInterval)),!0},g.Adapter.onDomLoad(g.hashChangeInit)),g.emulated.pushState&&(g.onHashChange=function(b){var d=b&&b.newURL||c.location.href,e=g.getHashByUrl(d),f=null,h=null,i=null,j;return g.isLastHash(e)?(g.busy(!1),!1):(g.doubleCheckComplete(),g.saveHash(e),e&&g.isTraditionalAnchor(e)?(g.Adapter.trigger(a,"anchorchange"),g.busy(!1),!1):(f=g.extractState(g.getFullUrl(e||c.location.href,!1),!0),g.isLastSavedState(f)?(g.busy(!1),!1):(h=g.getHashByState(f),j=g.discardedState(f),j?(g.getHashByIndex(-2)===g.getHashByState(j.forwardState)?g.back(!1):g.forward(!1),!1):(g.pushState(f.data,f.title,f.url,!1),!0))))},g.Adapter.bind(a,"hashchange",g.onHashChange),g.pushState=function(b,d,e,f){if(g.getHashByUrl(e))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.pushState,args:arguments,queue:f}),!1;g.busy(!0);var h=g.createStateObject(b,d,e),i=g.getHashByState(h),j=g.getState(!1),k=g.getHashByState(j),l=g.getHash();return g.storeState(h),g.expectedStateId=h.id,g.recycleState(h),g.setTitle(h),i===k?(g.busy(!1),!1):i!==l&&i!==g.getShortUrl(c.location.href)?(g.setHash(i,!1),!1):(g.saveState(h),g.Adapter.trigger(a,"statechange"),g.busy(!1),!0)},g.replaceState=function(a,b,c,d){if(g.getHashByUrl(c))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(d!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.replaceState,args:arguments,queue:d}),!1;g.busy(!0);var e=g.createStateObject(a,b,c),f=g.getState(!1),h=g.getStateByIndex(-2);return g.discardState(f,e,h),g.pushState(e.data,e.title,e.url,!1),!0}),g.emulated.pushState&&g.getHash()&&!g.emulated.hashChange&&g.Adapter.onDomLoad(function(){g.Adapter.trigger(a,"hashchange")})},typeof g.init!="undefined"&&g.init()}(window),function(a,b){"use strict";var c=a.console||b,d=a.document,e=a.navigator,f=a.sessionStorage||!1,g=a.setTimeout,h=a.clearTimeout,i=a.setInterval,j=a.clearInterval,k=a.JSON,l=a.alert,m=a.History=a.History||{},n=a.history;k.stringify=k.stringify||k.encode,k.parse=k.parse||k.decode;if(typeof m.init!="undefined")throw new Error("History.js Core has already been loaded...");m.init=function(){return typeof m.Adapter=="undefined"?!1:(typeof m.initCore!="undefined"&&m.initCore(),typeof m.initHtml4!="undefined"&&m.initHtml4(),!0)},m.initCore=function(){if(typeof m.initCore.initialized!="undefined")return!1;m.initCore.initialized=!0,m.options=m.options||{},m.options.hashChangeInterval=m.options.hashChangeInterval||100,m.options.safariPollInterval=m.options.safariPollInterval||500,m.options.doubleCheckInterval=m.options.doubleCheckInterval||500,m.options.storeInterval=m.options.storeInterval||1e3,m.options.busyDelay=m.options.busyDelay||250,m.options.debug=m.options.debug||!1,m.options.initialTitle=m.options.initialTitle||d.title,m.intervalList=[],m.clearAllIntervals=function(){var a,b=m.intervalList;if(typeof b!="undefined"&&b!==null){for(a=0;a<b.length;a++)j(b[a]);m.intervalList=null}},m.debug=function(){(m.options.debug||!1)&&m.log.apply(m,arguments)},m.log=function(){var a=typeof c!="undefined"&&typeof c.log!="undefined"&&typeof c.log.apply!="undefined",b=d.getElementById("log"),e,f,g,h,i;a?(h=Array.prototype.slice.call(arguments),e=h.shift(),typeof c.debug!="undefined"?c.debug.apply(c,[e,h]):c.log.apply(c,[e,h])):e="\n"+arguments[0]+"\n";for(f=1,g=arguments.length;f<g;++f){i=arguments[f];if(typeof i=="object"&&typeof k!="undefined")try{i=k.stringify(i)}catch(j){}e+="\n"+i+"\n"}return b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||l(e),!0},m.getInternetExplorerMajorVersion=function(){var a=m.getInternetExplorerMajorVersion.cached=typeof m.getInternetExplorerMajorVersion.cached!="undefined"?m.getInternetExplorerMajorVersion.cached:function(){var a=3,b=d.createElement("div"),c=b.getElementsByTagName("i");while((b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window);





////////////////////////////////
//         General            //
////////////////////////////////

function general(){

	var sudoSlider = $("#slider").sudoSlider({
		numeric:true,
		prevNext:false,
		fade:true,
		auto:true,
		pause:3000,
		crossFade:false,
		numericText:[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
	});
	
	$('a.colorbox').colorbox({maxWidth:'80%', maxHeight:'80%'});
	
	//////////////////////////////////////////
	// Roll-over du menu #sub_nav 
	
	$('#sti-menu').iconmenu({
		animMouseenter	: {
			'mText' : {speed : 300, easing : 'easeOutBack', delay : 200, dir : -1},
			'sText' : {speed : 400, easing : 'easeOutBack', delay : 400, dir : -1},
			'icon'  : {speed : 400, easing : 'easeOutBack', delay : 0, dir : -1}
		},
		animMouseleave	: {
			'mText' : {speed : 0, easing : 'easeInExpo', delay : 0, dir : 1},
			'sText' : {speed : 0, easing : 'easeInExpo', delay : 0, dir : 1},
			'icon'  : {speed : 0, easing : 'easeInExpo', delay : 0, dir : -1}
		}
	});
	
	$('.page_interne #sti-menu').iconmenu({
		animMouseenter	: {
			'mText' : {speed : 300, easing : 'easeOutExpo', delay : 200, dir : 1},
			'sText' : {speed : 400, easing : 'easeOutBack', delay : 400, dir : -1},
			'icon'  : {speed : 400, easing : 'easeOutBack', delay : 0, dir : -1}
		},
		animMouseleave	: {
			'mText' : {speed : 0, easing : 'easeInExpo', delay : 0, dir : -1},
			'sText' : {speed : 0, easing : 'easeInExpo', delay : 0, dir : 1},
			'icon'  : {speed : 0, easing : 'easeInExpo', delay : 0, dir : -1}
		}
	});
	
	//$('#right_side_content').wrap('<div id="right_side_content_wrapper"></div>');
	/*
	if(index_page == true){
		jQuery.cookie('colorbox', null);
	}
	
	
	if (jQuery.cookie('colorbox')!='1') {
    	jQuery.colorbox({ html:'<a href="http://www.happly.fr/news/happly-present-aux-microsoft-techdays-2012.html" title="Inscrivez-vous gratuitement aux Microsoft Techdays 2012"><img src="http://www.happly.fr/lightbox/happly_techdays.jpg" width="800" height="479"/></a>', innerWidth:'810px', innerHeight:'489px', onLoad:function(){ jQuery.cookie('colorbox','1'); index_page = false; }});
   	}
	*/
}
	
$(document).ready(function(){
	general();
});


// https://gist.github.com/854622
(function(window,undefined){
	
	// Prepare our Variables
	var
		History = window.History,
		$ = window.jQuery,
		document = window.document;

	// Check to see if History.js is enabled for our Browser
	if ( !History.enabled ) {
		return false;
	}

	// Wait for Document
	$(function(){
				
				
		// Prepare Variables
				
		var
			/* Application Specific Variables */
			contentSelector = '#loader_wrap',
			$content = $(contentSelector).filter(':first'),
			$contentWrapper = $('#loader_wrap'),
			contentNode = $content.get(0),
			$menu = $('#header nav, nav#sub_nav').filter(':first'),
			activeClass = 'active selected current youarehere',
			activeSelector = '.active,.selected,.current,.youarehere',
			menuChildrenSelector = '> li,> ul > li',
			/* Application Generic Variables */
			$body = $(document.body),
			rootUrl = History.getRootUrl(),
			scrollOptions = {
				duration: 800,
				easing:'swing'
			};
		
		
		// Internal Helper
		$.expr[':'].internal = function(obj, index, meta, stack){
			// Prepare
			var
				$this = $(obj),
				url = $this.attr('href')||'',
				isInternalLink;
				
			
			// Check link
			isInternalLink = url.substring(0,rootUrl.length) === rootUrl || url.indexOf(':') === -1;
			
			// Ignore or Keep
			return isInternalLink;
		};
		
		// HTML Helper
		var documentHtml = function(html){
			// Prepare
			var result = String(html)
				.replace(/<\!DOCTYPE[^>]*>/i, '')
				.replace(/<(html|head|body|title|meta|script)([\s\>])/gi,'<div class="document-$1"$2')
				.replace(/<\/(html|head|body|title|meta|script)\>/gi,'</div>')
			;
			
			// Return
			return result;
		};
		
		
		// Ajaxify Helper
		$.fn.ajaxify = function(){
			// Prepare
			var $this = $(this);
			
			// Ajaxify
			$this.find('#logo_header a, #header nav a, nav#sub_nav a, nav#index_sub_nav a, div#arrow a, ul.niveau3_liens li a, a.retour_level3, a#retour_home, a.lien_interne, a.news_link').click(function(event){
				// Prepare
				var
					$this = $(this),
					url = $this.attr('href'),
					title = $this.attr('title')||null;
				
				if ($this.parents('ul').attr('class') == 'niveau3_liens' || $this.is('.retour_level3') || $this.is('.news_link')){
					
					contentSelector = '#right_side_content';
					$content = $(contentSelector).filter(':first');	
					
					$('#content_wrapper').removeClass('top_page');
					
												
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.fadeTo(800, 0);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().fadeTo(800, 1);
					}
					
										
					updateMenu = function(relativeUrl) {
						$menu = $('nav#sub_nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', 1);
					
				} 
				else if ($this.parents('nav').attr('id') == 'sub_nav'){
					
					contentSelector = '#right_side_content';
					$content = $(contentSelector).filter(':first');	
					
					//$('#content_wrapper').removeClass('top_page');
					
												
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({top:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('top','200%').animate({top:'0'},800);
					}
										
					updateMenu = function(relativeUrl) {
						$menu = $('nav#sub_nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', 1);
				} 
				else if( $this.attr('id') == 'pageNext') {
					contentSelector = '#right_side_content';
					$content = $(contentSelector).filter(':first');	
					
					$('#content_wrapper').removeClass('top_page');
					
												
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({top:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('top','200%').animate({top:'0'},800);
					}
										
					updateMenu = function(relativeUrl) {
						$menu = $('nav#sub_nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', 1);
					
				} 
				else if ($this.attr('id') == 'pagePrev') {
					
					contentSelector = '#right_side_content';
					$content = $(contentSelector).filter(':first');	
					
					$('#content_wrapper').removeClass('top_page');
									
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({top:'100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('top','-200%').animate({top:'0'},800);
					}
										
					updateMenu = function(relativeUrl) {
						$menu = $('nav#sub_nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', 1);
				}
				
				else if ($this.attr('class') == 'lien_interne') {
					contentSelector = '#right_side_content';
					$content = $(contentSelector).filter(':first');	
					
					$('#content_wrapper').removeClass('top_page');
					
												
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({top:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('top','200%').animate({top:'0'},800);
					}
										
					updateMenu = function(relativeUrl) {
						$menu = $('nav#sub_nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', 1);
				}
				 
				else if($this.parents('nav').attr('id') == 'index_sub_nav'){
					
					contentSelector = '#loader_wrap';
					$content = $(contentSelector).filter(':first');		
																
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({left:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('left','200%').animate({left:'0'},800);
					}
					
					updateMenu = function(relativeUrl) {
						$menu = $('#header nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', 1);
				}
				else if($this.attr('id') == "home_btn") {
					
					contentSelector = '#loader_wrap';
					$content = $(contentSelector).filter(':first');		
											
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({left:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('left','200%').animate({left:'0'},800);
					}
					
					updateMenu = function(relativeUrl) {
						$menu = $('#header nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', null);
										
				}
				
				else if($this.parent('h1').attr('id') == "logo_header") {
					
					contentSelector = '#loader_wrap';
					$content = $(contentSelector).filter(':first');		
											
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({left:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('left','200%').animate({left:'0'},800);
					}
					
					updateMenu = function(relativeUrl) {
						$menu = $('#header nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}
					
					//jQuery.cookie('colorbox', null);
					
				}
				
				else {
					
					contentSelector = '#loader_wrap';
					$content = $(contentSelector).filter(':first');		
											
					//Ensure Content
					if ( $content.length === 0 ) {
						$content = $body;
					}
					
					masque = function(){
						$content.animate({left:'-100%'},800);
					}	
					
					affiche = function(contentHtml){
						$content.html(contentHtml).ajaxify().css('left','200%').animate({left:'0'},800);
					}
					
					updateMenu = function(relativeUrl) {
						$menu = $('#header nav').filter(':first'),
						
						$menuChildren = $menu.find(menuChildrenSelector);
						$menuChildren.filter(activeSelector).removeClass(activeClass);
						$menuChildren = $menuChildren.has('a[href^="'+relativeUrl+'"],a[href^="/'+relativeUrl+'"],a[href^="'+url+'"]');
						if ( $menuChildren.length === 1 ) { $menuChildren.addClass(activeClass); }
					}

										
				}
				
				// Continue as normal for cmd clicks etc
				if ( event.which == 2 || event.metaKey ) { return true; }
				
				// Ajaxify this link
				History.pushState(null,title,url);
				event.preventDefault();
				return false;
			});
			
			// Chain
			return $this;
		};
		
		// Ajaxify our Internal Links
		$body.ajaxify();
		
		// Hook into State Changes
		$(window).bind('statechange',function(){
			// Prepare Variables
			var
				State = History.getState(),
				url = State.url,
				relativeUrl = url.replace(rootUrl,'');

			// Set Loading
			$body.addClass('loading');

			// Start Fade Out
			// Animating to opacity to 0 still keeps the element's height intact
			// Which prevents that annoying pop bang issue when loading in new content
			//$content.animate({marginTop:'-100%'},800);
			
			masque();
			
			
			// Ajax Request the Traditional Page
			$.ajax({
				url: url,
				success: function(data, textStatus, jqXHR){
					// Prepare
					var
						$data = $(documentHtml(data)),
						$dataBody = $data.find('.document-body:first'),
						$dataContent = $dataBody.find(contentSelector).filter(':first'),
						$menuChildren, contentHtml, $scripts;
					
					// Fetch the scripts
					$scripts = $dataContent.find('.document-script');
					if ( $scripts.length ) {
						$scripts.detach();
					}

					// Fetch the content
					contentHtml = $dataContent.html()||$data.html();
					if ( !contentHtml ) {
						document.location.href = url;
						return false;
					}
					
					// Update the menu
					updateMenu(relativeUrl);
					$('#sub_nav span').each(function() {
                       $(this).css("top","auto"); 
                    });
					// Update the content
					$content.stop(true,true);
					//$content.html(contentHtml).ajaxify().css('margin-top','100%').animate({marginTop:'0'},800);
					affiche(contentHtml);
					
					
					//Réactive les fonction jQuery 
					
					validation();
					general();

					// Update the title
					document.title = $data.find('.document-title:first').text();
					try {
						document.getElementsByTagName('title')[0].innerHTML = document.title.replace('<','&lt;').replace('>','&gt;').replace(' & ',' &amp; ');
					}
					catch ( Exception ) { }
					
					// Add the scripts
					$scripts.each(function(){
						var $script = $(this), scriptText = $script.text(), scriptNode = document.createElement('script');
						scriptNode.appendChild(document.createTextNode(scriptText));
						contentNode.appendChild(scriptNode);
					});

					// Complete the change
					if ( $body.ScrollTo||false ) { $body.ScrollTo(scrollOptions); } /* http://balupton.com/projects/jquery-scrollto */
					$body.removeClass('loading');
	
					// Inform Google Analytics of the change
					if ( typeof window.pageTracker !== 'undefined' ) {
						window.pageTracker._trackPageview(relativeUrl);
					}

					// Inform ReInvigorate of a state change
					if ( typeof window.reinvigorate !== 'undefined' && typeof window.reinvigorate.ajax_track !== 'undefined' ) {
						reinvigorate.ajax_track(url);
						// we use the full url here as that is what reinvigorate supports
					}
					
					
				},
				error: function(jqXHR, textStatus, errorThrown){
					document.location.href = url;
					return false;
				}
			}); // end ajax

		}); // end onStateChange

	}); // end onDomLoad

})(window); // end closure
