/***********************************************

***********************************************/

var tickspeed=9000 //ticker speed in miliseconds (1000=1 second)

var selectedDiv=0 // var for currently selected div
var totalDivs=0 // var for number of divs




function contractall(){ // hides all articles and numbers
var inc=0; // counter
while (document.getElementById("hpFeature"+inc)){ // loop through all features
document.getElementById("hpFeature"+inc).style.display="none"; // hide feature
inc++; // move to next feature
}
}


function expandone(){ // show one feature
var selectedDivObj=document.getElementById("hpFeature"+selectedDiv); // find the current feature in the DOM
contractall(); // hide all features
selectedDivObj.style.display="block"; // show the selected feature
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0; // move to the next feature. go back to the first one if we're currently at the last one.
t=setTimeout("expandone()",tickspeed); // start the timer

subWrapperHeight(); // reset page heights - bottom is cut off in IE7 if this function isn't called
}


function startscroller(){ // start rotating features
while (document.getElementById("hpFeature"+totalDivs)!=null) // loop through all features
totalDivs++; // increment counter
expandone(); // show next feature
}


function jumpto(which){ // jump to a specific feature
selectedDiv=which; // mark the selected feature as the current one
window.clearTimeout(t); // reset the timer
expandone(); // show the selected feature
}


if (window.addEventListener)
window.addEventListener("load", startscroller, false);
else if (window.attachEvent)
window.attachEvent("onload", startscroller);
