// JavaScript Document

// =========================================================================================
//
// jQuery main
//
// =========================================================================================



// execute your scripts when the DOM is ready. this is mostly a good habit
$(function() {

	// initialize scrollable
	// jQuery Tools : Scrollable (http://flowplayer.org/tools/scrollable.html)	
		$("div.scrollable").scrollable({
			 size: 1,
			 //easing: 'custom',
			 items: '.items',
			 clickable: false,
			 circular: true,
			 speed: 2000 // speed in milliseconds for slide
		}).autoscroll({ autoplay: true, interval: 6000 }).navigator("#navi");
		
		

});



$(document).ready(function() {									
	
	// Initialise first title
	var altFirst = $('.scrollable .items div:eq(1) img').attr('alt');
	$('p.scroll-text').text(altFirst);
	
	// Scrollable
	var api = $('.scrollable').data('scrollable');
	
	// Fade out slide title
	api.onBeforeSeek(function() {
		$('p.scroll-text').fadeOut(2000);	
	});
	
	// Update slide title
	api.onSeek(function() {
		var index = api.getIndex()+1;
		var alt = $('.scrollable .items div:eq(' + index + ') img').attr('alt');		
		$('p.scroll-text').fadeIn().text(alt);	
	});
	
});

