var imagecarousel = {	itemVisibleInCallback: function(carousel, item, i, state, evt) {		if (state == 'prev') {			var idx = carousel.index(i);			carousel.add(i, carousel.get(idx).html());		}	},	itemVisibleOutCallback: function(carousel, item, i, state, evt) {		if (state == 'next') {			var indexes = imagecarousel.getCarouselIndexes(carousel);			var idx = carousel.index(i);			carousel.add((indexes[1] + 1), carousel.get(idx).html());		}	},	getCarouselIndexes: function(carousel) {		var first_index = carousel.prevFirst;		var last_index = first_index;		var ok = false;		while (ok == false) {			if (carousel.get(last_index).html() == null) {				return [first_index, last_index-1];			}			last_index = last_index + 1;		}	},	randomize: function(carousel, childElem) {		var $this = jQuery(carousel);		var elems = $this.children(childElem);		elems.sort(function() { return (Math.round(Math.random())-0.5); });		$this.remove(childElem);		for(var i=0; i < elems.length; i++) {			$this.append(elems[i]);		}	},	/**	 * Normal initCallback	 */	initCallback: function(carousel, state) {		carousel.buttonNext.bind('click', function() {			carousel.startAuto(0);		});		carousel.buttonPrev.bind('click', function() {			carousel.startAuto(0);		});	},	/**	 * Mouseover initCallback	 */	initCallbackMouseover: function (carousel, state) {		carousel.buttonNext.bind('click', function() {			carousel.startAuto(0);		});		carousel.buttonPrev.bind('click', function() {			carousel.startAuto(0);		});		carousel.clip.hover(function() {			carousel.stopAuto();		}, function() {			carousel.startAuto();		});	}};
