function itemVisibleInHandlerAfterAnimation(carousel, li, idx, state) {
    if (idx == 1)
    {
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control";
    }
    if (idx == 12)
    {
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control";
    }
    if (idx == 23)
    {
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control";
    }
    if (idx == 34)
    {
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control";
    }
}

function itemFirstInHandler(carousel, li, idx, state) {
    mxSize = idx+10;
    if (mxSize > carousel.size())
        mxSize = carousel.size()
    var vMes = mxSize.toString() + " - " + idx.toString();
    if (document.getElementById("scrollPos") != null)
        document.getElementById("scrollPos").innerHTML = vMes;
    if (document.getElementById("scrollCount") != null)
        document.getElementById("scrollCount").innerHTML = carousel.size().toString();
    if (state != 'init')
        return;
    
    var cr = carousel;
    jQuery(".jcarousel-control1").bind("click", function() 
    {
        cr.scroll(1);
        return false;
    });
    
    jQuery(".jcarousel-control2").bind("click", function() 
    {
        cr.scroll(11);
        return false;
    });
    
    jQuery(".jcarousel-control3").bind("click", function() 
    {
        cr.scroll(21);
        return false;
    });
    
    jQuery(".jcarousel-control4").bind("click", function() 
    {
        cr.scroll(31);
        return false;
    });
}

function itemArticleVisibleInHandlerAfterAnimation(carousel, li, idx, state) {
    if (idx == 1)
    {
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control";
    }
    if (idx == 3)
    {
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control";
    }
    if (idx == 5)
    {
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control";
    }
    if (idx == 7)
    {
        if (document.getElementById("jcarousel-control4") != null)
            document.getElementById("jcarousel-control4").className = "jcarousel-control current";
        if (document.getElementById("jcarousel-control1") != null)
            document.getElementById("jcarousel-control1").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control2") != null)
            document.getElementById("jcarousel-control2").className = "jcarousel-control";
        if (document.getElementById("jcarousel-control3") != null)
            document.getElementById("jcarousel-control3").className = "jcarousel-control";
    }
}

function itemArticleFirstInHandler(carousel, li, idx, state) {
    mxSize = idx+1;
    if (mxSize > carousel.size())
        mxSize = carousel.size()
    var vMes = mxSize.toString() + "&nbsp;-&nbsp;" + idx.toString();
    if (document.getElementById("scrollPos") != null)
        document.getElementById("scrollPos").innerHTML = vMes;
    if (document.getElementById("scrollCount") != null)
        document.getElementById("scrollCount").innerHTML = carousel.size().toString();
    if (state != 'init')
        return;
    
    var cr = carousel;
    jQuery(".jcarousel-control1").bind("click", function() 
    {
        cr.scroll(1);
        return false;
    });
    
    jQuery(".jcarousel-control2").bind("click", function() 
    {
        cr.scroll(3);
        return false;
    });
    
    jQuery(".jcarousel-control3").bind("click", function() 
    {
        cr.scroll(5);
        return false;
    });
    
    jQuery(".jcarousel-control4").bind("click", function() 
    {
        cr.scroll(7);
        return false;
    });
}

function InitCarousel()
{
    jQuery("#articleCarousel").jcarousel({
        itemVisible: 2,
        itemScroll: 2,
		scrollAnimation: 2000,
		wrap: false,
		itemFirstInHandler: itemArticleFirstInHandler,
		itemVisibleInHandler: {
            onAfterAnimation: itemArticleVisibleInHandlerAfterAnimation
        }
    });
    /*jQuery("#mycarousel2").jcarousel({
        itemVisible: 1,
        itemScroll: 1,
		scrollAnimation: 1000,
		wrap: true
    });*/
    jQuery("#vidCarousel").jcarousel({
        itemVisible: 3,
        itemScroll: 3,
		scrollAnimation: 1000,
		wrap: true
    });
    jQuery("#mycarouselVid").jcarousel({
        itemVisible: 3,
        itemScroll: 3,
		scrollAnimation: 1000,
		wrap: true
    });
    jQuery("#mycarouselImg").jcarousel({
        itemVisible: 4,
        itemScroll: 1,
		scrollAnimation: 1000,
		wrap: true
    });
    jQuery("#profileTmb").jcarousel({
        itemVisible: 11,
        itemScroll: 5,
		scrollAnimation: 2000,
		wrap: false,
		itemFirstInHandler: itemFirstInHandler,
		itemVisibleInHandler: {
            onAfterAnimation: itemVisibleInHandlerAfterAnimation
        }
    });
}
// Ride the carousel...
//jQuery(document).ready(function() {InitCarousel();});








