$(document).ready(function() {
	
//  Shadowbox.init({players:['img','iframe']});					   
//	Shadowbox.setup("a.boxes", {gallery:"Photos"});
//	Shadowbox.setup("a.boxes_html", {
//		player:     "iframe",
//		height:     350,
//        width:      350
//	});

	//LISTE DES ANIMATIONS DES BOX
	$("#overall li").stop().css({"display":"block"});
	
	$("#overall li:not(.active) div").stop().css({"display":"none"}).animate({"opacity":"0"}, 0);
	$("#overall li.active div").stop().css({"display":"block"}).animate({"opacity":"0.9"}, 0);
	$("#overall li:not(.active) p").stop().css({"display":"none"}).animate({"opacity":"0","margin-left":"200px"}, 0);
	$("#overall li:not(.active) a").stop().css({"display":"none"}).animate({"opacity":"0"}, 0);
	
	$("#overall li:not(.active)").hover(function() {
		//$(".kwicks li:not(.active)").stop().css({"background":"#fff"}, 0);
		  $("div", this).stop().css({"display":"block"}).animate({"opacity":"0.9","margin-left":"0px"}, 600);
		$("p", this).stop().css({"display":"block"}).animate({"opacity":"0.7","margin-left":"25px"}, 600, function(){
          $("a",this).css({"display":"block"}).animate({"opacity":"1"}, 400);
		});
	}, function() {
		//$(".kwicks li:not(.active)").stop().css({}, 0);
		  $("div", this).stop().css({"display":"none"}).animate({"opacity":"0","margin-left":"0px"}, 600);
		 $("p", this).stop().css({"display":"none"}).animate({"opacity":"0","margin-left":"200px"}, 600, function(){
          $("a",this).css({"display":"none"}).animate({"opacity":"0"}, 400);
		  });
	});	
	
	//AFFICHAGE h2 OPACITE REDUITE
	$("#overall li:not(.active) h2").stop().animate({"opacity":"0"},0);
	setTimeout(function(){
		  $("#overall li#box3 h2").animate({"opacity": "1"},600, function(){
          $("#overall li#box2 h2").animate({"opacity": "1"},200, function(){
          $("#overall li#box4 h2").animate({"opacity": "1"},200, function(){
          $("#overall li#box1 h2").animate({"opacity": "1"},200, function(){
		  $("#overall li#box5 h2").animate({"opacity": "1"},200, function(){
          });
          });
          });
          });
          });
	},400);
	
	$("#overall li").click(function(){
     window.location=$(this).find("a.thelink").attr("href");
     return false;
	});







$("#wrapper_map img.main").hover(function() {
		$(this).animate({"opacity": "0"},100);
	}, function() {
		$(this).animate({"opacity": "1"},100);
});
//
//setInterval(function() {
//			  $("#wrapper_carte .cont1 img.main").stop.animate({"opacity": "0"},600, function(){
//			  $("#wrapper_carte .cont1 img.main").stop.animate({"opacity": "1"},600, function(){
//			  $("#wrapper_carte .cont2 img.main").stop.animate({"opacity": "0"},600, function(){
//			  $("#wrapper_carte .cont2 img.main").stop.animate({"opacity": "1"},600, function(){
//			  $("#wrapper_carte .cont3 img.main").stop.animate({"opacity": "0"},600, function(){
//			  $("#wrapper_carte .cont3 img.main").stop.animate({"opacity": "1"},600, function(){
//			  $("#wrapper_carte .cont4 img.main").stop.animate({"opacity": "0"},600, function(){
//			  $("#wrapper_carte .cont4 img.main").stop.animate({"opacity": "1"},600, function(){
//			  $("#wrapper_carte .cont5 img.main").stop.animate({"opacity": "0"},600, function(){
//			  $("#wrapper_carte .cont5 img.main").stop.animate({"opacity": "1"},600, function(){
//			  });
//			  });
//			  });
//			  });
//			  });
//			  });
//			  });
//			  });
//			  });
//			  });
//		}, 6000);
	
//setTimeout(function(){
//setInterval(function() {
//	
//
//		  $("#wrapper_carte .cont1 img.main").animate({"opacity": "0"},600, function(){
//          $("#wrapper_carte .cont1 img.main").animate({"opacity": "1"},600, function(){
//          $("#wrapper_carte .cont2 img.main").animate({"opacity": "0"},600, function(){
//          $("#wrapper_carte .cont2 img.main").animate({"opacity": "1"},600, function(){
//		  $("#wrapper_carte .cont3 img.main").animate({"opacity": "0"},600, function(){
//		  $("#wrapper_carte .cont3 img.main").animate({"opacity": "1"},600, function(){
//		  $("#wrapper_carte .cont4 img.main").animate({"opacity": "0"},600, function(){
//		  $("#wrapper_carte .cont4 img.main").animate({"opacity": "1"},600, function(){
//		  $("#wrapper_carte .cont5 img.main").animate({"opacity": "0"},600, function(){
//		  $("#wrapper_carte .cont5 img.main").animate({"opacity": "1"},600, function(){
//          });
//          });
//          });
//          });
//          });
//		  });
//          });
//          });
//          });
//          });
//	
//}, 6000);
//	},400);
	
	
	
	
	
	

	//$("#wrapper_carte.carte").hover(function() {
//		$(this).next("#wrapper_carte .clinique").animate({opacity: "show", top: "295"}, 100);
//	}, function() {
//		$(this).next("#wrapper_carte .clinique").animate({opacity: "hide", top: "295"}, 100);
//	});

});

