// JavaScript Document
$(document).ready(function() {
						   
		//PREPARATION MENU
		// On cache les sous-menus : 
		// sauf celui qui porte la classe "open_at_load" : 
		if (hideSubMenu == true) { $(".navigation ul.subMenu:not('.open_at_load')").hide(); }
		// On sélectionne tous les items de liste portant la classe "toggleSubMenu" 
	 
		// et on remplace l'élément span qu'ils contiennent par un lien : 
		$(".navigation li.toggleSubMenu span").each( function () { 
			// On stocke le contenu du span : 
			var TexteSpan = $(this).text(); 
			$(this).replaceWith('<a href="" title="Afficher le sous-menu">' + TexteSpan + '<\/a>') ; 
		} ) ; 
	 
		// On modifie l'évènement "click" sur les liens dans les items de liste 
		// qui portent la classe "toggleSubMenu" : 
		$(".navigation li.toggleSubMenu > a").click( function () { 
			// Si le sous-menu était déjà ouvert, on le referme : 
			if ($(this).next("ul.subMenu:visible").length != 0) { 
				$(this).next("ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("open") } ); 
			} 
			// Si le sous-menu est caché, on ferme les autres et on l'affiche : 
			else { 
				$(".navigation ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("open") }); 
				$(this).next("ul.subMenu").slideDown("normal", function () { $(this).parent().addClass("open") } ); 
			} 
			// On empêche le navigateur de suivre le lien : 
			return false; 
		});
	
		//MENU PRET END
		
		//INTERDIRE LE CLICK DROIT
		<!-- Disable 
		if (slideshow_statut == true){
			function disableselect(e){ 
			return false 
			} 
			
			function reEnable(){ 
			return true 
			} 
			
			//if IE4+ 
			document.onselectstart=new Function ("return false") 
			document.oncontextmenu=new Function ("return false") 
			//if NS6 
			if (window.sidebar){ 
			document.onmousedown=disableselect 
			document.onclick=reEnable 
			} 
			//--> 
		}
		//INTERDIRE LE CLICK DROIT END

		
		centerThis_Y('#wrapper');
		resizeWidth('#wrapper',$(window).width());
		var offsetPortfolio = $('#wrapper').offset();
		var widthWindow = $(window).width();
		
		
		
		if (widthWindow > 1400) {
			resizeWidth('#cadre',1400); //Onredimensionne le cadre qui contient les photos
			centerThis_X('#cadre');
			centerThis_X('#footer');
		} else {
			resizeWidth('#cadre',$('#wrapper').width()); //Onredimensionne le cadre qui contient les photos
		}
		var widthWrapper = $('#wrapper').width();
		
		
		var posCadre = $('#cadre').offset();
		posX('#sidebar',posCadre.left + 50);
		
		if (widthWindow < 1400 ) {
			posX('#photographe' , widthWindow - 250);
		} else {
			posX('#photographe' , posCadre.left + 1150);
		}
		if (widthWrapper < 1400) { resizeWidth('#footer',$('#wrapper').width() - 30); }
		
		
		barreDefilOff();
		//On redimentionne le site en fonction de la fenêtre
		$(window).resize(function(){
			//centerThis('#accueil');
			//centerThis('#contact');
			centerThis_Y('#wrapper');
			resizeWidth('#wrapper',$(window).width());
			offsetPortfolio = $('#wrapper').offset();
			widthWindow = $(window).width();
			
			posCadre = $('#cadre').offset();
			posX('#sidebar',posCadre.left + 50);
			
			if (widthWindow < 1400 ) {
			posX('#photographe' , widthWindow - 250);
			} else {
				posX('#photographe' , posCadre.left + 1150);
			}
			
			if (widthWindow > 1400) {
				resizeWidth('#cadre',1400); //Onredimensionne le cadre qui contient les photos
				centerThis_X('#cadre');
				centerThis_X('#footer');
			} else {
				resizeWidth('#cadre',$('#wrapper').width()); //Onredimensionne le cadre qui contient les photos
			}
			widthWrapper = $('#wrapper').width();
			if (widthWrapper < 1400) { resizeWidth('#footer',$('#wrapper').width() - 30); } //Onredimensionne le cadre qui contient les photos
			
			
		});
		
		
		
	
		
		
		//On met en place le slideshow
		$('.slideshow-item').hide();
		$(window).load(function(){
				if (slideshow_statut == true){
					slideshow('slideshow',1000,4000);
				}
		});
});

