var browser, verStr = navigator.appVersion, app = navigator.appName, version = parseFloat(verStr);

var content = new Array('preloader', 'bodycontent');

function test_browser () {
  if ((app.indexOf('Netscape') != -1) && version >= 5) {
    browser = "netscape";
  }
  else if ((app.indexOf('Microsoft') != -1) && version >= 4) {
    browser = "ie";
  }
}

function show_sub(show_which_sub, var_array, mode) {

  for (i = 0; i < eval(var_array + ".length"); i++) {
    if (eval(var_array + "[i]") != show_which_sub && document.getElementById(eval(var_array + "[i]"))) {
  	  hide_sub(eval(var_array + "[i]")); 
    }    
  }

  if (show_which_sub != "" && document.getElementById(show_which_sub)) {  
    if (browser == "netscape") {
      if (document.getElementById(show_which_sub).style.display == 'block') {
        if (mode == 1) {
          document.getElementById(show_which_sub).style.display = 'none';
        }
      }
      else {
        document.getElementById(show_which_sub).style.display = 'block';
      }
    }
    else if (browser == "ie") {
      show_menu = eval(show_which_sub);
      if(show_menu.style.display == 'block'){
        if (mode == 1) {
          show_menu.style.display = 'none'; 
        }
      } 
      else {
        show_menu.style.display = 'block';    
      }
    }    
  }
  
}

function hide_sub(which_sub) {
  if (browser == "netscape" && document.getElementById(which_sub)) {
    document.getElementById(which_sub).style.display = 'none'; 
  }
  else if (browser == "ie" && document.getElementById(which_sub)) {
    sub_menu = eval(which_sub); 
    sub_menu.style.display = 'none';    
  }
}

function auto_hide() {
  show_sub("");
}

function update_image(show_which_sub, var_array) {

  var dsp_op;
  
  for (i = 0; i < eval(var_array + ".length"); i++) {
    if (eval(var_array + "[i]") != show_which_sub && document.getElementById(eval(var_array + "[i]"))) {
      collapse(eval(var_array + "[i]"));
    }    
  }
  
  if (browser == "netscape" && document.getElementById(show_which_sub)) {
    dsp_op = document.getElementById(show_which_sub).style.display;     
  }
  else if (browser == "ie" && document.getElementById(show_which_sub)) {
    show_menu = eval(show_which_sub);
    dsp_op = show_menu.style.display; 
  }   
  if (dsp_op == 'block') {
    eval("document.img" + show_which_sub + ".src='images/collapse.gif'");
  }
  else {
    eval("document.img" + show_which_sub + ".src='images/expand.gif'"); 
  }
}

function collapse(hide_which_sub) {
  eval("document.img" + hide_which_sub + ".src='images/expand.gif'");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

test_browser();