jQuery(document).ready(function() {
		jQuery("#posts").jcarousel({
			wrap: "circular",
			animation: "slow",
			auto: 2,
			scroll: 1,
			initCallback: mycarousel_initCallback,
			itemFirstInCallback: pause_hover,
			buttonNextHTML: null,
			buttonPrevHTML: null
		});
	});
//Binds navigation to .list a elements	
	function mycarousel_initCallback(carousel) {
		jQuery('.list a').bind('click', function() {
		var index = $(this).attr("id").split("_");//Parses href link for integer after id=_
				carousel.scroll(jQuery.jcarousel.intval(index[1]));
				carousel.startAuto(0); //stop auto scroll when click nav button
				$(".list a").removeClass("active"); //Remove any "active" class
				$(this).addClass("active");
		        return false;
		    });
		jQuery('.list a').bind('change', function() {
		        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
		        return false;
		    });	
	 }; 	 
//Pause on hover; resume when hover ends
	function pause_hover(carousel) {
	  $("#posts").hover(
	    function() {
      $(this).jcarousel('startAuto', 0);
	    },
	    function() {
	      $(this).jcarousel('startAuto', 2);
	    }
	  );
	}

