var previd=''; var prevcls=''; var timeoutid=0; var ie = document.all?true:false; var ns47 = document.layers?true:false; var bShowMainmenu = false; function getDiv(id){ if(ie) return document.all.item(id); else if(ns47) return document.layers[id]; else return document.getElementById(id); } function getStyle(id) { //window.status = 'getStyle ' + id; if(ie) return document.all.item(id).style; else if(ns47) return document.layers[id]; else return document.getElementById(id).style; } function show(id){ //window.status = 'show ' + id; var styleEl = getStyle('sub'+id); if( styleEl == null ) window.status = 'ERROR: cannot show ' + id; else styleEl.visibility = 'visible'; if( bShowMainmenu ) { var classEl = getDiv('ref'+id); prevcls = classEl.getAttribute('className'); classEl.setAttribute('className', prevcls + 'sel'); // selected } } function hide(id){ //window.status = 'hide ' + id; var styleEl = getStyle('sub'+id); if( styleEl == null ) window.status = 'ERROR: cannot hide ' + id; else styleEl.visibility = 'hidden'; if( bShowMainmenu ) { var classEl = getDiv('ref'+id); classEl.setAttribute('className', prevcls); // selected } } function stoptimeout() { if(timeoutid != 0) { window.clearTimeout(timeoutid); timeoutid=0; } } /* function isParent(pid,cid) { var pel = getDiv(pid); var cel = getDiv(cid); while( cel.id != 'menuroot' && cel != null ) { if( cel.id == pel.id ) return true; cel = cel.parentElement; } return false; } */ function showsub(id) { stoptimeout(); if( previd != '' && id != previd /* && (id == '' || !isParent('sub'+previd, 'sub'+id)) */ ) hide(previd); if( id != '' && id != previd ) show(id); previd = id; } function hidesub(id) { stoptimeout(); timeoutid = window.setTimeout('showsub(\'\')', 1000); }