function slideBanner(selector){
 	$('.galleryContainer').scrollable({circular: true, speed: 500, mousewheel: true, easing:'swing'});	
}
function changeBanner(selector, direction) {
	if(typeof direction != 'string')
		direction = 'next';
	var totalItems = $(selector+' > *').length;
	var totalVisibleItems = $(selector+' > *:visible').length;
	var currentIndex, nextIndex;

	if(totalItems > 1 && totalVisibleItems > 1) {
		$(selector).css('position', 'relative');
		$(selector+' > *').each(function() {
			$(this).hide();
			$(this).css('position', 'absolute');
			$(this).css('top', 0);
	});
		totalVisibleItems = $(selector+' > *:visible').length;
	}

	if(totalVisibleItems <= 1 && totalItems > 0) {
		currentIndex = $(selector+' > *').index($(selector+' > *:visible')) ;
		if(direction == 'next')
			nextIndex = (currentIndex >= 0 && currentIndex+1 < totalItems) ? currentIndex+1 : 0;
		else
			nextIndex = (currentIndex >= 0 && currentIndex-1 >= 0) ? currentIndex-1 : totalItems-1;
		if(currentIndex >= 0)
			$(selector+' > *').eq(currentIndex).fadeOut('slow');
		$(selector+' > *').eq(nextIndex).fadeIn('slow');
	}

}
$(document).ready(function() {
	changeBanner('.galleryContainer');
	//setInterval("changeBanner('.gallery')", 8000);
});
