var curcontentindex=0
var stoptimer=0
var messages=new Array()

function getElementByClass(classname){
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
messages[inc++]=alltags[i]
}
}

function rotatecontent(){
curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0
prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1
messages[prevcontentindex].style.display="none" 
messages[curcontentindex].style.display="block"
}

function rotatecontentStop(){
clearInterval (stoptimer)
}

function dyncontentLook(){
if (document.all || document.getElementById){
    getElementByClass("dyncontent")
    if(messages.length>0)
    {
        stoptimer = setInterval("rotatecontent()", 8000)
    }
}
if (document.all || document.getElementById){
	var button1 = document.getElementById('feature_button1')
    if(button1) button1 = button1.style;
    var button2 = document.getElementById('feature_button2');
    if(button2) button2 = button2.style;
	var button3 = document.getElementById('feature_button3');
    if(button3) button3 = button3.style;
	var button4 = document.getElementById('feature_button4');
    if(button4) button4 = button4.style;
	var button5 = document.getElementById('feature_button5');
    if(button5) button5 = button5.style;
	var controls = document.getElementById('feature_controls').style;
  if (document.getElementById("feature_label1")) {
	  button1.display = button1.display = "inline";
	  hightlight1 = document.getElementById('feature_label1').style;
  }
  if (document.getElementById("feature_label2")) {
	  button2.display = button2.display = "inline";
	  controls.display = controls.display = "inline";
	  hightlight1.display = hightlight1.display = "inline";
}
  if (document.getElementById("feature_label3")) {
	  button3.display = button3.display = "inline";
	  controls.display = controls.display = "inline";
	  hightlight1.display = hightlight1.display = "inline";
}
  if (document.getElementById("feature_label4")) {
	  button4.display = button4.display = "inline";
	  controls.display = controls.display = "inline";
	  hightlight1.display = hightlight1.display = "inline";
}
  if (document.getElementById("feature_label5")) {
	  button5.display = button5.display = "inline";
	  controls.display = controls.display = "inline";
	  hightlight1.display = hightlight1.display = "inline";
}
}
}

function featureDisplay(selectedStory) {
  // Reset all
  var i=1;
  for (i=1; i<6; i++) {
      var featureName = 'feature' + i;
	  if (document.getElementById(featureName) != null) {
		document.getElementById(featureName).style.display = "none";
	  }
  }
  
  // Disply the selected feature
  if (selectedStory == "Selectfeature1") {	  
	  document.getElementById('feature1').style.display = "block";	  
  	}
  if (selectedStory == "Selectfeature2") {	  
	  document.getElementById('feature2').style.display = "block";
  	}
  if (selectedStory == "Selectfeature3") {	 
	  document.getElementById('feature3').style.display = "block";
	}
  if (selectedStory == "Selectfeature4") {	 
      document.getElementById('feature4').style.display = "block";
	}
  if (selectedStory == "Selectfeature5") {	  
      document.getElementById('feature5').style.display = "block"; 
	}
}
