

$j = jQuery.noConflict(); 

(function($j) {
	$j.fn.slideShow = function(options) {
		debug(this);
		var opts = $j.extend({}, $j.fn.slideShow.defaults, options);
		return this.each(function() {
			$this = $j(this);

			var o = $j.meta ? $j.extend({}, opts, $this.data()) : opts;
			
			var slides = $this.children('img');
			slides.filter(":visible").css("display", "inline").removeClass("show");
			if(slides.length > 1) {
				var slideInterval = setInterval(function() { $j.fn.slideShow.slide(slides) }, $j.fn.slideShow.defaults.delay_speed);
			}
			
		});
	};

	function debug($obj) {
		if (window.console && window.console.log)
			window.console.log("hilight selection count: " + $obj.size());
	};

	$j.fn.slideShow.slide = function(slides) {
		var active_slide = slides.filter(":visible");
		var active_index = slides.index(active_slide);
		active_index = (active_index + 1) % 4;
		
		active_slide.fadeOut("slow");
		slides.eq(active_index).fadeIn("slow");
	};
	
	$j.fn.slideShow.defaults = {
		transition_speed: 1000,
		delay_speed: 5000
	};
	
	$j.fn.slideShow.nextSlide = function(slides, active_index) {
		slides.eq(active_index).fadeIn("slow");
	}
})($j);

$j(function(){
	$j("#banner-slides").slideShow();
});


