function ScrollFixtures(url) {
    var CurrentItem = getCurrentCarouselItem();
    if (CurrentItem == null) {
        $("#sportal-calender").append("<div id='sportal-ajax-loading'>Loading calender...</div>");
    }
    $.jsonp({
        url: url,
        callback: "SportalCalendar",
        pageCache: true,
        success: function (results) {
            if (CurrentItem == null) {
                $("#sportal-ajax-loading").remove();
            }
            $('#sportal-calender').setTemplateURL('/Calender/templates/Calender.html');
            $('#sportal-calender').processTemplate(results);
            var DefaultFixtureNo = results.Calendar.DefaultFixtureNo;
            if (CurrentItem != null) {
                DefaultFixtureNo = parseInt(CurrentItem) + 3;
            }            
            var carousel = $('#mycarousel').jcarousel({
                start: DefaultFixtureNo
            });
            $(".jcarousel-item").each(
                function () {
                    $(this).hover(
                        function () {
                            $(this).find("table").hide();
                            $(this).find('.fixture-description').animate({ top: 0 }, 200);
                        },
                        function () {
                            $(this).find("table").show();
                            $(this).find('.fixture-description').animate({ top: 100 }, 100);
                        }
                    );
                }
            );

        }
    });
}
function getCurrentCarouselItem() {
    var currSlide = 0;
    $("#mycarousel li").each(function () {
        if ($(this).offset().left >= 0) {
            currSlide = this;
            return false;
        }
    });
    return $(currSlide).attr("jcarouselindex");
}




