/** unhide the sm features **/
$(document).ready(function() {
	var sm_feature_items = $("div", ".jcarousel-item");
	for (var i=0; i < sm_feature_items.length; i++){
		sm_feature_items[i].style.display = "block";
	}
});

jQuery(document).ready(function() {
    jQuery('#featurecarousel').jcarousel({
        // Uncomment the following option if you want items
        // which are outside the visible range to be removed
        // from the DOM.
        // Useful for carousels with MANY items.

        //itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
        scroll: 1,
        initCallback: featurecarousel_initCallback,
        //itemLoadCallback: featurecarousel_itemLoadCallback,
		animation: 0,
		wrap:'both',
        buttonNextHTML: null,
        buttonPrevHTML: null
    });

    jQuery('#bottomfeaturecarousel').jcarousel({
        // Uncomment the following option if you want items
        // which are outside the visible range to be removed
        // from the DOM.
        // Useful for carousels with MANY items.

        //itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
        scroll: 1,
        initCallback: bottomfeaturecarousel_initCallback,
        //itemLoadCallback: featurecarousel_itemLoadCallback,
		animation: 0,
		wrap:'both',
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

function featurecarousel_initCallback(carousel) {
    jQuery('#featurecarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#featurecarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function bottomfeaturecarousel_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('#bottomfeaturecarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#bottomfeaturecarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};
