
var list; // global list variable cache
var tickerObj; // global tickerObj cache
var hex = 255;

function fadeText(divId) {
  if(tickerObj)
  {
    if(hex>0) {
      hex-=5; // increase color darkness
      tickerObj.style.color="rgb("+hex+","+hex+","+hex+")";
      setTimeout("fadeText('" + divId + "')", fadeSpeed); 
    } else
      hex=255; //reset hex value
  }
}

function initialiseList(divId) {
  tickerObj = document.getElementById(divId); 
  if(!tickerObj)
    reportError("Could not find a div element with id \"" + divId + "\"");
  list = tickerObj.childNodes;
  for (var i=0; i<list.length; i++) {
      if(list[i].nodeType==1){
	 list[i].style.display = "none";
      }
  }
  if(list.length <= 0)
    reportError("The div element \"" + divId + "\" does not have any children");
  for (var i=0; i<list.length; i++) {
    var node = list[i];
    if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
              tickerObj.removeChild(node);
  }
  run(divId, 0);
}


function run(divId, count) {
  /* fadeText(divId); */
  list[count].style.display = "block";
  if(count > 0)
    list[count-1].style.display = "none";
  else
    list[list.length-1].style.display = "none";
  count++;
  if(count == list.length)
    count = 0;
  window.setTimeout("run('" + divId + "', " + count+ ")", interval*1000);
}
function reportError(error) {
  alert("The script could not run because you have errors:\n\n" + error);
  return false;
}

var interval = 7; // interval in seconds
var fadeSpeed = 0; // fade speed, the lower the speed the faster the fade.  40 is normal.


//Next fading message
var list2; // global list variable cache
var tickerObj2; // global tickerObj cache
var hex2 = 255;

function fadeText2(divId2) {
  if(tickerObj2)
  {
    if(hex2>0) {
      hex2-=5; // increase color darkness
      tickerObj2.style.color="rgb("+hex2+","+hex2+","+hex2+")";
      setTimeout("fadeText2('" + divId2 + "')", fadeSpeed2);
    } else
      hex2=255; //reset hex value
  }
}

function initialiseList2(divId2) {
  tickerObj2 = document.getElementById(divId2);
  if(!tickerObj2)
    reportError2("Could not find a div element with id \"" + divId2 + "\"");
  list2 = tickerObj2.childNodes;
  for (var i=0; i<list2.length; i++) {
      if(list2[i].nodeType==1){
         list2[i].style.display = "none";
      }
  }
  if(list2.length <= 0)
    reportError2("The div element \"" + divId2 + "\" does not have any children");
  for (var i=0; i<list2.length; i++) {
    var node = list2[i];
    if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
              tickerObj2.removeChild(node);
  }
  run2(divId2, 0);
}


function run2(divId2, count) {
  /* fadeText(divId); */
  list2[count].style.display = "block";
  if(count > 0)
    list2[count-1].style.display = "none";
  else
    list2[list2.length-1].style.display = "none";
  count++;
  if(count == list2.length)
    count = 0;
  window.setTimeout("run2('" + divId2 + "', " + count+ ")", interval2*1000);
}
function reportError2(error) {
  alert("The script could not run because you have errors:\n\n" + error);
  return false;
}

var interval2 = 7; // interval in seconds
var fadeSpeed2 = 0; // fade speed, the lower the speed the faster the fade.  40 is normal.


//Next fading message
var list3; // global list variable cache
var tickerObj3; // global tickerObj cache
var hex3 = 255;

function fadeText3(divId3) {
  if(tickerObj3)
  {
    if(hex3>0) {
      hex3-=5; // increase color darkness
      tickerObj3.style.color="rgb("+hex3+","+hex3+","+hex3+")";
      setTimeout("fadeText3('" + divId3 + "')", fadeSpeed3);
    } else
      hex3=255; //reset hex value
  }
}

function initialiseList3(divId3) {
  tickerObj3 = document.getElementById(divId3);
  if(!tickerObj3)
    reportError3("Could not find a div element with id \"" + divId3 + "\"");
  list3 = tickerObj3.childNodes;
  for (var i=0; i<list3.length; i++) {
      if(list3[i].nodeType==1){
         list3[i].style.display = "none";
      }
  }
  if(list3.length <= 0)
    reportError3("The div element \"" + divId3 + "\" does not have any children");
  for (var i=0; i<list3.length; i++) {
    var node = list3[i];
    if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
              tickerObj3.removeChild(node);
  }
  run3(divId3, 0);
}


function run3(divId3, count) {
  /* fadeText(divId); */
  list3[count].style.display = "block";
  if(count > 0)
    list3[count-1].style.display = "none";
  else
    list3[list3.length-1].style.display = "none";
  count++;
  if(count == list3.length)
    count = 0;
  window.setTimeout("run3('" + divId3 + "', " + count+ ")", interval3*1000);
}
function reportError3(error) {
  alert("The script could not run because you have errors:\n\n" + error);
  return false;
}

var interval3 = 7; // interval in seconds
var fadeSpeed3 = 0; // fade speed, the lower the speed the faster the fade.  40 is normal.
