var mycarousel_itemList = new Array()

function mycarousel_initCallback(carousel)
{
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};
function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};
function mycarousel_getItemHTML(item)
{
    return '<img src="' + item.url + '" width="' + item.width + '" height="' + item.height + '" alt="' + item.title + '" />';
    //return '<img src="' + item.url + '" width="160" height="22" alt="' + item.title + '" />';
};
function mycarousel_itemsArray() {
    jQuery('#bb').css('display','none');
    jQuery('#aa').css('display','block');
    var imgs = jQuery('.b');
    jQuery('.b').remove();
    var imgsData = new Array();
    for(i=0,j=imgs.length;i<j;i++){
        imgsData[i]= {url:imgs[i].src, title:imgs[i].title, width:imgs[i].width, height:imgs[i].height};
    }
    return imgsData;
}

jQuery(document).ready(function(){

    mycarousel_itemList=mycarousel_itemsArray();

    
    jQuery('#mycarousel').jcarousel({ 
        wrap: 'circular',
        auto: 1,
        animation: 12000,
        visible: 1,
        scroll: 1,
        initCallback: mycarousel_initCallback,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});
