function mycarousel_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() {
    $('#mycarousel').jcarousel({
        auto: 2,
        visible: 2,
        scroll: 2,
        animation: 1200,
        wrap: "last",
        initCallback: mycarousel_initCallback
    });
    // $(".jcarousel-clip").fadeTo(1500,1);
    

    $("#mycarousel li").each( function() {
        var h = $(this).find("a").attr("href");
        if (h) {
            $(this).find("h2").wrap("<a></a>");
            $(this).find("p").wrap("<a></a>");
            $(this).find("a").attr("href",h).attr("target","_blank");
        }
        
        $(this).hover( function() {
            $(this).addClass("hover");
        }, function() {
            $(this).removeClass("hover");            
        });
    });
});

