<!--
function loadItemHandler(carousel, start, last, available)
{
    if (available) {
        // Trigger loaded
        carousel.loaded();
        return;
    }

    var cr = carousel;

    jQuery.get("/slideshow1.txt", function(data) {
        appendItemCallback(cr, start, last, data);
    });
};

function appendItemCallback(carousel, start, last, data)
{
    var items = data.split("|");

    for (i = start; i <= last; i++) {
        if (items[i-1] == undefined) {
            break;
        }

        var item = carousel.add(i, getItemHTML(items[i-1]));

        item.each(function() {
            // Urgh...ThickBox should provide a function for that
            jQuery("a.thickbox", this).bind("click", function() {
                var t = this.title || this.name || null;
                var g = this.rel || false;
                TB_show(t,this.href,g);
                this.blur();
                return false;
            });
        });
    }

    // Trigger loaded
    carousel.loaded();
};

function getItemHTML(data)
{
    var split = data.split(";");
    var url   = jQuery.trim(split[0]);
    var title = jQuery.trim(split[1]);
	var file  = jQuery.trim(split[2]);
	var width = jQuery.trim(split[3]);
	var height = jQuery.trim(split[4]);
    return '<a href="' + file + '?TB_iframe=true&height=' + height + '&width=' + width + '" title="' + title + '" class="thickbox" target="_top" rel="nofollow"><img src="' + url + '" width="' + 75 + '" height="' + 75 + '" alt="' + title + '" /><span class="jcarousel-title">' + title + '</span></a>';
};

// Next-Button handling...
var nextOver = function() {
    jQuery(this).attr("src", "/img/horizontal-ie7/next-over.gif");
};

var nextOut = function() {
    jQuery(this).attr("src", "/img/horizontal-ie7/next.gif");
};

var nextDown = function() {
    jQuery(this).attr("src", "/img/horizontal-ie7/next-down.gif");
};

function nextButtonStateHandler(carousel, button, enabling)
{
    if (enabling) {
        jQuery(button).attr("src", "/img/horizontal-ie7/next.gif")
                      .bind("mouseover", nextOver)
                      .bind("mouseout", nextOut)
                      .bind("mousedown", nextDown);
    } else {
        jQuery(button).attr("src", "/img/horizontal-ie7/next-disabled.gif")
                      .unbind("unmouseover", nextOver)
                      .unbind("unmouseout", nextOut)
                      .unbind("unmousedown", nextDown);
    }
}

// Prev-Button handling
var prevOver = function() {
    jQuery(this).attr("src", "/img/horizontal-ie7/prev-over.gif");
};

var prevOut = function() {
    jQuery(this).attr("src", "/img/horizontal-ie7/prev.gif");
};

var prevDown = function() {
    jQuery(this).attr("src", "/img/horizontal-ie7/prev-down.gif");
};

function prevButtonStateHandler(carousel, button, enabling)
{
    if (enabling) {
        jQuery(button).attr("src", "/img/horizontal-ie7/prev.gif")
                      .bind("mouseover", prevOver)
                      .bind("mouseout", prevOut)
                      .bind("mousedown", prevDown);
    } else {
        jQuery(button).attr("src", "/img/horizontal-ie7/prev-disabled.gif")
                      .unbind("unmouseover", prevOver)
                      .unbind("unmouseout", prevOut)
                      .unbind("unmousedown", prevDown);
    }
}

// Ride the carousel...
jQuery(document).ready(function() {
    /**
     * We show a simple loading indicator
     * using the jQuery ajax events
     */
    jQuery().ajaxStart(function() {
        jQuery(".loading").show();
    });

    jQuery().ajaxStop(function() {
        jQuery(".loading").hide();
    });

    jQuery("#mycarousel2").jcarousel({
        itemVisible: 3,
        itemScroll: 1,
        wrap: true,
		itemHeight:120,
        loadItemHandler: loadItemHandler,
        nextButtonStateHandler: nextButtonStateHandler,
        prevButtonStateHandler: prevButtonStateHandler
    });
});


