		var Banner = {
			numImages : 8,
			images : [],
			bannerInUse : [],
			minDelay : 0.5,
			maxDelay : 3.0,
			duration : 1.0,

			start : function (banner, options) {
				this._setup(banner);
				try {
					this.duration = options.duration;
				} catch (e) {}
				try {
					this.minDelay = options.minDelay;
				} catch (e) {}
				try {
					this.maxDelay = options.maxDelay;
				} catch (e) {}

				setTimeout('Banner.step()', this._randomTimer());
			},

			step : function() {
				bannerNo = Math.floor(Math.random() * this.numImages);
				while (this.bannerInUse[bannerNo] == true) {
					bannerNo = Math.floor(Math.random() * this.numImages);
				}				
				this.bannerInUse[bannerNo] = true;
				this._cycle(bannerNo);
				setTimeout('Banner.step()', this._randomTimer());
			},

			_randomTimer : function () {
				return Math.floor((Math.random(this.maxDelay-this.minDelay)+this.minDelay) * 1000);
			},		

			_setup : function (banner) {
				for (i = 0; i < this.numImages; i++) {
					imgContainer = document.createElement('div');
					imgContainer.setAttribute('id', 'banner'+i);
					imgContainer.setAttribute('class', 'bannerImgContainer');
					imgContainer.className = 'bannerImgContainer';
					img = document.createElement('img');
					img.src = this._getRandomImage();
					img.className = 'bannerImg';
					imgContainer.appendChild(img);
					banner.appendChild(imgContainer);
				}				
			},
			_cycle : function (pos) {
				bnr = document.getElementById('banner'+pos);
				for (i = 0; i < bnr.childNodes.length; i++){
					if (bnr.childNodes[i].nodeName == "IMG") {
						oldImage = bnr.childNodes[i];
						newImage = document.createElement('img');
						newImage.src = this._getRandomImage();
						newImage.className = 'bannerImg';
						bnr.appendChild(newImage);
						Element.hide(newImage);
						Effect.Appear(newImage, {duration: this.duration});
			
						setTimeout('Banner._cleanupBanner('+pos+')', this.duration*1000);
						setTimeout('Banner._recycleImage("'+oldImage.src+'")', this.duration*1000);
						break;
					}
				}
			},
			
			_cleanupBanner : function(pos) {
				// Remove first image
				bnr = document.getElementById('banner'+pos);
				for (i = 0; i < bnr.childNodes.length; i++) {
					if (bnr.childNodes[i].nodeName == "IMG") {
						bnr.removeChild(bnr.childNodes[i]);
						break;
					}
				}
				this.bannerInUse[pos] = false;
			},

			_removeImage : function(image) {
				this._recycleImage(image.src);
			},

			_getRandomImage : function () {
				imgNo = Math.floor(Math.random() * 258);
				while (this.images[imgNo] == true) {
					imgNo = Math.floor(Math.random() * 258);
				}				
				this.images[imgNo] = true;
				return '/cateprofiles/'+imgNo+'.jpg';
			},

			_recycleImage : function (url) {
				imgNo = url.substring(url.lastIndexOf('/')+1, url.lastIndexOf('.'));
				this.images[parseInt(imgNo)] = false;
			}
	
						

			
		}