/*
	Screengrab09 Featured Scroller
	Patrick Hamann 2009
	Scroll that shit!
*/

$(document).ready(function(){ 

	// set scrollTo defaults
	$.scrollTo.defaults.axis = 'x';
	$('div#scroller').scrollTo( 0 ); 
	$.scrollTo( 0 );
	
	// enumeration
	var $thumbs = $('div#scroller a');
	var $scroller = $('div#scroller');

	//Default all thumbs to 0.5 opacity
	$thumbs.show(0);
	$thumbs.fadeTo(0, 0.5);
	
	//Apply effects on thumbnail hover
	$thumbs.each( function(i) {
		$(this).hover( function() {
			$thumbs.fadeTo(0, 0.5);
			$(this).fadeTo('normal', 1);	
		}, function() {
			$thumbs.stop();
			$(this).fadeTo('normal', 0.5);
		});
	});
	
	//Apply serialScroll to the next and prev buttons
	$('div#scroller').serialScroll({
		items:'a',
		prev:'div#arrows a.prev',
		next:'div#arrows a.next',
		step: 1,
		offset:0, 
		duration:800,
		force:true,
		stop:true,
		lock:false,
		cycle:false, 
		jump: false
	});
	
	//Next & Prev buttons hover opactiy
	$('div#arrows a').fadeTo(0, 0.25);
	
	$('div#arrows a').hover( function(){
		$(this).fadeTo('normal', 1);
	}, function() {
		$(this).fadeTo('normal', 0.25);
	});
}); 
