(function($){$(document).ready(function(){var i=false;$("#backgroundimage").append('<a href="" class="fleches" id="fleche_gauche"></a>','<a href="" class="fleches" id="fleche_droite"></a>');var j=$("#bottomFixed .menu a").length-1;var k=0;var l;$("#fleche_gauche").click(function(){if(!i){i=true;$("#bottomFixed .menu li").each(function(a){if($(this).attr('id')=="current"){k=a-1;if(a<=0){k=j}}});gotoItem($("#bottomFixed .menu li:eq("+k+")"))}return false});$("#fleche_droite").click(function(){if(!i){i=true;$("#bottomFixed .menu li").each(function(a){if($(this).attr('id')=="current"){k=a+1;if(a>=j){k=0}}});gotoItem($("#bottomFixed .menu li:eq("+k+")"))}return false});$("#bottomFixed .menu a").each(function(a){$(this).click(function(){if(!i){if($(this).parent().attr('id')!="current"){i=true;gotoItem($(this).parent())}}return false})});function gotoItem(g){$('#loading').css('display','block');$("#bottomFixed .menu li#current").removeClass('active').removeAttr('id');g.attr('id','current').addClass('active');var h=$('a',g).attr('href')+'?tmpl=backgroundimage';$.ajax({url:h,success:function(c){var d=$('img',$(c)[($(c).length-1)]).attr('src');var e=$('#supersize img').attr('style');var f=new Image();$(f).load(function(){$('#supersize img').before('<img src="'+d+'" style="'+e+'" alt="" />');$('#supersize img:eq(1)').fadeOut(500,function(){$(this).remove()});var b=$;b.ajax({url:$('a',g).attr('href')+'?tmpl=content',success:function(a){$('#cartouche').html(a)}});$('#loading').css('display','none');setTimeout(function(){i=false;restartSlideshow()},1000)}).attr('src',d)}})}function nextItem(b){if(!i){i=true;$("#bottomFixed .menu li").each(function(a){if($(this).attr('id')=="current"){b=a+1;if(a>=j){b=0}}});gotoItem($("#bottomFixed .menu li:eq("+b+")"))}}function goSlideshow(){l=setInterval(function(){k++;nextItem(k)},6000)}function restartSlideshow(){clearInterval(l);goSlideshow()}$('#positionnement').css('z-index',6);$('#click_positionnement').css('z-index',8);$('#positionnement').resizenow();$('#click_positionnement').resizenow();$('#loading_positionnement').remove();$('#click_positionnement').click(function(){$(this).remove();$('#positionnement').fadeOut('fast',function(){$(this).remove();$("#bottomFixed").animate({bottom:0},'fast');actif=true;goSlideshow()})})});$(window).bind("resize",function(){$('#positionnement').resizenow();$('#click_positionnement').resizenow()})})(jQuery);
