function loading_in_progress(){
	$('#chargement_ico').css('display', '');
}
function loading_complete(){
	console.log('fini');
	$('#chargement_ico').css('display', 'none');
}
$(document).ready(function(){
	// Remove class no-js for non-intrusive js
    $("a,div,ul,button,label").removeClass("no-js");
	// Add class no-js for a11y
	$(".js").removeClass("js").addClass("no-js");
	// Add class js-active for a11y fonctionalities
	$("body").removeClass("no-js-active").addClass("js-active");

	// Put a label into a search input
	if (typeof addPlaceHolder == 'function') { addPlaceHolder(); }
	// End label search

	// Print
	if (typeof printJS == 'function') { printJS(); }
	// End Print

	// Go to the top
	if (typeof goOnTheTop == 'function') { goOnTheTop(); }
	// End go to the top

	// To keep hover in the dhtml menu
	$('#nav li.nav-lvl1 div').hover(
		function(){
			var el = $(this).parent().children('a.nav-lvl1');
			if (!el.hasClass('private-access'))
				el.addClass('nav-hover');
			},
		function() {
			var el = $(this).parent().children('a.nav-lvl1');
			el.removeClass('nav-hover');
		}
	);
	// End To keep hover in the dhtml menu

	/*$('#cnx_mdp, #cnx_user').hover(
		function(){
			var el = $("li.private-access").children('div');
			el.addClass('show');
			},
		function() {
			var el = $("li.private-access").children('div');
			el.removeClass('show');
		}
	);*/
	// A11Y Main Nav
	// $('#nav a.nav-lvl1').focusin(function(){
		// $(this).addClass('active');
		// var el = $(this).siblings('div');
		// el.addClass('show');
		// el.find('a').last().blur(function(){
			// el.removeClass('show');
			// $('#nav a').removeClass('active');
		// });
		// el.find('input.submit').last().blur(function(){
			// el.removeClass('show');
		// });
	// });
	// $('#nav a.nav-lvl1').focusout(function(){
		// var el = $(this).siblings('div');
		// el.removeClass('show');
		// $('#nav div').focusin(function(){
			// var el = $(this);
			// el.addClass('show');
			// el.find('a').last().blur(function(){
				// el.removeClass('show');
				// $('#nav a').removeClass('active');
			// });
			// el.find('input.submit').last().blur(function(){
				// el.removeClass('show');
			// });
		// });
		// $('#nav div').focusout(function(){
			// var el = $(this);
			// el.removeClass('show');
		// });
	// });
	// End A11Y Main Nav

	/* Slider */
	if($('#coda-slider-1').length && (typeof ($.fn.codaSlider) == 'function')) {
		$('#coda-slider-1').codaSlider({
			autoHeight:false,
			autoSlide: true,
			autoSlideInterval: 8000,
			autoSlideStopWhenClicked: true,
			dynamicArrows: false,
			dynamicTabs: false,
			slideEaseDuration: 300,
			slideEaseFunction: "easeInSine",
			slideDirection: "horizontal"
		});
	}
});

// Print
function printJS() {
	if ($('a.print').length) {
		$('a.print').click(function(){
			print();
			return false;
		});
	}
}
// End Print

// Go on the Top
function goOnTheTop() {
	$('.top').click(function() {
		$('html, body').animate({scrollTop: 0}, 'slow');
		return false;
	});
}
// End Go on the Top

/* PLACEHOLDER */
function addPlaceHolder() {
	var inputPlaceholder = $('input.placeholder');
	if(inputPlaceholder.length) {
		var oldInputPlaceholderValue = "";
		var nameInput = "";
		inputPlaceholder.each(function() {
			if ($(this).val() == "") {
				nameInput = $(this).attr('name');
				$('label').each(function() {
					if ($(this).attr("for") == nameInput ) {
						oldInputPlaceholderValue = $(this).html();
					}
				});
				$(this).val(oldInputPlaceholderValue).addClass('placeholder-disabled');
			}
			else {
				oldInputPlaceholderValue = $(this).val();
			}
		});
		inputPlaceholder.focus(function() {
			nameInput = $(this).attr('name');
				$('label').each(function() {
					if ($(this).attr("for") == nameInput ) {
						oldInputPlaceholderValue = $(this).html();
					}
				});
			if ($(this).val() == oldInputPlaceholderValue) {
				$(this).removeClass('placeholder-disabled').val('');
			}
		}).blur(function() {
			if ($(this).val() == '') {
				$(this).addClass('placeholder-disabled').val(oldInputPlaceholderValue);
			}
		});
	}
}
/* END PLACEHOLDER */
