/ GREAT library of addon functions from "DOM Scripting" by Jeremy Keith



// addLoadEvent - calls a JS function AFTER the document loads



function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      oldonload();

      func();

    }

  }

}

// Sample:

// addLoadEvent(yourJSFunction);



// insertAfter -  - goes hand in hand with insertBefore (part of the official DOM)



function insertAfter(newElement,targetElement) {

  var parent = targetElement.parentNode;

  if (parent.lastChild == targetElement) {

    parent.appendChild(newElement);

  } else {

    parent.insertBefore(newElement,targetElement.nextSibling);

  }

}

// Sample: Insert node 'placeholder' AFTER node 'gallery'

// insertAfter(placeholder,gallery);





addLoadEvent(setUp('OM Form'));

addLoadEvent(toose);



function toose() {

	var seti = document.getElementById("navi");

	var ti = document.getElementById("AA");

	var jj = document.getElementById("key");

	var ti_toggle = 0;

    ti.onclick = function() {

      if (ti_toggle == 0) {

	      ti_toggle++;

	      ti.style.border = "solid 5px #00ff00";

      }

      else {

	      ti_toggle = 0;

	      ti.style.border = "none";

      }

	}

    ti.onkeypress = ti.onclick;

    seti.onchange = function() {

      seti.style.border = "solid 2px #ff4400";

      go("na");

	}

}



function setUp(abc) {

	oldLayer = "none";

	window.scroll(0,0);

	alert(abc);

}



function OLStatus() {

	alert(oldLayer);

}



function go(trigger)

{

	if (trigger == "na") {

	box = document.forms[0].navi;

	destination = box.options[box.selectedIndex].value;

	if (destination) location.href = destination;

	newLayer = destination.substring(1); // trim "#" off of navigation target

	document.getElementById("ABC").style.color = "#666"; // set color to all to gray

	document.getElementById("ABC").style.fontStyle = "italic"; // italicize everything

	document.getElementById(newLayer).style.color = "#000"; // set color to all to gray

	document.getElementById(newLayer).style.fontStyle = "normal"; // italicize everything

	document.getElementById(newLayer).style.backgroundColor = "#fff"; // set newLayer to offwhite color

	document.getElementById(newLayer).style.border = "solid #999 2px"; // set border

        document.getElementById(newLayer).style.marginTop = "2em";

        document.getElementById(newLayer).style.padding = "2em";

	//document.getElementById("HomeAllArrow").style.visibility = "visible"; // hide arrow

	if (oldLayer != "none") { 	// restore default look to old div

		document.getElementById(oldLayer).style.backgroundColor = "#eaeaea";

		document.getElementById(oldLayer).style.border = "none"; // remove borders

                document.getElementById(oldLayer).style.padding = "0px";

                document.getElementById(oldLayer).style.marginTop = "1px";

		//document.getElementById("HomeAllArrow").style.visibility = "hidden"; // hide arrow

	}

	oldLayer = newLayer; // Now set oldLayer for next execution of go()

	//OLStatus();

	}

}