var GcurrentlyChosenSwitch = 0; 
var GswitchInterval;
function StartSwitch() {ChooseSwitch(0);}
function NextSwitch() {
  GcurrentlyChosenSwitch = (GcurrentlyChosenSwitch == (switches.length-1)) ? 0 : (GcurrentlyChosenSwitch+1);
  AutoChooseSwitch(GcurrentlyChosenSwitch);
}
function AutoChooseSwitch(chosenSwitch) {
  GcurrentlyChosenSwitch = chosenSwitch;
  HighlightChosenThumb();
  for(var i=0;i<switches.length;i++) {
    if(i!=chosenSwitch) DeHighlightThumb(i);
  }
  DrawBigBox(chosenSwitch);
  if(GswitchInterval) window.clearInterval(GswitchInterval);
  GswitchInterval = window.setInterval("NextSwitch();",4000);
}
function ChooseSwitch(chosenSwitch) {
  GcurrentlyChosenSwitch = chosenSwitch;
  HighlightChosenThumb();
  for(var i=0;i<switches.length;i++) {
    if(i!=chosenSwitch) DeHighlightThumb(i);
  }
  DrawBigBox(chosenSwitch);
  if(GswitchInterval) window.clearInterval(GswitchInterval);
  GswitchInterval = window.setInterval("NextSwitch();",10000);
}
function HighlightChosenThumb() {
  document.getElementById("Thumb"+GcurrentlyChosenSwitch).innerHTML = switches[GcurrentlyChosenSwitch]["thumbChosen"];
}
function DeHighlightThumb(thisSwitch) {
  document.getElementById("Thumb"+thisSwitch).innerHTML = switches[thisSwitch]["thumb"];
}
function DrawBigBox() {
  document.getElementById("SwitchBanner").innerHTML = switches[GcurrentlyChosenSwitch]["banner"];
}
var switches = new Array();
switches[0] = new Array();
switches[0]["thumb"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center'>Send a Message to Stop TB</td></tr></table>";
switches[0]["thumbChosen"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#eeeeee'><tr><td align='center'>Send a Message to Stop TB</td></tr></table>";
switches[0]["banner"] = "<table width='100%' height='100%' bgcolor='#ffffff'><tr valign='top'><td align='center'><h1>Send a Message to Stop TB</h1></td></tr></table>";

switches[1] = new Array();
switches[1]["thumb"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center'>Demand Universal Access to Treatment</td></tr></table>";
switches[1]["thumbChosen"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#eeeeee'><tr><td align='center'>Demand Universal Access to Treatment</td></tr></table>";
switches[1]["banner"] = "<table width='100%' height='100%' bgcolor='#ffffff'><tr><td align='center'>2</td></tr></table>";

switches[2] = new Array();
switches[2]["thumb"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center'>Write a Letter to the Editor About XDRTB</td></tr></table>";
switches[2]["thumbChosen"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#eeeeee'><tr><td align='center'>Write a Letter to the Editor About XDRTB</td></tr></table>";
switches[2]["banner"] = "<table width='100%' height='100%' bgcolor='#ffffff'><tr><td align='center'>3</td></tr></table>";

switches[3] = new Array();
switches[3]["thumb"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center'>Join Us</td></tr></table>";
switches[3]["thumbChosen"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#eeeeee'><tr><td align='center'>Join Us</td></tr></table>";
switches[3]["banner"] = "<table width='100%' height='100%' bgcolor='#ffffff'><tr><td align='center'>4</td></tr></table>";

switches[4] = new Array();
switches[4]["thumb"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center'>Learn More</td></tr></table>";
switches[4]["thumbChosen"] = "<table width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#eeeeee'><tr><td align='center'>Learn More</td></tr></table>";
switches[4]["banner"] = "<table width='100%' height='100%' bgcolor='#ffffff'><tr><td align='center'>5</td></tr></table>";