function showArticle(thisArticle) {
//--- Displays details of an article, replacing existing info

	if (lastArticle == thisArticle) {
		return;
	}

	document.getElementById ('rotatingNewsRow' + lastArticle).style.backgroundColor = '#ffffff';
	document.getElementById ('rotatingNewsRow' + thisArticle).style.backgroundColor = '#E6E6E6';
	document.getElementById ('articleTitle').innerHTML = "<a style='font-weight:bold;line-height:16px;font-size:12px;' href=\"" + RotatingNews[thisArticle][3] + "\">" + RotatingNews[thisArticle][0] + "</a>";
	document.getElementById ('articleBody').innerHTML = RotatingNews[thisArticle][2];
	lastArticle = thisArticle;
	fadeImage('imageFadeDiv', 'articlePic', RotatingNews[thisArticle][1], 250);

}

function moveArticle() {
//--- Moves to the next article in sequence

	if (document.getElementById ('rotatingNewsRow' + (lastArticle + 1))) {
		showArticle(lastArticle + 1);
	} else {
		showArticle(0);
	}

}

function startRotation() {
//--- Starts the timer

	lastTimer = setInterval ('moveArticle ()', 5000);

}

function stopRotation() {
//--- Stops the timer

	if (lastTimer != null) {
		clearInterval (lastTimer); lastTimer = null;
	}

}

function fadeImage(divID, imageID, imageFile, milliseconds) { 
//--- Fades the images

	if (busyFading) {
		return;
	}
	busyFading = true;

	var speed = Math.round (milliseconds / 100);
	var timer = 0;

	//--- Set the current image as background
	document.getElementById (divID).style.backgroundImage = "url('" + document.getElementById (imageID).src.replace ("'", "\\'") + "')";

	//--- Set image to transparent
	setOpacity (0, imageID);

	//--- Add image
	document.getElementById (imageID).src = imageFile;

	//--- Fade in new image
	for(i = 0; i <= 100; i++) {
		setTimeout ("setOpacity (" + i + ", '" + imageID + "')", (timer * speed));
		timer++;
	}

	busyFading = false;

}

function setOpacity(opacity, objectID) {
//--- Sets the object's opacity across browsers

    var object = document.getElementById (objectID).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";

}

var lastArticle = 0;
var lastTimer = null;
var busyFading = false;
var RotatingNews = new Array ();
var RotatingImgs = new Array ();

