function showArticle (thisArticle) { //--- Displays details of an article, replacing existing info if (lastArticle == thisArticle) { return; } document.getElementById ('rotatingNewsRow' + lastArticle).style.backgroundColor = '#DDAE44'; document.getElementById ('rotatingNewsRow' + thisArticle).style.backgroundColor = '#ffcc66'; document.getElementById ('articleTitle').innerHTML = "" + RotatingNews[thisArticle][0] + ""; document.getElementById ('articleBody').innerHTML = RotatingNews[thisArticle][2]; document.getElementById ('articleTournament').innerHTML = RotatingNews[thisArticle][4]; lastArticle = thisArticle; fadeImage ('imageFadeDiv', 'articlePic', RotatingNews[thisArticle][1], 250); } function moveArticle () { //--- Moves to the next article in sequence switch (lastArticle) { case 0: showArticle (1); break; case 1: showArticle (2); break; case 2: showArticle (3); break; case 3: showArticle (4); break; case 4: showArticle (5); break; case 5: showArticle (6); break; case 6: showArticle (0); break; } } 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 ();