var image_numbers = 118; var init_loop = "true"; var loop_interval = "15000"; //recuperation des variables GET var page='acceuil'; function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return unescape(pair[1]); } } return false; } // Tootlips jQuery.fn.Tooltip = function() { // For each instance of this element return this.each(function(){ // Add the new attribute with title's current value and then remove the title attribute jQuery(this).attr({'data-tooltip': jQuery(this).attr("title")}).removeAttr("title"); }); }; //lecture du cookie pour savoir di on fait un slideshow pour l'image de fond. !readCookie('sanigros_loop_background') ? createCookie('sanigros_loop_background', init_loop, 7) : null; //generation d'un numero aleatoire entre MinV et MaxV. function randomBetween(MinV, MaxV) { var formated_result = MinV + Math.floor((MaxV - MinV + 1) * (Math.random() % 1)); if (formated_result <= 9) formatted_result = '000' + formated_result; else if (formated_result <= 99) formatted_result = '00' + formated_result; else if (formated_result <= 999) formatted_result = '0' + formated_result; return formatted_result; } //demarrage du slideshow. function startLoop(){ looping = setInterval(function (){changeBackground('big_' + randomBetween(0, image_numbers) + '.jpg');}, loop_interval); eraseCookie('sanigros_loop_background'); createCookie('sanigros_loop_background', 'true', 7); //$('#loop').text('Arrêter'); $('#loop img').attr("src", 'images/wallpaper_on.png'); } //arret du slideshow. function stopLoop(){ clearInterval(looping); eraseCookie('sanigros_loop_background'); createCookie('sanigros_loop_background', 'false', 7); //$('#loop').text('Démarrer'); $('#loop img').attr("src", 'images/wallpaper_off.png'); } //toggle (oui/non) du slideshow. function toggleLoop(){ readCookie('sanigros_loop_background') == 'false'? startLoop() : stopLoop(); } //fonction pour l'agrandissement/retrecissement maxi du fond de la page function FullScreenBackground(theItem){ var winWidth=$(window).width(); var winHeight=$(window).height(); var imageWidth=$(theItem).width(); var imageHeight=$(theItem).height(); var picHeight = imageHeight / imageWidth; var picWidth = imageWidth / imageHeight; if ((winHeight / winWidth) < picHeight) { $(theItem).css("width",winWidth); $(theItem).css("height",picHeight*winWidth); } else { $(theItem).css("height",winHeight); $(theItem).css("width",picWidth*winHeight); }; $(theItem).css("margin-left", winWidth / 2 - $(theItem).width() / 2); $(theItem).css("margin-top", winHeight / 2 - $(theItem).height() / 2); } //fonction pour le changement du fond de la page. function changeBackground(imagename){ $('#data_loading').html('Image de fond…'); $('#data_loading').fadeIn('fast'); $('#bgimg').fadeOut('fast').remove(); var img = new Image(); $(img).load(function() { $(this).css('display', 'none'); $('#bg').append(this); $(this).fadeIn('slow'); FullScreenBackground(this); $('#data_loading').fadeOut('slow'); }).attr({ src: "images/background/" + imagename, id: "bgimg"}); } //s'il y a redimentionnement de la fenetre. $(window).resize(function() { FullScreenBackground('#bgimg'); }); $('#container').imagesLoaded( function(){ BuildWall(); }); function BuildWall(){ $('#container').masonry({ itemSelector : '#bloc', isFitWidth: true, isAnimated: true }); } //charger les "boites" function loadcontent(content, datatype, post_data){ if (!datatype) { var datatype = 'text'; } if (!post_data) { var post_data = ''; } $('#data_loading').html('Données…'); $('#data_loading').fadeIn('fast'); $('#container').fadeOut('slow', function(){ $('#bloc').removeClass(); if (datatype == 'text') { $(this).masonry( 'remove', $('#bloc')); $(this).append("