	var mTime;

function checkBrowser(){
        this.ver=navigator.appVersion
        this.dom=document.getElementById?1:0
        this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
        this.ie4=(document.all && !this.dom)?1:0;
        this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
        this.ns4=(document.layers && !this.dom)?1:0;
        //added
        this.ie4mac=this.ie4 && navigator.userAgent.indexOf("Mac")>-1
        this.ie5mac=this.ie5 && navigator.userAgent.indexOf("Mac")>-1
        this.ie55=(this.ver.indexOf("MSIE 5.5")>-1 && this.dom)?1:0; 
        this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie5mac)
        return this
}
bw=new checkBrowser()

//Do you want it to move with the page if the user scroll the page?
var moveOnScroll=false

numberOfMenus=18//How many menus do you have

//Do you want to hide all the other submenus when you click a new?
var hideAll=true

//How much from top do you want the menu?
fromTop=0

/********************************************************************************
Object constructor
********************************************************************************/
function makeMenuBar(obj,nest,vis){
    nest=(!nest) ? '':'document.'+nest+'.'
        this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;         
        this.hideIt=b_hideIt;   this.showIt=b_showIt                                    
        if((bw.dom || bw.ie4) && vis) this.css.visibility='hidden'
        this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;            
        this.go=0
        this.height=bw.ns4?this.css.document.height:this.evnt.offsetHeight
        this.top=b_gettop
    this.obj = obj + "Object";  eval(this.obj + "=this")        
}
//Get's the top position.
function b_gettop(){
        var gleft=(n) ? eval(this.css.top):eval(this.css.pixelTop);
        return gleft;
}
//The functions for showing and hiding
function b_showIt(){
        this.css.visibility="visible"
}
function b_hideIt(){
        this.css.visibility="hidden"
}
/********************************************************************************
Checking if the page is scrolled, if it is move the menu after
********************************************************************************/
function checkScrolled(){
        if(!oMenu.go)oMenu.css.top=eval(scrolled)+fromTop
        if(bw.ns4) setTimeout('checkScrolled()',30)
}
/********************************************************************************
Inits the page, makes the menu object, moves it to the right place, 
show it..
********************************************************************************/
function menuBarInit(){
        oSub=new Array()
        oTop=new Array()
        for(i=0;i<numberOfMenus;i++){
                oTop[i]=new makeMenuBar('divTop'+i,'divBg')
                oSub[i]=new makeMenuBar('divSub'+i,'divBg.document.divTop'+i,1)
                oSub[i].evnt.onmouseout=evOut;
        }
        //Moving menuBar
        oMenu=new makeMenuBar('divBg')
        scrolled=bw.ns4?"window.pageYOffset":bw.ns5?"0":"document.body.scrollTop"
        oMenu.css.top=eval(scrolled)+fromTop
        oMenu.css.visibility='visible'
        if(moveOnScroll) bw.dom || bw.ie4?window.onscroll=checkScrolled:checkScrolled();

}

/********************************************************************************
Shows and hides the submenus
********************************************************************************/

function evOut(){
 //       if(bw.ie4 || bw.dom)this.style.visibility='hidden'
  //      else if(bw.ns4) this.visibility='visible'
}
//Canceling event bubbling in ie
function ieShow(num){
        if(bw.ie4 || bw.dom){
                oSub[num].showIt()
                window.event.cancelBubble=true
        }
}
function extract(num,parent){
        if(hideAll){
                for(i=0;i<oSub.length;i++){
                        if((num!=i)&&(parent!=i)) oSub[i].hideIt()
                }
        }
        if (num !=0){
	        oSub[num].showIt();
	}
	mClear();
	mBlur2();
}
function mBlur() {
	mClear();
	mTime = setTimeout('extract(0,-1);', 500);
}
function mBlur2() {
	mClear();
	mTime = setTimeout('extract(0,-1);', 2000);
}

function mClear(){
	clearTimeout(mTime);
}

onload=menuBarInit;
