
function tickerGo () {
  if (tickerCurStringLocation > tickerText[tickerCurArrayLocation].length) {
    tickerCurArrayLocation++;
    tickerCurStringLocation = 1;
  }
  else {
    tickerCurStringLocation++;
  }
  if (tickerCurArrayLocation >= tickerText.length) {
    tickerCurArrayLocation = 0;
  }
  if (tickerLink[tickerCurArrayLocation].length > 0) {
    ticker.innerHTML = '<a href="' + tickerLink[tickerCurArrayLocation] + '">' + tickerText[tickerCurArrayLocation].substring(0, tickerCurStringLocation) + '</a>';
  }
  else {
    ticker.innerHTML = tickerText[tickerCurArrayLocation].substring(0, tickerCurStringLocation);
  }
  if (tickerCurStringLocation == tickerText[tickerCurArrayLocation].length) {
    setTimeout('tickerGo()', tickerTimeoutPause);
  }
  else {
    setTimeout('tickerGo()', tickerTimeoutNormal);
  }
}


function pageLoad () {
//  if (document.getElementById && document.getElementById('ticker')) {
//    ticker = document.getElementById('ticker');
//    tickerGo();
//  }
  fixExternalLinks();
}


if (window.addEventListener){
  window.addEventListener('load', pageLoad, false); 
}
else if (window.attachEvent){
  window.attachEvent('onload', pageLoad);
}


function menuOpen (id) {
  if (document.getElementById(id)) {
    document.getElementById(id).style.display = 'block';
  }
}

function menuClose (id) {
  if (document.getElementById(id)) {
    document.getElementById(id).style.display = 'none';
  }
}


function fixExternalLinks () {
  if (document.getElementsByTagName) {
    var links = document.getElementsByTagName('a');
    for (var i=0; i<links.length; i++) {
      if (links[i].getAttribute('rel') && (links[i].getAttribute('rel').indexOf('external') != -1)) {
        links[i].setAttribute('target', '_blank');
        if (!links[i].getAttribute('title')) {
          links[i].setAttribute('title', '[External] This link will open in a new window');
        }
      }
    }
  }
}






