// var theInt = null;
// var $crosslink, $navthumb;
// var curclicked = 0;
// 
// theInterval = function(cur){
// 	clearInterval(theInt);
// 	if( typeof cur != 'undefined' )
// 		curclicked = cur;
// 		$('.active-thumb').removeClass("active-thumb");
// 		$navthumb.eq(curclicked).parent().addClass("active-thumb");
// 		$(".stripNav ul li a").eq(curclicked).trigger('click');
// 	
// 	theInt = setInterval(function(){
// 		$('.active-thumb').removeClass("active-thumb");
// 		$navthumb.eq(curclicked).parent().addClass("active-thumb");
// 		$(".stripNav ul li a").eq(curclicked).trigger('click');
// 		curclicked++;
// 		if( 3 == curclicked )
// 			curclicked = 0;
// 		
// 	}, 5000);
// };
// 
// $(function(){
// 	
// 	$("#main-photo-slider").codaSlider({
// 		easeTime: 1300
// 	});
// 	
// 	$navthumb = $(".nav-thumb");
// 	$crosslink = $(".cross-link");
// 	
// 	$navthumb
// 	.click(function() {
// 		var $this = $(this);
// 		theInterval($this.parent().attr('href').slice(1) - 1);
// 		return false;
// 	});
// 	
// 	theInterval();
// });
function autoPlay()
{	
	if($('#movers-row a.active-thumb').attr('href') == '#three') {
		$('#movers-row a:first').click();
	}else{
		$('#movers-row a.active-thumb').parent().next().children().click();
	}
}
$(document).ready(function() {
	
	// Hide Panels initially
	$('.panel')
	.addClass('hidden')
	.hide()
	.css('position', 'absolute')
	.css('top','0')
	.css('left', '0');
	
	// Function for finding panel
	function displayPanel(ID) {
		$('.panel.displayed').css('z-index', '555').addClass('fading');
		$('.panelContainer')
			.find(ID)
			.css('z-index', '999')
			.fadeIn(2000)
			.removeClass('hidden')
			.addClass('displayed')
			.end()
			.find('.panel.fading')
			.hide()
			.removeClass('displayed')
			.addClass('hidden')
			.removeClass('fading')
			.end();
	}	
	
	$('#movers-row a').click(function(){
		$('.active-thumb').removeClass('active-thumb');
		$(this).addClass('active-thumb');
		$panel_id = $(this).attr('href');
		displayPanel($panel_id);
		
		return false;
	});
	
	$('#movers-row a:first').click();
	
	autoplay = setInterval ( 'autoPlay()', 5000 );
	
	$('.panelContainer').hover(function(){
    	clearInterval ( autoplay );
	},function(){
		autoplay = setInterval ( 'autoPlay()', 5000 );
	});
  	
	
});

