﻿// Next-Button handling...
var nextOver = function() {
    jQuery(this).attr("src", "/images/horizontal-ie7/next-over.gif");
};

var nextOut = function() {
    jQuery(this).attr("src", "/images/horizontal-ie7/next.gif");
};

var nextDown = function() {
    jQuery(this).attr("src", "/images/horizontal-ie7/next-down.gif");
};

function nextButtonStateHandler(carousel, button, enabling)
{
    if (enabling) {
        jQuery(button).attr("src", "/images/horizontal-ie7/next.gif")
                      .bind("mouseover", nextOver)
                      .bind("mouseout", nextOut)
                      .bind("mousedown", nextDown);
    } else {
        jQuery(button).attr("src", "/images/horizontal-ie7/next-disabled.gif")
                      .unbind("unmouseover", nextOver)
                      .unbind("unmouseout", nextOut)
                      .unbind("unmousedown", nextDown);
    }
}

// Prev-Button handling
var prevOver = function() {
    jQuery(this).attr("src", "/images/horizontal-ie7/prev-over.gif");
};

var prevOut = function() {
    jQuery(this).attr("src", "/images/horizontal-ie7/prev.gif");
};

var prevDown = function() {
    jQuery(this).attr("src", "/images/horizontal-ie7/prev-down.gif");
};

function prevButtonStateHandler(carousel, button, enabling)
{
    if (enabling) {
        jQuery(button).attr("src", "/images/horizontal-ie7/prev.gif")
                      .bind("mouseover", prevOver)
                      .bind("mouseout", prevOut)
                      .bind("mousedown", prevDown);
    } else {
        jQuery(button).attr("src", "/images/horizontal-ie7/prev-disabled.gif")
                      .unbind("unmouseover", prevOver)
                      .unbind("unmouseout", prevOut)
                      .unbind("unmousedown", prevDown);
    }
}


// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        itemVisible: 6,
        itemScroll: 6,
        wrap: false,
        nextButtonStateHandler: nextButtonStateHandler,
        prevButtonStateHandler: prevButtonStateHandler
    });
});
