aitlOldOnload = window.onload;
window.onload = function() {
  // First, find the ID code in the calling document
  var sidStr = '';
  scrs = document.getElementsByTagName('script');
  for (i=0; i<scrs.length; i++) {
    if (scrs.item(i).src.indexOf('addIdToLinks')>=0) {
      sidStr = scrs.item(i).innerHTML.replace('<!--','').replace('-->','');
      break;
    }
  }

  // Now, add the id string to the query of all local links
  for (i=0;  i<document.links.length; i++) {
    var a = document.links[i];
    if (a.protocol == 'mailto:')  continue;
    if (a.protocol == 'javascript:')  continue;
    if (a.href.substring(0,0) == '#')   continue;
    if (a.href == '')   continue;
    if (a.href.indexOf(sidStr)>=0)   continue;
    if ((a.hostname=='') || (a.hostname.indexOf('premiere-schools')>=0)) {
      a.href = a.href+((a.search.indexOf('?')>=0) ? '&':'?')+sidStr;
    }
  }
}

