/*
 *	Simple Scroller
 *	http://www.enertiasolutions.com
 */
Event.observe(window, 'load', function() {
	//Init Scroller
	//***************************************************************************
	
	$$('div#simple_scroller > ul > li').each(function(h, i) {
		if(i != 0) {
			h.setStyle({ opacity: 0.0 });
		} else {
			currentScroller = h;
		}
	});
	
	updateScroller();
	//Scroller Click Handlers
	//***************************************************************************
	Event.observe('scrollPrevious', 'click', function(f) {
		currentScroller.setStyle({ zIndex : '1' });
		
		new Effect.Opacity(previousScroller, { from: 0.0, to: 1.0, duration: 0.5, queue: 'end' });
		new Effect.Opacity(currentScroller, {from: 1.0, to: 0.0, duration: .25, queue: 'end' });
		
		currentScroller = previousScroller;
		updateScroller();
	});
	Event.observe('scrollNext', 'click', function(f) {
		currentScroller.setStyle({ zIndex : '1' });
		
		new Effect.Opacity(nextScroller, { from: 0.0, to: 1.0, duration: 0.5, queue: 'end' });
		new Effect.Opacity(currentScroller, {from: 1.0, to: 0.0, duration: .25, queue: 'end' });
		
		currentScroller = nextScroller;
		updateScroller();
	});
});
//Scroller
//***************************************************************************
var currentScroller = '';
var previousScroller = '';
var nextScroller = '';
function updateScroller() {
	//alert(currentScroller.inspect());
	currentScroller.setStyle({ zIndex : '2' });
	previousScroller = currentScroller.previous('div#simple_scroller > ul > li');
	nextScroller = currentScroller.next('div#simple_scroller > ul > li');

	if(previousScroller != undefined) {
		$('scrollPrevious').show();
	} else {
		$('scrollPrevious').hide();
	}
	
	if(nextScroller != undefined) {
		$('scrollNext').show();
	} else {
		$('scrollNext').hide();
	}
}