/*------------------------------------------------------------------
Project:		LaunchPad Communications
Author:			<Bryan Fitch>
Last change:	2010-02-08
-------------------------------------------------------------------*/
var current = 0;
var current_ball = 0;
var slides;
var balls;
var numberOfSlides;
var numberOfBalls;

google.load("jquery", "1.3.2");
google.setOnLoadCallback(function() {
	
	// all the div's
	slides = $('.tab');
	balls = $('.carousel_nav ul li a');
	
	// Show first div and hover state for balls
	$(slides[0]).show();
	$(balls[0]).addClass('selected');
	
	// the number of slides
	numberOfSlides = slides.length;
	numberOfBalls = balls.length;

	// how many milliseconds to wait
	var speed = 5000;
	setInterval('selectItem()', speed);

	setInterval('showBalls()', speed);
}, true);

function selectItem() {
    $(slides[current]).hide();
	current < numberOfSlides-1 ? current++ : current=0;
    $(slides[current]).show();
}

function showBalls() {
	$(balls[current_ball]).removeClass('selected');
	current_ball < numberOfBalls-1 ? current_ball++ : current_ball=0;
	$(balls[current_ball]).addClass('selected');
}

// now look up setInterval and call selectItem every speed seconds		

// Hide all the tabs then show the first one
//$('.tab').hide();
//$('.tab:first').show();

// This part says each link should show that number of tabs. It's an array basically
//$('.carousel_nav ul li a').each(function(i) {
	// i = 0,1,2,etc
	//$(this).click(function(e) {
		// Stop the default link action
		//e.preventDefault();
		// Hide all the tabs
		//$('.tab').hide();
		//$(tabs[i]).show();
		//$('.carousel_nav ul li a').removeClass("selected")
		//$(this).addClass('selected');
	//});
//}); 

// Array of tabs
//var tabs = $('.tab');


