function readMenu(){ 
 var i,nested,menuTop,tU,parent,step,tn=navigator.userAgent.toLowerCase();
 var x,myURL,noIndexURL,indexPattern,k=-1;	// ,kk=-1,op=1
 if(window.opera){
   if(tn.indexOf("opera 5")>-1||tn.indexOf("opera 6")>-1){return;}
 }
 else if(!(menuTop=document.getElementById('menu'))){return;}   
 anchor=new Array;		// global array of anchor objects
 //menuTop=document.getElementById('menu');		// top level menu ul 
 //if(menuTop=document.getElementById('menu')){		// assignment!	
   anchor=menuTop.getElementsByTagName('A');				// all the anchors in menu
   for(i=0;i<anchor.length;i++){
     anchor[i].nbr=i; //anchor.length;					// index of this anchor in the list
     nested=anchor[i].parentNode.getElementsByTagName("UL");		// list of ul's under this li
     anchor[i].submenu=nested?nested[0]:false;								// ul under this li if any
     ev=anchor[i].getAttribute("onmouseover");					// already defined?
     if(!ev||typeof ev=='undefined'){									
       anchor[i].onmouseover=function(){ mouseOver(this); };	// mouseover
     }
     ev=anchor[i].getAttribute("onfocus");
     if(!ev||typeof ev=='undefined'){
       anchor[i].onfocus=function(){mouseOver(this); };		// onfocus
     }
     if(anchor[i].submenu){						// is this tab a submenu?
       parent=anchor[i].parentNode;				
       step=0;
       while(parent){
         if(parent.tagName&&parent.tagName=="UL"){
           step++;
         }
         parent=parent.parentNode;
       }
       anchor[i].depth=step;					// depth of this list 1 = top
     }
   }
   menuTop.onmouseout=mouseOut;		
   myURL=window.location.href;				// url of this page
   indexPattern=/index\.[\S]*/i;				// search for "index" + dot + non space chars, ignore case
   for(i=0;i<anchor.length;i++){
     if(anchor[i].href){
       noIndexURL=anchor[i].href.replace(indexPattern,'');	// blank "index.htm"
       if(anchor[i].href==myURL||noIndexURL==myURL){		// if anchor w or w/o index == this page 
         k=i;									// index of current page?	
         break;
       }
     }
   }
   if(k>-1){									// found index of current page
     parent=anchor[k].parentNode;					
     while(parent){								// set class of first children in this menu hier to mark
       if(parent.nodeName=="LI"){
         parent.firstChild.className="current"+" "+parent.firstChild.className;
       }
       parent=parent.parentNode;
//}
}}}
function mouseOver(a){ 
 var b,t;
 if (document.timeout) { clearTimeout(document.timeout); }
 document.menuOn=1;								// at least 1 tab of menu is in focus
 b=(a.submenu)?'pulldown(':'focus(';
 t='document.timeout=setTimeout("'+b+a.nbr+')",160)';
 eval (t);
}
// Hide the subordinate menus for "a" at the same depth and lower except for "a"s menu.
function focus(a){ 
 var i,tA,tU,parent;
 tA=anchor[a];								// anchor object 
 parent=tA.parentNode;					// parent of anchor is li
 while(parent){							// find ul menu above this anchor
   if(parent.tagName=="UL"){break;}	
   parent=parent.parentNode;
 }
 if(parent){															
   tU=parent.getElementsByTagName("UL");	// list of subordinate ul's 
   for(i=tU.length-1;i>-1;i--){			
     if(tA.submenu==tU[i]){continue;}  // skip current anchor's submenu
     else{hide(tU[i]);}				// hide other ul's
}}}
function pulldown(a){ 			
 var u,lv,oft,ofr,uw,uh,pp,aw,ah,adj,mR,mT,wW=0,wH,w1,w2,w3,sct,pw,lc,pwv,xx=0,yy=0,wP=true;
 var iem=(navigator.appVersion.indexOf("MSIE 5")>-1)?true:false,
     dce=document.documentElement,dby=document.body;
 document.menuOn=1;			// 1 or more tabs are in focus
 focus(a);
 u=anchor[a].submenu;		// list of ul's under this anchor 
 if(u.pulldown){return;}   // already displayed?
 u.pulldown=true;				// mark as displayed
 lv=(anchor[a].depth==1)?true:false;		// true if depth == 1, menu tab is top row
 anchor[a].className=anchor[a].className.replace("ready","active"); // 
 oft=-10;						// percent to offset sub tab above menu tab 
 ofr=20; 						// percent to offset sub tab to left of menu tab right edge
 uw=u.offsetWidth;			// 215
 uh=u.offsetHeight;			// 21 or 42
 pp=anchor[a];					
 aw=pp.offsetWidth;			// 215 or 98
 ah=pp.offsetHeight;			// 20
 while(pp){
   xx+=(pp.offsetLeft)?pp.offsetLeft:0;
   yy+=(pp.offsetTop)?pp.offsetTop:0;
   if(window.opera||navigator.userAgent.indexOf("Safari")>-1){
     if(anchor[a].depth!=1&&pp.nodeName=="BODY"){
       yy-=(pp.offsetTop)?pp.offsetTop:0;
     }
   }
   pp=pp.offsetParent;
 }
 if(iem&&navigator.userAgent.indexOf("Mac")>-1){
   yy+=parseInt(dby.currentStyle.marginTop);
 }
 adj=parseInt((aw*ofr)/100);
 mR=(lv)?0:aw-adj;
 adj=parseInt((ah*oft)/100);
 mT=(lv)?0:(ah-adj)*-1;
 w3=dby.parentNode.scrollLeft;
 if(!w3){w3=dby.scrollLeft;}
 w3=(w3)?w3:0;
 if(dce&&dce.clientWidth){wW=dce.clientWidth+w3;}
 else if(dby){wW=dby.clientWidth+w3;}
 if(!wW){
   wW=0;
   wP=false;
 }
 wH=window.innerHeight;
 if(!wH){
   wH=dce.clientHeight;
   if(!wH||wH<=0){wH=dby.clientHeight;}
 }
 sct=dby.parentNode.scrollTop;
 if(!sct){
   sct=dby.scrollTop;
   if(!sct){
     sct=window.scrollY?window.scrollY:0;
   }
 }
 pw=xx+mR+uw;
 if(pw>wW&&wP){
   mR=uw*-1;
   mR+=10;
   if(lv){
     mR=(wW-xx)-uw;
   }
 }
 lc=xx+mR;
 if(lc<0){mR=xx*-1;}
 pw=yy+uh+ah+mT-sct;
 pwv=wH-pw;
 if(pwv<0){
   mT+=pwv;
   if(uh>wH){
     mT=(yy+ah-sct)*-1;
   }
 }
 u.style.marginLeft=mR+'px';
 u.style.marginTop=mT+'px';
 u.className="nestedMenu";
 //debugger;
}
function mouseOut(evt){ 
 var parent,st,tS,m=true;
 evt=(evt)?evt:((event)?event:null);			// IE event object
 st=document.menuOn;
 if(st!=-1){
   if(evt){
     tS=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;
     if(tS){
       parent=tS.parentNode;
       while(parent){
         if(parent&&parent.id&&parent.id=="menu"){
           m=false;
           document.menuOn=1;
           break;
         }
         parent=parent.parentNode;
       }
     }
     if(m){
       document.menuOn=-1;
       if(document.timeout){clearTimeout(document.timeout);}
       document.timeout=setTimeout("hideAll()",360);
}}}}
function hideAll(){ 
 var i,tU,tUU;
 document.menuOn=-1;
 tU=document.getElementById('menu');
 if(tU){
   tUU=tU.getElementsByTagName("UL");
   if(tUU){
     for(i=tUU.length-1;i>-1;i--){
       hide(tUU[i]);
}}}}
// Hide a menu by setting ul class to ignore, and by changing the containing anchor class from active to waiting
function hide(u){ 
 var ua;
 u.pulldown=false;
 u.className="ignoreMenu";									// set class to hide
 ua=u.parentNode.firstChild;	// parent of ul is li, first child is an anchor
 ua.className=ua.className.replace("active","waiting");	// active -> waiting
}
