function adscarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function() {

    $('#adscarousel ul').jcarousel({
        scroll: 1,		//auto scroll  
        auto: 5,		//the speed of scrolling  
        wrap: 'last',	//go back to top when reach last item
		initCallback: adscarousel_initCallback
    });
 
	$("div.pricingcategories ul li").each( function() {
		var id = $(this).attr('id').substring(4);
		$(this).click( function() { change_tab(id);
		return false;} );
	});
	
	function change_tab(id) {
		//$("div.div-feature").hide();
		//$("div#div-"+id).show();
		$("div.pricing").show();
		$("div.pricingcategories ul li").removeClass('selected');
		$("li#opt-"+id).addClass('selected');
	}

	$("#pricingtable .details").hide();

	$("#pricingtable .option").each( function() {
		var id = $(this).attr('id').substring(4);
		$(this).click( function() { show_details(id);
		return false;} );
	});

	function show_details(id) {
		$("#pricingtable img.details").hide();
		$("#pricingtable img#det-"+id).show();
		$("#pricingtable .option").removeClass('selected');
		$("#pricingtable img#opt-"+id).addClass('selected');
	}

	//display the bike option and pricing information by default
	change_tab('bike');
	$("#pricing").show();

});
