
jQuery.event.add(window, "load", resize_slide);
jQuery.event.add(window, "resize", resize_slide);

	function resize_slide(){

   		var $h = $(window).height();
   		var $w = $(window).width();
    
   		if($(window).height() > 500){ $marg = Math.round(($(window).height() - 500) / 4); $(".slider .wrapper ul li .ajust_height").height($marg + "px"); }
    
   		if($w > 900){
    
   			$(".slider .wrapper").height($h + "px").width($w + "px");
   			$(".slider .wrapper ul").width($w + "px");
   			$w = $w-100; // decalage pour faire place au menu gauche
   			$(".slider .wrapper ul li").width($w + "px");
    	}
	}



	$(document).ready( function() {


		// definition taille ecran pour affichage des realisations

		if(screen.availHeight < 850 && screen.availWidth <= 1024){ var ecran = "_2"; } else { var ecran = ""; }


		// animation des liens

		$(".block_menu a").hover(function() {
  			if(!$(this).hasClass("active")) {
  				$(this).animate({ color: "#333", fontSize: "27px" }, 200);
  			}
  		},
  		function() {
  			if($(this).hasClass("anim")) {
  				$(this).animate({ color: "#888", fontSize: "21px" }, 600);
  			}
  		});


		// selection lien et appel slide

		$(".block_menu a").bind('click', function() {
			if(!$(this).hasClass("active") && !$('#action_slider').val()){
			
				$(".active").animate({ color: "#888", fontSize: "21px" }, 600).removeClass("active").addClass("anim");
				
				$(this).removeClass('anim').addClass('active').css("color","#333");
               	$('.slider').anythingSlider(parseInt($(this).attr("rel")));
			}
				
		});

		// changement de realisation

		$(".block_real").load("menu_real.php?real=01");
		$(".realisations").load("realisations.php?real=01" + ecran);

 		$(".block_real a img").live("mouseover",function(){ $(this).fadeTo("fast", 0); });
		$(".block_real a img").live("mouseout",function(){ $(this).fadeTo("slow", 1); });
		
		$(".block_real a").live( "click", function() {
		
			var realisation = $(this).attr("rel");
			$(".realisations").hide(300,chargeReal);
			
		function chargeReal() { 
			$(".realisations").load("realisations.php?real=" + realisation + ecran,'',afficheReal());
		}
		function afficheReal() {
			$(".realisations").show(800);
		}
			$(".block_real").load("menu_real.php?real=" + realisation);
  		
		});


		// inistialisation du slider

        $('.slider').anythingSlider({});


		// preload des realisations
		
		$.each( [ "01", "02", "03", "04", "05", "06", "07" , "08" , "09" ], function(i, l){
			$('#preload').load("realisations.php?real=" + l + ecran);
		});


	});

if(navigator.appName !="Microsoft Internet Explorer"){

	var htmlElement = document.getElementsByTagName('html')[0];
	htmlElement.style.overflow = 'hidden';
	var bodyElement = document.getElementsByTagName('body')[0];
	bodyElement.style.overflow = 'hidden';

}


