/* Copyright (c)2002 ELR Software Pty Ltd. http://www.elr.com.au   */
/*                                                                 */
/* This program is free software; you may use, redistribute and/or */
/* modify it under the terms of the GNU General Public License as  */
/* published by the Free Software Foundation; either version 2 of  */
/* the License, or (at your option) any later version.             */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of  */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.            */
/* See the GNU General Public License for more details.            */
/* http://www.fsf.org/home.html                                    */

function openClose() {
  if (document.all) {
    var menu = ('menu_'+window.event.srcElement.innerText).toLowerCase();
    menu = menu.replace(/\s/g,'_');
    for (var i=0; i < document.all.length; i++) {
      if (document.all[i].tagName.toLowerCase() == 'ul') {
        var m = document.all[i].id;
        if (m.toLowerCase() == menu) {
          /* alert(m + ' | ' + menu); */
          m = eval('document.all.'+m);
          m.style.display = (m.style.display == 'inline') ? 'none' : 'inline';
          var lastmenuCookie = new Cookie(this.document.location.pathname+'_'+menu);
          lastmenuCookie.store(m.style.display);
        }
      }
    }
  }
}

function init() {
  if (document.all) {
    for (var i=0; i < document.all.length; i++) {
      if (document.all[i].tagName.toLowerCase() == 'ul') {
        /* alert(document.all[i].id); */
        var menu = document.all[i].id.toLowerCase();
        menu = menu.replace(/\s/g,'_');
        if (menu.indexOf('menu_') == 0) {
          var lastmenuCookie = new Cookie(this.document.location.pathname+'_'+menu);
          var display = lastmenuCookie.get();
          display = (display) ? display : 'none';
          var m = eval('document.all.'+menu);
          m.style.display = display;
        }
      }
    }
  }
}
