$(document).ready(function(){

	/* 
	 |
	 | JS POUR TRANSFORMER NOS IMAGES EN VIDEO YOUTUBE, DAILYMOTION OU AUTRE SWF LISABLE SANS PLAYER FLV
	 |
	 */
	
	$(".menuBtn").each( function(){
		
		var loc  = window.location;
		var Link = $(this).children("a").attr('href');
	
		if( loc == Link )
				$(this).attr('id','active');
	});
	
	// Ajout du rollover sur les images
	$(".rollover img").hover(
			function()
			{
				this.src = this.src.replace("-off","-on");
			},
		function()
		{
			this.src = this.src.replace("-on","-off");
		}
	);
	
	$("img.youtube").flash(
			  { },   
	  		  { version: 8 },
	  		  function(htmlOptions) {
	  		  	$this = $(this);
	  		  	
	  		  	var LinkOfVideo = $this.attr('alt');
	  		  	
	  		  	if( LinkOfVideo.search("dailymotion") != -1  ){
			  		
			  		if( LinkOfVideo.search("related=0") == -1 )
			  			LinkOfVideo += "&amp;related=0";
			  		
			  		LinkOfVideo = LinkOfVideo.replace(/dailymotion.com\/video/,"dailymotion.com\/swf");
			  	}
	  		    else if( LinkOfVideo.search("vimeo") != -1  ){

			  		if( LinkOfVideo.search("vimeo.com") ){
			  			
			  			
			  			LinkOfVideo = LinkOfVideo.replace(/vimeo.com\//,"vimeo.com\/moogaloop.swf\?clip_id=");
			  			
			  		}
			  		
			  	}
	  		  	else if( LinkOfVideo.search("youtube") != -1  ){

	  		  		if( LinkOfVideo.search("watch?v=") ){
	  		  			
	  		  			LinkOfVideo += "&amp;hl=fr&amp;fs=1&amp;";
	  		  			LinkOfVideo = LinkOfVideo.replace(/watch\?v=/,"v/");
	  		  		}
	  		  		
	  		  	}
	  		    
	  		  	
	  		  	htmlOptions.src    = LinkOfVideo;
	  		  	
	  		  	if( $this.css("width") != 'auto' && $this.css("width") != '0px')
	  		  		htmlOptions.width  = $this.css("width");
	  		  	
	  		  	else
	  		  		htmlOptions.width  = "320px";
	  		  	
	  		  	if( $this.css("height") != 'auto' && $this.css("height") != '0px')
	  		  		htmlOptions.height = $this.css("height");
			  	
			  	else
			  		htmlOptions.height  = "240px";
	  		  	
	  		  	
	  		  	$this.before($.fn.flash.transform(htmlOptions));
	  		  	
	  		  	$this.remove();
	  		  });

	/* 
	 |
	 | JS POUR AFFICHER OU NON LA LEGENDE SUR UNE IMAGE TOUTES LA MISE EN PAGE EST GERE VIA CSS
	 |
	 */

	$('.fromsakka').jcaption({
		
		copyStyle: true,
		autoWidth: true,
		animate: false
	});
	
	/* 
	 |
	 | TOUTE IMAGE POINTANT VIA UN LIEN SUR UNE IMAGE SERA ZOOMER AUTOMATIQUEMENT
	 |
	 */

	$("a.none").zoomimage({
		controls:0,
		caption:0
	});
	
	$("a.fromsakka").zoomimage({
		controls:0,
		caption:0
	});
	
	$("a").zoomimage({
		controls:0,
		caption:0
	});

});

