/*
* Plugin juiZoom by Geoffrey Crofte
* www.creativejuiz.fr
* plugin under CreativeCommons licence
* thanks to cite author plugin name
*/
(function($){
$.fn.juiZoom= function(options) {
  $.fn.juiZoom.defaults = {
	zoomWidth: 160, 
	zoomHeight: 104, 
	duration: 500,
	callback: 0,
	zoomWidthCB: 105, 
	zoomHeightCB: 68, 
	durationCB: 225,
  };
  var jz = $.extend($.fn.juiZoom.defaults, options);
	$(this).each(function(index,element) {
		valH = $(this).height();
		valW = $(this).width();

		$(this).stop(true, true).animate({	
			height: jz.zoomHeight+"px",
			width: jz.zoomWidth+"px", 
			marginTop: "+="+((valH-jz.zoomHeight)/2)+"px", 
			marginLeft: "+="+((valW-jz.zoomWidth)/2)+"px"
		}, 
		jz.duration, 
		function(){
			if (jz.callback!=0) {
				$(this).animate({	
					height: jz.zoomHeightCB+"px",
					width: jz.zoomWidthCB+"px", 
					marginTop: ((valH-jz.zoomHeightCB)/2)+"px", 
					marginLeft: ((valW-jz.zoomWidthCB)/2)+"px"
				}, jz.durationCB);
				$(this).css({ 
					'margin-left' : '-'+(jz.zoomWidthCB/2)+'px',
					'margin-top' : '-'+(jz.zoomHeightCB/2)+'px',
					'height': jz.zoomHeightCB + 'px',
					'width': jz.zoomWidthCB + 'px' 
				});
			}
			else { 
				$(this).stop();
				$(this).css({ 
					'margin-left' : '-'+(jz.zoomWidth/2)+'px',
					'margin-top' : '-'+(jz.zoomHeight/2)+'px',
					'height': jz.zoomHeight + 'px',
					'width': jz.zoomWidth + 'px' 
					});
			}
		}
		);
	});	
};
})(jQuery);
$(document).ready(function() {
//dimensions initiales
	$(".mini").css({ 'width' : '0',	'height' : '0',	'display' : 'inline'});
//animation zoom à l'entrée
	 $(".mini").juiZoom({ callback: 1 });
//interactions pour chaque lien
	("#nav a").each(function(){		
		$(this).hover(function(){
			$(this).children('.mini').juiZoom({ duration: 200 });
		}, function(){
			$(this).children('.mini').juiZoom({ zoomWidth: 105, zoomHeight: 68, duration: 350 });
		});

	}); 
});
