// Copyright Acro Media Inc. 1998-2006, www.acromediainc.com

function copyrightYear(){
  if(document.getElementById('insertYear')) document.getElementById('insertYear').innerHTML = new Date().getFullYear();
}


function externalLinks(){
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external") anchors[i].target = "_blank";
  }
}



//Checks to see if safari is on, boolean
var detect = navigator.userAgent.toLowerCase();
var safStatus,thestring;
function checkSafari(){ 
  if (checkIt('safari')) safStatus = true;
  else safStatus = false;
  function checkIt(string){
    place = detect.indexOf(string) + 1;
    return place;
  }
}

var currentVisible;
    
function setVisible(section) {
  if(currentVisible){
    removeActive(currentVisible);
  }
  document.getElementById('dataPopup').innerHTML = document.getElementById(section+'Data').innerHTML;
  var sectionElement = document.getElementById(section);
  if(sectionElement.className){
    sectionElement.className += " activeButton";
  }
  else{
    sectionElement.className = "activeButton";
  }
  currentVisible = section;
}
function closeBox(){
  if(currentVisible){
    removeActive(currentVisible);
    currentVisible = "";
  }
  document.getElementById('dataPopup').innerHTML = document.getElementById('dataPopupDefault').innerHTML;
}
function removeActive(currentBox){
  var tempString = document.getElementById(currentBox).className;
  tempString = tempString.replace('activeButton', "");
  tempString = tempString.replace(' ', "");
  document.getElementById(currentBox).className = tempString;
}

siteOnLoad = function (){
  checkSafari();
  copyrightYear();
  externalLinks();
}

function addLoadEvent(func){
  var oldOnLoad = window.onload;
  if(typeof window.onload != 'function'){ 
    window.onload = func;
  }
  else{ 
    window.onload = function(){ 
      oldOnLoad();
      func();
    }
  }
}


addLoadEvent(siteOnLoad);

