function showArticle (thisArticle) {
//--- Displays details of an article, replacing existing info
//alert ('thisAritcle = ' + thisArticle + '1 : ' + RotatingNews[thisArticle][1] + ' :: 0 : ' + RotatingNews[thisArticle][0]);
if (lastArticle == thisArticle) {
return;
}
switch (thisArticle) {
case 0:
document.getElementById ('join-now-imgs').innerHTML = '


';
break;
case 1:
document.getElementById ('join-now-imgs').innerHTML = '


';
break;
case 2:
document.getElementById ('join-now-imgs').innerHTML = '


';
break;
case 3:
document.getElementById ('join-now-imgs').innerHTML = '


';
break;
default:
document.getElementById ('join-now-imgs').innerHTML = '


';
break;
}
document.getElementById ('rotatingNewsRow' + lastArticle).style.backgroundColor = '#ffffff';
document.getElementById ('rotatingNewsRow' + thisArticle).style.backgroundColor = '#E6E6E6';
//document.getElementById ('articleTitle').innerHTML = "" + RotatingNews[thisArticle][0] + "";
document.getElementById ('articleTitle').innerHTML = "" + RotatingNews[thisArticle][0] + "";
//document.getElementById ('articleBody').innerHTML = RotatingNews[thisArticle][2];
document.getElementById ('articleLink').href = RotatingNews[thisArticle][3];
document.getElementById ('articleLinkText').href = RotatingNews[thisArticle][3];
//alert ('changeArticle');
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); //original timer
lastTimer = setInterval ('moveArticle ()', 7000);
}
function stopRotation () {
//--- Stops the timer
if (lastTimer != null) {
clearInterval (lastTimer); lastTimer = null;
}
}
function fadeImage (divID, imageID, imageFile, milliseconds) {
//--- Fades the images
imageFile = '/content/' + imageFile;
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 ();