$(window).load(function() {  
 
		var total = $('#top img').length;
		var rand = Math.floor(Math.random()*total);
        $('#top').nivoSlider({	
			effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
			slices:1, // For slice animations
			boxCols: 1, // For box animations
			boxRows: 1, // For box animations
			animSpeed:800, // Slide transition speed
			pauseTime:6000, // How long each slide will show
			startSlide:rand,
			//startSlide:0, // Set starting Slide (0 index)
			directionNav:false, // Next & Prev navigation
			directionNavHide:false, // Only show on hover
			controlNav:false, // 1,2,3... navigation
			controlNavThumbs:false, // Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, // Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', // Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
			keyboardNav:true, // Use left & right arrows
			pauseOnHover:true, // Stop animation while hovering
			manualAdvance:false, // Force manual transitions
			captionOpacity:0.8, // Universal caption opacity
			prevText: 'Prev', // Prev directionNav text
			nextText: 'Next', // Next directionNav text
			beforeChange: function(){}, // Triggers before a slide transition
			afterChange: function(){}, // Triggers after a slide transition
			slideshowEnd: function(){}, // Triggers after all slides have been shown
			lastSlide: function(){}, // Triggers when last slide is shown
			afterLoad: function(){} // Triggers when slider has loaded
		});	
		
		var total = $('#conseil img').length;
		var rand = Math.floor(Math.random()*total);
        $('#conseil').nivoSlider({	
			effect:'slideInRight', // Specify sets like: 'fold,fade,sliceDown'
			slices:1, // For slice animations
			boxCols: 1, // For box animations
			boxRows: 1, // For box animations
			animSpeed:300, // Slide transition speed
			pauseTime:6000, // How long each slide will show
			startSlide:rand,
			//startSlide:0, // Set starting Slide (0 index)
			directionNav:true, // Next & Prev navigation
			directionNavHide:false, // Only show on hover
			controlNav:true, // 1,2,3... navigation
			controlNavThumbs:false, // Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, // Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', // Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
			keyboardNav:true, // Use left & right arrows
			pauseOnHover:true, // Stop animation while hovering
			manualAdvance:false, // Force manual transitions
			captionOpacity:0.8, // Universal caption opacity
			prevText: 'Prev', // Prev directionNav text
			nextText: 'Next', // Next directionNav text
			beforeChange: function(){}, // Triggers before a slide transition
			afterChange: function(){}, // Triggers after a slide transition
			slideshowEnd: function(){}, // Triggers after all slides have been shown
			lastSlide: function(){}, // Triggers when last slide is shown
			afterLoad: function(){} // Triggers when slider has loaded
		});	
	
		//BG RESIZE
        var theWindow        = $(window),
            $bg              = $("#bg"),
            aspectRatio      = $bg.width() / $bg.height();
        function resizeBg() {
                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }
        }
        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");

});
// HTML5
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(',');for(var i=0;i<e.length;i++){document.createElement(e[i])}})()

