var t;
var defaultLinkIndex = -1;

function timedCount()
{	
	defaultLinkIndex = defaultLinkIndex + 1;	
	if (defaultLinkIndex == $("#slider_paging li").length) {
		defaultLinkIndex = 0;
	}

	$("#slider_paging li").eq(defaultLinkIndex).trigger('click');	
	t = setTimeout("timedCount()", 3000); //8000
}

function stopCount()
{
	clearTimeout(t);
}

$(function() {
		   
	$('#slider_box').cycle({						   
		fx:    'fade',
		timeout:  4000	
	});
	
	$('#slider_paging li').click(function() {		
		$('#slider_paging li').removeClass('active');		
		var curIndx = $(this).index();		
		$(this).addClass('active');
		$('#slider_box').cycle(curIndx);
		
		defaultLinkIndex = curIndx;
		return false;									   
	});
	
	timedCount();
});

function onAfter(curr, next, opts) {
	var index = opts.currSlide;	
	$('#slider_paging li').removeClass('active');
	$('#slider_paging li').eq(index).addClass('active');	
}


