var $mashupTwitter = jQuery.noConflict();

$mashupTwitter(function() {
    $mashupTwitter(".main .jCarouselLite").jCarouselLite({
        btnNext: ".main .next",
        btnPrev: ".main .prev",
        speed: 500,
        easing: "easeinout"
    });       
    
    $mashupTwitter("#jCarouselLiteDemo").tabs();
    
    $mashupTwitter("a.tabClient").click(function() {
        $mashupTwitter("#jCarouselLiteDemo").triggerTab($mashupTwitter(this).attr("href").substring(1));
        $mashupTwitter("#header").ScrollTo(1);
        return false;
    });
    
    $mashupTwitter("a.demo").click(function() {
    
        $mashupTwitter(this).parents("ul").find("a").removeClass("selected");
        $mashupTwitter(this).addClass("selected");
        
        var demo = $mashupTwitter("#demo"), loading = $mashupTwitter("#loadingDemo");
        
        $mashupTwitter("#jCarouselLiteDemo").triggerTab(5);
        demo.show(); // this is because triggerTab takes time to trigger the demo
        $mashupTwitter("#demo, #demo .carousel, #demo .jCarouselLite").css("visibility", "hidden");
        loading.show();
        
        var url = "include/jCarouselLiteDemo/"+this.id+".php"
        demo.load(url, function() {
            demo.css("visibility", "visible");
            loading.hide();
        });
        $mashupTwitter("#header").ScrollTo(1);
        return false;

    });
});

