/*

  CSS MENU v1.0beta (c) 2001-2003 Angus Turnbull. All Rights Reserved.
  Visit http://www.twinhelix.com for licensing info and more scripts!

*/

var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isDyn=isDOM||isIE||isNS4;
function getRef(id,par)
{
par=!par?document:(par.navigator?par.document:par);
return isIE?par.all[id]:
(isDOM?(par.getElementById?par:par.ownerDocument).getElementById(id):
(isNS4?par.layers[id]:null));
}
function getSty(id,par)
{
var r=getRef(id,par);
return r?(isNS4?r:r.style):null;
}
if(!window.LayerObj)var LayerObj=new Function('id','par',
'this.ref=getRef(id,par);this.sty=getSty(id,par);return this');
function getLyr(id,par){return new LayerObj(id,par)}
function LyrFn(fn,fc)
{
LayerObj.prototype[fn]=new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px";'+
'with(this){'+fc+'}');
}
LyrFn('x','if(!isNaN(p))sty.left=p+px;else return parseInt(sty.left)');
LyrFn('y','if(!isNaN(p))sty.top=p+px;else return parseInt(sty.top)');
LyrFn('vis','sty.visibility=p');
function CSSMenu(myName)
{
this.myName=myName;
this.menus=new Array();
this.visMenus=new Array();
this.hideDelay=500;
}
CSSMenu.prototype.show=function(mN,parMN,offR,offX,offY){
if(offX==0 && offY==0) {
offX=(isNS4?offR.document.width:offR.offsetWidth);
offY=-(isNS4?offR.document.height:offR.offsetHeight);
}
with(this)
{
for(var m in visMenus)visMenus[m]=false;
if(mN)
{
var mR=menus[mN];
if(!mR||!mR.lyr)
{
mR=menus[mN]=new Object();
mR.lyr=getLyr(myName+'_'+mN);
mR.childMN=mR.parMN='';
mR.hideTimer=null;
if(!mR.lyr.ref){mR.lyr=null;return true}
mR.lyr.ref.onmouseover=new Function(myName+'.show("'+mN+'","'+parMN+'")');
mR.lyr.ref.onmouseout=new Function(myName+'.hide("'+mN+'")');
}
mR.parMN=parMN;
if(parMN)menus[parMN].childMN=mN;
var m=mN;
while(m)
{
visMenus[m]=true;
if(menus[m])clearTimeout(menus[m].hideTimer);
m=menus[m].parMN;
}
var lX=0,lY=0,wx=0,wy=0;
if(offR&&isNS4)
{
lX=offR.x+(mR.parMN?menus[mR.parMN].lyr.x():0);
lY=offR.y+(mR.parMN?menus[mR.parMN].lyr.y():0);
}
else while(offR){lX+=offR.offsetLeft;lY+=offR.offsetTop;offR=offR.offsetParent}
if(mR.lyr)with(mR.lyr)
{
if(lX&&lY){x(lX+offX);y(lY+offY)}
vis('visible');
}
}
for(var m in menus)if(!visMenus[m]&&m!=menus[mN].childMN)with(menus[m])
{
clearTimeout(hideTimer);
hide(m,true);
}
return true;
}}
CSSMenu.prototype.hide=function(mN,doHide){with(this)with(menus[mN])
{
if(!doHide)
{
clearTimeout(hideTimer);
hideTimer=setTimeout(myName+'.hide("'+mN+'",true)',hideDelay);
if(parMN)this.hide(parMN);
}
else
{
if(isNS4&&window.isMouseIn&&isMouseIn(lyr.sty))return true;
if(parMN)with(menus[parMN])if(childMN==mN)childMN='';
if(lyr)lyr.vis('hidden');
}
}}
if(isNS4)
{
var csmMouseX,csmMouseY,csmOR=window.onresize,nsWinW=innerWidth,nsWinH=innerHeight;
document.csmMM=document.onmousemove;
window.onresize=function()
{
if(csmOR)csmOR();
if(nsWinW!=innerWidth||nsWinH!=innerHeight)location.reload();
}
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=function(evt)
{
csmMouseX=evt.pageX;
csmMouseY=evt.pageY;
return document.csmMM?document.csmMM(evt):document.routeEvent(evt);
}
function isMouseIn(sty)
{
with(sty)return((csmMouseX>left)&&(csmMouseX<left+clip.width)&&
(csmMouseY>top)&&(csmMouseY<top+clip.height));
}
}