$j = jQuery.noConflict();

function Carousel(jqObj, noSlides, isRand) {
	this.jqObj = jqObj;
	this.noSlides = noSlides;
	this.isRand = isRand;
	firstImg = (isRand)? Math.floor(Math.random()*noSlides) : 0;
	this.start = firstImg;
	this.init = function() {
		jqObj.each(function(i) {
			if( i == firstImg ) { $j(this).fadeIn(1000); }
			else { $j(this).hide('fast'); }
		});
		return firstImg;
	}
	
	this.nextImg = function(curImg) {
		nextImg = (curImg+1 > noSlides-1)? 0 : curImg+1;
		jqObj.each(function(i) {
			if( i == nextImg ) { nextObj = $j(this); }
			else if ( i == curImg ) { prevObj = $j(this); }
		});
		prevObj.fadeOut(1000);
		nextObj.fadeIn(1000);
		return nextImg;
	}
}

$j(document).ready(function(){
	carousel1 = new Carousel($j('.slide'), 6, 0);
	curImg = carousel1.init();
	carousel1Timer = setInterval('curImg = carousel1.nextImg(curImg)', 8000);
});		

