function Gallery(displayId, preloadClass, slideSpeed, fadeSpeed) {
		this.imgIndex = 0;
		this.display = displayId;		
		this.links = $(preloadClass).get();
		this.imgNumber = this.links.length;
		this.slideSpeed = slideSpeed;
		this.fadeSpeed = fadeSpeed;
		this.slideShow = null;
																	
		this.showImg = function(_index, fade) {
			if(!_index)
				index = this.imgIndex;
			else
				index = _index;
			
			var link = this.links[index];
			
			if($("#displayImg")) {
				$("#displayImg").remove();
			}
			$("<img id='displayImg' class='fade' src='" + link.href + "'/>").appendTo(this.display);			
			if(fade)
				$(".fade").css({display: "none"}).fadeIn(this.fadeSpeed);
		}
		
		this.setIndex = function(index) {
			this.imgIndex = index;
		}
		
		this.showNext = function(fade) {
			this.imgIndex = ++this.imgIndex % this.imgNumber;
			this.showImg(null, fade);
		}
		
		this.showPrev = function(fade) {
			this.imgIndex = --this.imgIndex;
			if(this.imgIndex < 0) this.imgIndex = this.imgNumber - 1;
			this.showImg(null, fade);
		}
		
		this.addCommands = function(commands,commandsPanel) {
			$(commands).appendTo($(commandsPanel));			
		}
		
		this.start = function(_obj) {
			obj = _obj;			
			obj.showNext(true);
			this.slideShow = setTimeout("obj.start(obj)", this.slideSpeed);
		}
		
		this.stop = function() {
			clearTimeout(this.slideShow);
		}
}