function RotateImages () {
	var RotateImages = {
		list           : new Array(),
		fadeTimer      : 50,
		rotateTimer    : 2000,
		fadeInterval   : 0,
		rotateInterval : 0,
		count          : 0,
		path           : "",
		oldImage       : null,
		newImage       : null,
		areaDOM        : null,
		
		setRotateTimer : function (p) {
			this.rotateTimer = p;
		},
		
		setFadeTimer : function (p) {
			this.fadeTimer = p;
		},
		
		setPath : function (p) {
			this.path = p;
		},
		
		setArea : function (p) {
			if(typeof p == "string")
				this.areaDOM = document.getElementById(p);
			else
				this.areaDOM = p;
		},
		
		setList : function (p) {
			if(typeof p == "string") {
				var vector = p.split(",");
				for(var i=0; i<vector.length; i++)
					this.list.push(vector[i]);
			}
			else 
				this.list = p;
		},
		
		start : function () {
			if(this.rotateInterval > 0)
				return;
		
			this.loadNext();
			
			var main = this;
			this.rotateInterval = setInterval(function(){main.loadNext()}, this.rotateTimer);
		},
		
		stop : function () {
			clearInterval(this.rotateInterval);
			this.rotateInterval = 0;		
		},
		
		loadNext : function () {
			if(this.count >= this.list.length)
				this.count = 0;
				
			this.newImage = this.createImage(this.list[this.count]);
			this.oldImage = this.areaDOM.getElementsByTagName("img")[0];
			this.areaDOM.appendChild(this.newImage);
			this.startFade();
			this.count++;
		},
				
		createImage : function (img) {
			var element = document.createElement("img");
			element.setAttribute("id", "image("+this.path+img+")");
			element.setAttribute("src", this.path+img);
			element.style.position = "absolute";
            element.style.top = "0px";
            element.style.left = "0px";
			element.style.opacity = "0";
			element.style.filter = "alpha(Opacity=0)";
			
			return element;
		},
		
		startFade : function () {
			var main = this;
			if(this.fadeInterval == 0)
				this.fadeInterval = setInterval(function(){main.updateFade()}, this.fadeTimer);
		},
		
		updateFade : function () {
			var opacity = Number(this.newImage.style.opacity);
			this.newImage.style.opacity = (opacity+0.2);
			this.newImage.style.filter = "alpha(Opacity="+((opacity+0.2)*100)+")";
			if(opacity >= 1) {
				this.stopFade();
				this.newImage.style.opacity = "";
				this.newImage.style.filter = "";
				try {
					this.oldImage.parentNode.removeChild(this.oldImage);
				}
				catch(o){}
			}		
		},
		
		stopFade : function () {
			clearInterval(this.fadeInterval);
			this.fadeInterval = 0;
		}
	};

	return RotateImages;
}