$(document).ready(function(){
/*
$.cookiesDirective({
privacyPolicyUri: '',
affichDiv:'cookiesdirectiveBM',
explicitConsent:false
});
$(".refusesubmit").click(function(){
$("#refusesubmit").trigger("click");
});
*/
$('[data-toggle="tooltip"]').tooltip()
$(".validate").validate();
$("a#btnTop").click(function(e) {
e.preventDefault();
$("html, body").animate({scrollTop: 0}, 500, "linear");
$(this).trigger("blur");
});
$("a.back").click(function(event) {
event.preventDefault();
history.back(1);
});
$("a.print").click(function(e){
e.preventDefault();
window.print();
});
$(".scrollTo").click(function(e) {
e.preventDefault();
var target = $(this).attr("data-scrollto-target") != undefined ? $($(this).attr("data-scrollto-target"), $(this).attr("href")) : $(this).attr("href");
var offset = $(this).attr("data-scrollto-offset") != undefined ? parseInt($(this).attr("data-scrollto-offset")) : 0;
if($(target).length) {
var top_offset = $(window).scrollTop > 0 ? - $(header).innerHeight() + offset : -75 + offset;
var top = Math.ceil($(target).offset().top + top_offset);
$("html, body").animate({scrollTop: top}, 400, "easeOutCubic");
}
$(this).trigger("blur");
});
$('select.redirect').change(function() {
window.location = $(':selected',this).attr('value')
});
$('.diaporamaslider').bxSlider({
mode: 'fade',
captions: true
});
$('.csbuttons').cSButtons();
assign_bootstrap_mode();
var resizeH = [];
var timer_resizeH;
$("[data-resizeh]").each(function() {
if($.inArray($(this).attr("data-resizeh"), resizeH) == -1) resizeH.push($(this).attr("data-resizeh"));
});
$(window).resize(function() {
assign_bootstrap_mode();
setTimeout(function() {
for(var i = 0, length = resizeH.length; i < length; i++) {
var height = 0;
$("[data-resizeh='" + resizeH[i] + "']").css("height", "").each(function() {
if($(this).innerHeight() > height) height = $(this).innerHeight();
}).css("height", height);
}
}, 200);
}).trigger("resize");
});
function assign_bootstrap_mode() {
width = $( window ).width();
var mode = '';
if (width<768) {
mode = "mode-xs";
}
else if (width<992) {
mode = "mode-sm";
}
else if (width<1200) {
mode = "mode-md";
}
else if (width>1200) {
mode = "mode-lg";
}
$("body").removeClass("mode-xs").removeClass("mode-sm").removeClass("mode-md").removeClass("mode-lg").addClass(mode);
}