
var selectedItemIdx;
var strIndication = "";
var totalDot = 0;
 
/**
 * This is the callback function which receives notification
 * when an item becomes the first one in the visible range.
 */
function mycarousel_itemFirstInCallback(carousel, item, idx, state) {
    display(idx);
};


function display(s) {
    // Log to Firebug (getfirebug.com) if available
    //if (window.console != undefined && typeof window.console.log == 'function')
      //  console.log(s);

    var selectedItemIdx = parseInt(s);

    strIndication= "";
    
    var i;
    
    if (totalDot==0)
    {
        totalDot = parseInt(document.getElementById("display").innerHTML);
        //totalDot = 12;
    }

    //alert(totalDot);
    //alert(selectedItemIdx);
    
    for (i=1; i<=totalDot; i++)
    {
        if (i % 4 == 1)
        {
            if (selectedItemIdx==i)
            {
                strIndication = strIndication + "<img src=/images/images_slides/yellow-dot-10x10.gif />&nbsp;";
            }
            else
            {
                 strIndication = strIndication + "<img src=/images/images_slides/white-dot-10x10.gif />&nbsp;";
            }
        }
    }
    
    //jQuery('#display').html(jQuery('#display').html() + strIndication);    
        
    document.getElementById("display").innerHTML = strIndication;
       
    
};


/**
 * We use the initCallback callback
 * to assign functionality to the controls
 */
function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
 
    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });
 
    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });
 
    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
    

};
 
 




// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        scroll: 4,

	initCallback: mycarousel_initCallback,
        
        
        itemFirstInCallback:  mycarousel_itemFirstInCallback,

        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});




