var $j = jQuery.noConflict();

var intID;
var leftPos=0;
var liWidth = 612;

$j(document).ready(function() {
startMove();
});

function startMove(){
	$j('.postLinks a').click(function(){
		selCont($j('.postLinks a').index(this));								 
	});
	intID=setInterval('runMove()',8000);	
}


function runMove(){
	leftPos=leftPos-liWidth;
	Moving();
}

function Moving(){
	var total=$j("#featuredPostBox ul li").length;
	var width=total*liWidth;
	
	if(-width == leftPos)
		leftPos=0;

	$j("#featuredPostBox").animate({ 
        left: leftPos+"px"
      }, 500 );	
}


function selCont(id){
	clearInterval(intID);
	leftPos=-(id*liWidth);
	Moving();
	//alert(leftPos)
	intID=setInterval('runMove()',2000);
}
