// Javascript Code on Home Page (index.html).
// Sets up roll-overs for top and left-side menu items,
// plus changes the "Page" graphic and links while mousing over the left-side menu items.
// Copyright 2001 David Roth. All Rights Reserved.

var numPageElements = 9;
// determine which browser version
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1 : 0;
DOM = (document.getElementById) ? 1 : 0;
DHTML = (NS || IE || DOM) ? 1 : 0;
// check if this browser supports DOM image objects
if (DHTML) {
  // load an array of mouseout image names
  // (mouseover names are the same but are implied to have an "_on" appended)
  arImageFiles = new Array (
    "logo_asi", "logo1", "logo2", "logo3", "logo4", "logo5", "logo6",
    "menu1", "menu2", "menu3", "menu4", "menu5", "menu6", "menu7", "menu8", "menu9"
  );
  // set up the DOM image objects and source file references
  for (counter in arImageFiles) {
    eval( arImageFiles[counter] + ' = new Image();' );
    eval( arImageFiles[counter] + '.src = "images/" + arImageFiles[counter] + ".jpg" ' );
    eval( arImageFiles[counter] + "_on" + ' = new Image();' );
    eval( arImageFiles[counter] + "_on" + '.src = "images/" + arImageFiles[counter] + "_on.jpg" ' );
  }
  // (this particular image is really a gif, not a jpg...)
  logo_asi_on.src = "images/logo_asi_anim.gif";
}

// the function that does the actual mouseover and mouseout work for menu items
// 1st & 2nd argument handles the menu item flash
// if it exists, the 3rd argument rotates the Page stylesheet
function changeImages() {
  if (DHTML) {
    document[changeImages.arguments[0]].src = eval(changeImages.arguments[1] + ".src");
    if (changeImages.arguments[2]) {
      for (var i=0; i<numPageElements; i++) {
        if (DOM) document.getElementById('page'+i+'').style.visibility = "hidden";
        else if (IE) document.all['page'+i+''].style.visibility = "hidden";
          else document.layers['page'+i+''].visibility = "hide"; //if (NS)
      }
      if (DOM) document.getElementById('page'+changeImages.arguments[2]+'').style.visibility = "visible";
      else if (IE) document.all['page'+changeImages.arguments[2]+''].style.visibility = "visible";
        else document.layers['page'+changeImages.arguments[2]+''].visibility = "show"; //if (NS)
    }
  }
}

//the function that flashes the links on the page stylesheets
function flash(elmt,action) {
  if (DHTML) {
    if (NS) return; //Netscape can't support mouse events for DIV's... only A anchors, but the resultant partial highlighting of just the text would look too weird under IE...
    if (DOM)
      var item = document.getElementById(elmt.id).style;
    else if (IE)
      var item = elmt.style;
    if (action=="on") {
      item.backgroundColor = "#dd66dd";
      item.border = "solid #dd99dd 1px";
      item.borderColor = "#ddaabb #dd33dd #dd33dd #ddaabb";
      item.padding = "1px 2px";
      }
    else {
      item.backgroundColor = "#ccffcc";
      item.border = "none";
      item.padding = "2px 3px";
      }
  }
}

// Dreamweaver's Netscape Resize Fix code
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

