var intID;

var leftPos=0;

var liWidth = 615;



$(document).ready(function() {

	startMove();

});



function startMove(){
	
	$('#num_link2 a').click(function(){

		selCont($('#num_link2 a').index(this));								 

	});	

	intID=setInterval('runMove()',10000);	

}
function runMove(){

	leftPos=leftPos-liWidth;

	Moving();

}
function Moving(){

	var total=$("#featuredPostBox ul li").length;
	var width=total*liWidth;
	if(-width == leftPos)
		leftPos=0;

	$("#featuredPostBox").animate({ 
        left: leftPos+"px"

      }, 1000 );	

}

function selCont(id){

	clearInterval(intID);
	leftPos=-(id*liWidth);
	Moving();

	//alert(leftPos)
	intID=setInterval('runMove()',10000);

}