$(function() {
  bottlescroller = $("div#bottle-scroller").scrollable({
    size: 1,
    speed:0,
    api:true
  });
  if(bottlescroller != undefined)
	bottlescroller.onBeforeSeek(function(event,index){
		if($.support.opacity)
		{
			// Use a recursive* function approach here, if the image is faded out
			// we will allow advancing to the next slide, which will trigger the
			// onSeek event to fade the slides back in
			var element = this.getRoot().find('li');
			if (element.css('opacity') == .01) {
				return true;
			}
		
			// The slide has not yet started fading out, so we will fade the item
			// out
			element.fadeTo(400, .01, function(){
				// Once the fade is complete we will call api.seekTo() to trigger
				// the onBeforeSeek event again, which will now advance the slide
				// because we will be returning true instead of false
				bottlescroller.seekTo(index);
			});
		
			// Prevent advancing the slide on the first call to onBeforeSeek
			return false;
		}
	
	}).onSeek(function(){
	if($.support.opacity)
		{
			// Fade the item back in
			this.getRoot().find('li').fadeTo(400, 1,function(){
				$(this).css('filter','');	
			});
		}
	});
	if ($('div.items ul').length < 2){
		$('a.nextPage').css('display','none');
	}
	
});
