// Carousel code for internal pages
// Width of each item on carousel
var itemWidth = 142;
// Starting item
var actualItem = 1;
// Quantity of items in the carousel
var qtyItems = 0;
// Size of the carousel
var carouselSize = 5;
// Carousel initialization code
function createCarousel(){
	var initialItem = $("div.items a.selected");
	var position = $("div.items a").index(initialItem);
	$("div.scrollable").scrollable({
		size: carouselSize,
		clickable: false,
		item: 'a',
		nextPage: ".rightControl",
		prevPage: ".leftControl"
	});
	if (position >= 0)
		moveIndicator(position);
	// Click event for the scrollable items
	var clickedItem = $("div.items a").click(function(){
		// Move the active indicator
		moveIndicator(clickedItem.index(this));
		return false;
	});
	// This enables the rollover tooltip for the bottom navigation icons
	$("div.items a").tooltip({
		tip: '#bottomNavTooltip',
		delay: 0,
		predelay: 100
	});
}// End createCrousel()
// Moves the arrow indicator
function moveIndicator(index){
	// Pixels to move
	var movementGap = (itemWidth * index) + 64;
	$(".activeIndicator").stop().animate({left: movementGap + "px"}, 400);
}// end moveIndicator()
