	function ArticleFade() {
		//Initialise parameters
		this.items = Array();
		this.item = 0;
		this.delay = 5000;
		this.fadeDuration = 500;
		
		//Store the passed params
		if (arguments.length > 0) {
			this.delay = arguments[0];
		}
		if (arguments.length > 1) {
			this.fadeDuration = arguments[1] / 2;
		}		
		if (arguments.length > 2) {
			for (var i=2; i<arguments.length; i++) {
				this.items.push(arguments[i]);
			}
		}
		
		if (this.items.length > 0) {
			//Un-hide the first item
			document.getElementById(this.items[this.item]).style.visibility = 'visible';		

			//Fade in the first item
			opacity(this.items[0], 0, 100, this.fadeDuration);
			
			//Set up a timer to change to the next image (if more than one)
			if (this.items.length > 1) {
				ocopy = this;
				setTimeout(function() { ocopy.fadeOut() }, this.delay + this.fadeDuration);
			}
		}
		
	}
	ArticleFade.prototype.fadeOut = function() {
		//Fade out the current item
		opacity(this.items[this.item], 100, 0, this.fadeDuration);

		//Set up a timer to change to the next image
		ocopy = this;
		setTimeout(function() { ocopy.fadeIn() }, this.fadeDuration);
	}
	ArticleFade.prototype.fadeIn = function() {
		//Hide the item completely
		document.getElementById(this.items[this.item]).style.visibility = 'hidden';		
		
		//Pick the next item
		if (this.item == (this.items.length-1)) {
			this.item = 0;
		} else {
			this.item++;
		}

		//Show the new item item
		document.getElementById(this.items[this.item]).style.visibility = 'visible';		
				
		//Fade in to the new image
		opacity(this.items[this.item], 0, 100, this.fadeDuration);

		//Set up a timer to change to the next image
		ocopy = this;
		setTimeout(function() { ocopy.fadeOut() }, this.delay + this.fadeDuration);
	}


	//Opacity functions:
	function opacity(id, opacStart, opacEnd, millisec) {
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;
	
		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++)
				{
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	}
	
	//change the opacity for different browsers
	function changeOpac(opacity, id) {
		var object = document.getElementById(id).style; 
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
	}
	
	function shiftOpacity(id, millisec) {
		//if an element is invisible, make it visible, else make it ivisible
		if(document.getElementById(id).style.opacity == 0) {
			opacity(id, 0, 100, millisec);
		} else {
			opacity(id, 100, 0, millisec);
		}
	}

