/*

	Fluid Thumbnail Bar
		
	Author	: Sam Dunn
	Source	: Build Internet (www.buildinternet.com)
	Company : One Mighty Roar (www.onemightyroar.com)
	License : MIT License / GPL License

*/

jQuery(function($){

	/* Variables
	----------------------------*/
	var thumbTray = '#thumbnails',
		thumbList = '#thumb-list',
		thumbNext = '#thumb-next',
		thumbPrev = '#thumb-prev',
		thumbInterval,
		thumbPage = 0;
	
	
	/* Setup
	----------------------------*/
	// Adjust to true width of thumb markers
	$(thumbList).width('200px');
	
	$(thumbNext).mouseenter(function(){
		var scrolltop = -700+$('#visuel').height();
		
		$(thumbList).stop().animate({'top': scrolltop+'px'}, {duration:1000});
	});
	$(thumbNext).mouseleave(function(){
		$(thumbList).stop();
	});
	
	$(thumbPrev).mouseenter(function(){
		$(thumbList).stop().animate({'top': '0'}, {duration:1000});
	});
	$(thumbPrev).mouseleave(function(){
		$(thumbList).stop();
	});
	
	/* Window Resize
	----------------------------*/
	$(window).resize(function(){
	
		// Update Thumb Interval & Page
		thumbPage = 0;	
		
		// Adjust thumbnail markers
		if ($(thumbList).height() > $(thumbTray).height()){
			$(thumbPrev+","+thumbNext).fadeIn('fast');
			$(thumbList).stop().animate({'top':0}, 200);
		}else{
			$(thumbPrev+","+thumbNext).fadeOut('fast');
		}
		
	});
	
	
	
});

