

	//Animate scroll anchor

	$(function(){

	    $('a[href*=#]').click(function() {

	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 

	        && location.hostname == this.hostname) {

	            var $target = $(this.hash);

	            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

	            

	            if ($target.length) {

	                var targetOffset = $target.offset().top;

	                $('html,body').animate({scrollTop: targetOffset}, 1000);

	                return false;

	            }

	        }

	    });

	});





	//Ajouter un rel=blank pour simuler un target=blank

	$.fn.addTargetBlank = function() {

	$(this).click(function(){

			window.open(this.href);

			return false;

		});

	};







	/* Inputs setup (empty onfocus, fill onblur

    ----------------------------------------------------------- */

	$.fn.prepareFields = function() {

		this.labelEl = $("label[for='"+$(this).attr('name')+"']");

		this.oldval;

		this.newVal = this.labelEl.html();

			

		if(this.newVal != null) $(this).val(this.newVal);

		this.labelEl.addClass('hide');

		

		$(this).focus(function(){

			this.oldval = $(this).val();

			$(this).val('');	

			

			$(this).blur(function(){

				if($(this).val() == ''){

					$(this).val(this.oldval);		

				}

			});	

		});

	};





// ---------------------------------------------------



$(document).ready(function () {			



// ---------------------------------------------------



	// Initialise la fonction addTargetBlank */

	$('a[rel="blank"]').addTargetBlank();



	

	// Clear focus

	var clearMePrevious = '';

	

	$('.clearfocus').focus(function()

	{

		if($(this).val()==$(this).attr('title'))

		{

			clearMePrevious = $(this).val();

			$(this).val('');

		}

	});

	

	$('.clearfocus').blur(function()

	{

		if($(this).val()=='')

		{

			$(this).val(clearMePrevious);

		}

	});





	// custom easing called "custom"

	$.easing.custom = function (x, t, b, c, d) {

		//alert(jQuery.easing.default);

		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);

	}





	// select #flowplanes and make it scrollable. use circular and navigator plugins

	$("#flowpanes").scrollable({

			circular: true,

			mousewheel: false,

			easing: 'custom',

			speed: 1000,

			clickable: false

		})

		.autoscroll({ 

			autoplay: true,

			steps: 1,

			interval: 4500

		})

		.navigator({

			navi: "#flowtabs",

			naviItem: 'a',

			activeClass: 'current',

			history: true

	});
	window.api = $("#flowpanes").scrollable; 

	

	

	//Hide (Collapse) the toggle containers on load

		$(".toggle").next().hide(); 

	

		//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)

		$(".toggle").click(function(event){

			$(this).next().slideToggle("fast");

			$(this).toggleClass("active");

			event.preventDefault();

		});

	

	

	$('#printId').click(function(event) {

	  window.print();

	  return false;

	  event.preventDefault();

	 });

	

// ---------------------------------------------------

	

});



//---------------------------------------------------
