	var v = false;
var m = null;
var i = null;
// Set all menu trees to null to avoid any error in JavaScript 1.0 browsers -->

var urpm = self; // frame work-around
// urpm = parent.dummy; // Set the target to the relevant frame
// Comment out the above if you don't intend to use frames

function get(form)
{
   // loop thru document.forms property and exit w/ current form index
   var num = -1;
   for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i] == form) {
         num = i; // save form index
         break;
      }
   }
   return num; // returns current form index
}

function sindex(num, offset, elt)
{ 
   // sel finds selected index of num + offset's form elt's element
   // in this case elt is always 0, or first select menu in each form
   var sel = document.forms[ num + offset ].elements[elt].selectedIndex;
   if (sel < 0) sel = 0;
   return sel;
}

function jmp(form, elt)
{ // urpm.location added for optional navigation to named frames
   if (form != null) {
      with (form.elements[elt]) {
         if (0 <= selectedIndex)
            urpm.location = options[selectedIndex].value; // jump to selected option's value
      }
   }
}

function update(num, elt, m)
{ // updates submenus - form(num)'s menu options, and all submenus
   // if refd form exists
   if (num != -1) {
      num++; // reference next form, assume it follows in HTML
      with (document.forms[num].elements[elt]) {
         for (var i = options.length - 1; 0 < i; i--)
            options[i] = null; // null out options in reverse order (bug work-around)
         for (var i = 0; i < m.length; i++) {
            options[i] = new Option(m[i].text, m[i].value); // fill up next menu's items
         }  
         options[0].selected = true; // default to 1st menu item, windows bug kludge
      }
      if (m[0].length != 0) {
         update(num, elt, m[0]); // update subsequent form if any grandchild menu exists
      }
   }
}

function relate(form, elt, tree, depth)
{ // relate submenus based on sel of form - calls update to redef submenus
   if (v) {
      var num = get(form); // fetch the current form index
      var a = tree;        // set a to be the tree array
      while (a != null && --depth != -1)
         // traverse menu tree until we reach the corresponding option record
         a = a[sindex(num, -depth, elt)];
      // at depth 3, should end up w/ something like a[i][j][k]
      // where each index holds the value of s(elected )index in related form select elts
      if (a != null && a.length) {
         // if a array exists and it has elements,
         // feed update() w/ this record reference
         update(num, elt, a); 
         return;
      }
   }
   // if a hasn't any array elements or new Option unsupported then end up here ;)
   jmp(form, elt); // make like a live popup
}

// Internet Explorer 4+ bug fix:
// IE4+ remembers the index of each SELECT but NOT the CONTENTS of each SELECT, 
// so it gets it wrong.
//
// Thanks to Peter Belesis (pbel@internet.com) for pointing this out.

function resetIE() {
   for (var i = 0; i < document.forms.length; i++) {
      document.forms[i].reset();
   }
}

if (document.all)
   window.onload = resetIE;
// -->

// Check if Option constructor is supported
if ((typeof(Option) + "") != "undefined") v = true;

// This constructor works equally well for 2D,3D and over
function O(text, value, submenu)
{
   this.text = text;
   this.value = value;
   this.length = 0;
   if (submenu != null) {
      // submenu is an array of options...
      for (var i = 0; i < submenu.length; ) {
         this[i] = submenu[i];
         this.length = ++i;
      }
   }







}