var t;
var defaultLinkIndex = -1;
var auto = 'on';

var timespan = 8000;

function timedCount()
{	
	defaultLinkIndex = defaultLinkIndex + 1;	
	if (defaultLinkIndex == $("div.fade_box_container li").length) {
		defaultLinkIndex = 0;
	}
	
	$("div.fade_box_container li").eq(defaultLinkIndex).trigger('click');	
	t = setTimeout("timedCount()", timespan); //8000
}

function stopCount()
{
	clearTimeout(t);
}

jQuery(function($) {	
	
	// hide all to headers
	$("div.fade_box").hide();
	
	$("div.fade_box_container li").click(function() {
		var li_rel = $("a", $(this)).attr('rel');
		var cur_li = this;
		
		$("div.fade_box_container li").removeClass('current');
		$("div.fade_box").hide();
		
		$(this).css({opacity:'1.0'});
		$(this).addClass('current');
		$(this).animate({opacity:'1.0'}, 500);
			
		$("div." + li_rel).fadeIn(1000);			
		defaultLinkIndex = $("div.fade_box_container li").index($(this));
		
		return false;		
	});	
	
	$("div.fade_box_container li").mouseover(function() {
		stopCount();												  
	});
	
	$("div.fade_box").mouseover(function() {
		stopCount();												  
	});
	
	$("div.fade_box_container li").mouseout(function() {
		t = setTimeout("timedCount()", timespan);											  
	});
	
	$("div.fade_box").mouseout(function() {
		t = setTimeout("timedCount()", timespan);											  
	});
	
	timedCount();
});
