//
var lastnm = "item99"; // define global variable for tracking last visible menu
// setup test for Nav 4.0
var isNav4 = false
if ((navigator.appName == "Netscape") && 
     (navigator.appVersion.search("5.0") == -1))
   isNav4 = true

// for Nav 4.0 - capture events
function objSetEvents() {
   if (isNav4) {
       // Not needed
      }
}

// nav4 specific processing
function ns4_showMsg(evt) {
   showMsg(evt.target.name);
}

function ns4_hideMsg(evt) {
   hideMsg(evt.target.name);
}


// return to hideMsg - hide
function hideMsg(nm) {
   if (theobjs[nm])
   	theobjs[nm].objHide();
}

// showMsg code
function showMsg(nm) {
   if (theobjs[nm]) {
        if (theobjs[lastnm]) theobjs[lastnm].objHide();
         else
          lastnm = "item99";
   	theobjs[nm].objShow();
        lastnm = nm;
        }
}


// each browser gets its own object, with the same interfaces but differing implementations

// create IE DHTML object
function ie_object(obj) {
   this.css = obj;
   this.name = obj.name;
   this.objHide = domHide;
   this.objShow = domShow;
}

// create DOM object
function dom_object(obj) {
   this.css = obj;
   this.name = obj.name;
   this.objHide = domHide;
   this.objShow = domShow;
}

// IE/DOM hide element
function domHide() {
   this.css.style.visibility = "hidden";
}

// IE/DOM show element
function domShow() {
   this.css.style.visibility = "visible";
}


//
// The Navigator specific scripting object methods
//

// Navigator object
function ns_object(obj) {
   this.css = obj;
   this.name = obj.name;
   this.objHide = nsHide;
   this.objShow = nsShow;
}


// hide element
function nsHide() {
	this.css.visibility = "hidden";
}

// show element
function nsShow() {
	this.css.visibility = "inherit";
}


// Create the objects
//
//****************************************************************************************


// create IE objects
function create_ie_objects() {
   theelements = document.all.tags("DIV");
   theobjs = new Array();
   for (i = 0; i < theelements.length; i++)
      theobjs[theelements[i].id] = new ie_object(theelements[i]);
}

// create Navigator objects
function create_ns_objects() {
   theobjs = new Array();
   for (i = 0; i < document.layers.length; i++)
   	 theobjs[document.layers[i].name] = new ns_object(document.layers[i]);
   
}

// create DOM objects
function create_dom_objects() {
   theelements = document.getElementsByTagName("DIV");
   theobjs = new Array();
  for (i = 0; i < theelements.length; i++) {
      var obj = theelements[i];
      theobjs[obj.id] = new dom_object(obj);
      }
}
 
// call correct object loading method    
function create_objects() {

    // if 5.0 browser
    if (navigator.appVersion.indexOf("5.0") != -1)
	create_dom_objects();
    else 
    	if (navigator.appName == "Microsoft Internet Explorer")
	   create_ie_objects();
        else
  	   create_ns_objects();
}

