var splashCurrent = 0;
var splashTimeout;

sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function displayToggle(elementID, anchorElement) {
  var d = document.getElementById(elementID);
  if (d) {
    if (d.style.display == "") {
      d.style.display = "block";
      anchorElement.className = "expand expanded";
    } else if (d.style.display == "block") {
      d.style.display = "none";
      anchorElement.className = "expand collapsed";
    } else if (d.style.display == "none") {
      d.style.display = "block";
      anchorElement.className = "expand expanded";
    }
  }
}

function splashSwitcher(num) {
  if (num > 4) {
    num = 1;
  }
  splashCurrent = num;
  var splash = document.getElementById("splash");
  var splashlink = document.getElementById("splashlink");
  var splashnav = document.getElementById("splashnav");

  var splashnavlinks = new Array();

  var count = 0;
  for(i=0; i<splashnav.childNodes.length; i++) {
    if (splashnav.childNodes[i].nodeName == 'A') {
      splashnav.childNodes[i].removeAttribute('class');
      splashnav.childNodes[i].removeAttribute('className');
      splashnavlinks[count++] = splashnav.childNodes[i];
    }
  }
  splashnavlinks[splashCurrent-1].setAttribute('class', 'active');
  splashnavlinks[splashCurrent-1].setAttribute('className', 'active');

  if (splashCurrent == 1) {
    splash.style.backgroundImage = 'url(images/splash-ESARVHP.jpg)';
    splashlink.href = 'solution_esarvhp.php';
  }
  if (splashCurrent == 2) {
    splash.style.backgroundImage = 'url(images/splash-ID.jpg)';
    splashlink.href = 'solution_idcards.php';
  }
  if (splashCurrent == 3) {
    splash.style.backgroundImage = 'url(images/splash-SNMS.jpg)';
    splashlink.href = 'solution_snms.php';
  }
  if (splashCurrent == 4) {
    splash.style.backgroundImage = 'url(images/splash-Consulting.jpg)';
    splashlink.href = 'solutions.php';
  }

}

function splashCycle() {
  splashSwitcher(splashCurrent+1);
  splashTimeout = setTimeout('splashCycle()', 5000);
}
