/** Animated TreeMenu script by Garrett Smith
*
*  email:admin@dhtmlkitchen.com
*
*  Usage: see http://dhtmlkitchen.com/
*  Last Modified [12/12/02]
*/
TreeParams = {
        OPEN_MULTIPLE_MENUS    : false,
        OPEN_WHILE_CLOSING     : true,
        TIME_DELAY             : 40
  };

function toggleMenu(el)
{
if(Browser.id.OP5||Browser.id.NS4) return;
var l=Btn.gL(el);
if(l.isDp)
{
if(TreeParams.OPEN_MULTIPLE_MENUS||l.m.ct.aM==l.m){l.m.cS();l.m.ct.aM=null;
}
}
else
{
if(TreeParams.OPEN_MULTIPLE_MENUS||l.m.ct.aM==null )
{
l.m.oS();
l.m.ct.aM=l.m;
}
else
{
l.m.ct.aM.cS();
if(!TreeParams.OPEN_WHILE_CLOSING)
{
if(l.m.ct.aM!=l.m)
l.m.ct.aM.mic=l.m;
else
{
l.m.mic=null;l.m.oS();
}
}
else
{l.m.oS();
l.m.ct.aM=l.m;
}
}
}
}


function activateMenu(id)
{
if(!window.toggleMenu||Browser.id.OP5)
return;
var b=document.getElementById(id);
if(!b) return;
var parentMenuEl=findAncestorWithClass(b,"menu");
if(parentMenuEl!=null)
{
var bId=parentMenuEl.id.replace(/Menu$/,"");
window.alert(bId);
activateMenu(bId);
}
var l=Btn.gL(getElementsWithClass(b,"*","buttonlabel")[0]);
if(!l.isDp){toggleMenu(l.el);
l.isDp=true;
}
}

function buttonOver(el){
window.status=el.parentNode.id;
l=Btn.gL(el);
if(hasToken(l.el.className,"labelHover"))
return;
l.el.className+=" labelHover";
}

function buttonOff(l){
window.status=window.defaultStatus;removeClass(l,"labelHover");
}
if(typeof document.getElementsByTagName=="undefined"||Browser.id.OP5)
buttonOver=buttonOff=function(){};
Btn=function(el,cat){
this.el=el;
this.cat=cat;
this.m=new Mnu(document.getElementById(this.cat+"Menu"),this);
var ics=el.getElementsByTagName("img");
this.ic=(ics.length>0)?ics[0]:null;
this.isIc=false;
if(el.tagName.toLowerCase()=="img")
{
this.isIc=true;this.ic=el;}this.isDp=false;
};
Btn.gL=function(el){var bEl=findAncestorWithClass(el,"button");
for(var m in Mns)
if(Mns[bEl.id]!=null)
return Mns[bEl.id].ob;
return new Btn(el,bEl.id);
};
//
adcat =""
Btn.prototype.sdl=function(){if(this.isIc)
return void(this.ic.src = "../images/nav_" + [(this.cat)] + "_btn.gif");
removeClass(this.el,"labelHover");
removeClass(this.el,"labelDown");
if(this.ic!=null)
this.ic.src= "../images/nav_" + [(this.cat)] + "_btn.gif";
};
//
Mnu=function(el,l){this.ob=l;

this.id=l.cat;
this.el=el;
this.its=getChildNodesWithClass(el,"menuNode");
this.its.unshift(el);
this.all=getElementsWithClass(el,"*","menuNode");
this.all.unshift(el);
this.cur=0;this._r=null;
this.ct=this.getC();
this.aM=null;
this.mic=null;
Mns[this.id]=this;
};
Mns={};
Mnu.prototype={oS:function(){if(this.isO) return;
if(this.ob.ic!=null)
this.ob.ic.src= "../images/nav_" + [(this.id)] + "_btn_on.gif";
if(this.isC)
{
this.cE();
if(this.itc)
{
this.ito=this.itc.reverse();
this.cur=this.itc.length-this.cur;
}
}
else
{
this.cur=0;
this.ito=new Array();
if(this.itc)
this.ito=this.itc.reverse();
else
this.ito=this.its;if(!this.ob.isIc)
this.ob.el.className+=" labelDown";
}
this.isC=false;
this.isO=true;
if(this.ito[0]!=this.el)
this.ito.reverse();
this.pat=setInterval("Mns."+this.id+".o()",TreeParams.TIME_DELAY);
this.ob.isDp=true;
}
,cS:
function(){if(this.isC) return;
if(this.isO){this.oE();
}
else
{
this.isO=false;
this.cur=0;
this.itc=new Array();
for(var i=this.all.length-1,n=0;i>0;i--)
if(this.all[i].style.display=="block")
this.itc[n++]=this.all[i];
}this.itc[this.itc.length]=this.el;
this.pat=setInterval("Mns."+this.id+".c()",TreeParams.TIME_DELAY);
this.isC=true;
this.ob.isDp=false;
}
,o:
function(){this.ito[this.cur].style.display="block";
if(++this.cur==this.ito.length)
this.oE();},c:function(){this.itc[this.cur].style.display="none";
if(++this.cur>=this.itc.length)
this.cE();},oE:function(){clearInterval(this.pat);
this.isO=false;
this.itc=this.ito.reverse();this.cur=this.ito.length-this.cur;
if(!TreeParams.OPEN_MULTIPLE_MENUS&&this.ct.aM!=this)
this.cS();
this.ct.aM=this;
},cE:

function(){clearInterval(this.pat);
this.isC=false;
// 
if(this.cur>=this.itc.length)this.ob.sdl();
if(!TreeParams.OPEN_WHILE_CLOSING&&this.ct.aM&&this.ct.aM.mic!=null&&this.ct.aM.mic!=this)
{
this.ct.aM.mic.oS();if(this.mic)
this.ct.aM=this.mic;
}
else
{
}
this.mic=null;
// 
if(Browser.id.IE6)
setTimeout("repaintFix(document.getElementById('"+this.el.id+"'));",50);
},getC:function(){var p=findAncestorWithClass(this.el,"menu");if(p!=null)
return Mns[p.id.replace(/Menu$/,"")];
if(!this._r){var rt=findAncestorWithClass(this.el,"AnimTree");
if(!rt)
rt=document.body;if(!rt.id)
rt.id="AnimTree_"+Math.round(Math.random()*1E5);if(Trees[rt.id]!=null)
this._r=Trees[rt.id];else
this._r=new Tree(rt);return this._r;}}};Tree=function(el){this.el=el;
this.aM=null;this.id=el.id;Trees[this.id]=this;};Trees={};
if(document.getElementById&&!Browser.id.OP5&&!window.Tree_inited)
{
document.writeln("<style type='text/css'>","\n",".menu,.menuNode{display:none;}\n","","<"+"/style>");
window.Tree_inited=true;
}