    ////////////////////////////////////////////////////////////////
    //  wrappers for the layers visibility-states
    ////////////////////////////////////////////////////////////////

    function tag_show() { if(document.layers) return "show"; return "visible"; }
    function tag_hide() { if(document.layers) return "hide"; return "hidden"; }

    ////////////////////////////////////////////////////////////////
    //  menu-panel constructor
    ////////////////////////////////////////////////////////////////

    function menuDiv(id,triggerID,triggerY,lArr) {

        this.id = id;
        this.triggerID = triggerID;
        this.triggerY = triggerY;
        this.lArr = lArr;
        this.hasChild = false;
        this.childArr = new Array();
        this.hover = new Array();
        this.isVis = true;
        this.y = menuY;
        this.x = menuX;

        for(i=0;i<lArr.length;i++)
            this.childArr[i] = -1;

        for(i=0;i<lArr.length;i++)
            this.hover[i] = false;

        if(triggerID!=-1) {
            for(i=0;i<menus.length;i++) {
                if(menus[i].id==triggerID) {
                    this.x = menus[i].x + menuDX;
                    this.y = menus[i].y + ( menuDY * triggerY ) ;
                    menus[i].hasChild = true;
                    menus[i].childArr[triggerY] = id;
                }
            }
        }
    }

    //////////////////////////////////////////////////////////////////
    //  show or hide a layer
    //////////////////////////////////////////////////////////////////

    function show(boo) {

        layerName = "layer" + this.id;

        if(document.all) {
            t1 = window.document.all[layerName].style;
            t2 = window.document.all["s"+layerName].style;
            t3 = window.document.all["h"+layerName].style;
        }
        else if(document.layers) {
            t1 = window.document.layers[layerName];
            t2 = window.document.layers["s"+layerName];
            t3 = window.document.layers["h"+layerName];
        }
        else {
            t1 = window.document.getElementById(layerName).style;
            t2 = window.document.getElementById("s"+layerName).style;
            t3 = window.document.getElementById("h"+layerName).style;
        }

        if(boo) { t1.visibility = t2.visibility = t3.visibility = tag_show(); }
        else { t1.visibility = t2.visibility = t3.visibility = tag_hide(); }

        if( boo ) this.isVis = true;
        else {
            this.isVis = false;
            for(a=0;a<this.lArr.length;a++)
                if( this.hover[a] )
                    img_off(this.id,a);
        }
    }

    menuDiv.prototype.show = show;

    //////////////////////////////////////////////////////////////////
    //  move a layer
    //////////////////////////////////////////////////////////////////

    function move() {

        layerName = "layer" + this.id;

        if(document.all) {
            t1 = window.document.all[layerName].style;
            t2 = window.document.all["s"+layerName].style;
            t3 = window.document.all["h"+layerName].style;
            t1.left = t2.left = t3.left = this.x;
            t1.top = t2.top = t3.top = this.y;
        }
        else if(document.layers) {
            t1 = window.document.layers[layerName];
            t2 = window.document.layers["s"+layerName];
            t3 = window.document.layers["h"+layerName];
            t1.moveTo(this.x,this.y); t2.moveTo(this.x,this.y); t3.moveTo(this.x,this.y);
        }
        else {
            t1 = window.document.getElementById(layerName).style;
            t2 = window.document.getElementById("s"+layerName).style;
            t3 = window.document.getElementById("h"+layerName).style;
            t1.left = t2.left = t3.left = this.x;
            t1.top = t2.top = t3.top = this.y;
        }
    }

    menuDiv.prototype.move = move;

    ////////////////////////////////////////////////////
    //  get HTML-string for a menu-panel
    ////////////////////////////////////////////////////

    function getHTML() {

        pTxt = 's'+'tyle="LEFT:-1000px; TOP:-1000px; POSITION:absolute; Z-INDEX:81';
        tTxt = '<ta'+'ble cellpadding=0 cellspacing=0 border=0';

        my =  parseInt( this.lArr.length * menuDY );
        my2 = parseInt( menuDY / 2 );

        t  = '<di'+'v id="hlayer'+this.id+'"  '+pTxt+'1; ';
        t += 'clip:rect(0px '+(menuDX+(my2))+'px '+((this.lArr.length+1)*menuDY)+'px 0px); ';
        t += 'WIDTH:'+menuDX+'px; HEIGHT:'+(my)+'px;">';
        t += tTxt+' width='+menuDX+' height='+(my)+'>';

        for(a=0;a<this.lArr.length;a++) {
            if( a == 0 ) {
                t += '<tr><td colspan=2 rowspan=2 height='+(menuDY)+'>';
                t += '<img src="'+menuIoff.src+'" width='+menuDX+' height='+menuDY+' name="im'+this.id+'y'+a+'x"></td>';
                t += '<td><img src="'+menuIs.src+'" width=1 height='+(my2)+'></td></tr>';
                t += '<tr><td background="'+menuIsh.src+'"><img src="'+menuIs.src+'" ';
                t += 'width='+(my2)+' height='+(my2)+'></td></tr>';
            }
            else {
                t += '<tr><td colspan=2 height='+(menuDY)+'>';
                t += '<img src="'+menuIoff.src+'" width='+menuDX+' height='+menuDY+' name="im'+this.id+'y'+a+'x"></td>';
                t += '<td background="'+menuIsh.src+'">';
                t += '<img src="'+menuIs.src+'" width='+(my2)+' height='+menuDY+'></td></tr>';
            }
        }	

        t += '<tr><td><img src="'+menuIs.src+'" width='+(my2)+' height=1></td>';
        t += '<td background="'+menuIsh.src+'"><img src="'+menuIs.src+'" ';
        t += 'width='+(menuDX-(my2))+' height='+(my2)+'></td>';
        t += '<td background="'+menuIsh.src+'">';
        t += '<img src="'+menuIs.src+'" width=1 height='+(my2)+'></td></tr>';

        t += '</ta'+'ble></d'+'iv>';

        t += '<di'+'v id="layer'+this.id+'"  '+pTxt+'2; ';
        t += 'clip:rect(0px '+menuDX+'px '+(my)+'px 0px); WIDTH:'+menuDX+'px; HEIGHT:'+(my)+'px;">';
        t += tTxt+' width='+menuDX+' height='+(my)+'>';

        for(a=0;a<this.lArr.length;a++) {
            t += '<tr><td height='+menuDY+' valign="middle">';
            t += '<img src="'+menuIs.src+'" width=4 height=1><span style="font-size: 8pt; font-family: helvetica,arial,sans-serif; font-weight: bold;">';

            if(this.lArr[a].indexOf("|")!=-1)
                t += this.lArr[a].substring(0,this.lArr[a].indexOf("|"));
            else
                t += this.lArr[a];

            t += '</span></td><td  valign="middle" align="right">';

            if((this.hasChild)&&(this.childArr[a]!=-1))
                t += '<img src="'+menuIch.src+'">';
            else
                t += '<img src="'+menuIs.src+'" width=1 height=1 border=0>';

            t += '</td></tr>';
        }

        t += '</ta'+'ble></d'+'iv>';

        t += '<di'+'v id="slayer'+this.id+'"  '+pTxt+'3; ';
        t += 'clip:rect(0px '+menuDX+'px '+(my)+'px 0px); WIDTH:'+menuDX+'px; HEIGHT:'+(my)+'px;">';
        t += tTxt+' width='+menuDX+' height='+(my)+'>';

        for(a=0;a<this.lArr.length;a++) {
            t += '<tr><td height='+menuDY+'><a href="#" onClick="menu_open('+this.id+','+a+');return false;" ';
            t += ' onmouseover="return do_trigger('+this.id+','+a+')"';
            t += ' onmouseout="return no_trigger('+this.id+','+a+')" onfocus="blur()">';
            t += '<img src="'+menuIs.src+'" width='+menuDX+' height='+menuDY+' border=0></a></td></tr>';
        }

        t += '</ta'+'ble></di'+'v>';

        return t;
    }

    menuDiv.prototype.getHTML = getHTML;

    ////////////////////////////////////////////////////
    //  functions for image-swaps
    ////////////////////////////////////////////////////

    function img_on(id,y) {
        if( ! menus[id].hover[y] ) {
            set_img(id,y,menuIon.src);
            menus[id].hover[y] = true;
            window.status = menus[id].lArr[y].substring(0,menus[id].lArr[y].indexOf("|"));
        }
    }

    function img_off(id,y) {
        if( menus[id].hover[y] ) {
            set_img(id,y,menuIoff.src);
            menus[id].hover[y] = false;
            window.status = "";
        }
    }
	
	///////////////////////////////////////////////////////
	// adjusted for konqueror
	// still pretty BETA...
	// thanx to the KDE-dudes for their great support !
	// love you guys... linux forever !
	///////////////////////////////////////////////////////
		
	function set_img(id,y,isrc) {
        ln = "hlayer"+id;
        im = "im"+id+"y"+y+"x";

		if( typeof( ActiveXObject ) != "undefined" ) {
			if( document.all ) dimg = document.all[ln].document.images[im];
			else if( window.document.getElementById ) {
                dl = window.document.getElementById(ln);
                for(i=0;i<dl.getElementsByTagName('img').length;i++)
                        if( dl.getElementsByTagName('img')[i].name == im ) {
                                dimg = dl.getElementsByTagName('img')[i];
								break;
						}
        	}
			else if( document.layers ) dimg = document.layers[ln].document.images[im];
		}
		else {
      		if( window.document.getElementById ) {
	                dl = window.document.getElementById(ln);
                	for(i=0;i<dl.getElementsByTagName('img').length;i++)
	                        if( dl.getElementsByTagName('img')[i].name == im ) {
                                	dimg = dl.getElementsByTagName('img')[i];
									break;
							}
        	}
			else if( document.all ) dimg = document.all[ln].document.images[im];
        	else if( document.layers ) dimg = document.layers[ln].document.images[im];
		}
        if ( (dimg) && (dimg.src!=isrc) ) {  dimg.src = isrc; }
    }

    //////////////////////////////////////////////////////////////
    //  mouse-over handler
    //////////////////////////////////////////////////////////////

    function do_trigger(id,y) {

        onPanel = true;

        for(i=0;i<menus[id].lArr.length;i++)
            if( menus[id].hover[i] )
                img_off(id,i);

        img_on(id,y);

        for(i=0;i<menus.length;i++) {
            if(i!=id) {
                if((menus[i].x>=menus[id].x) && (menus[i].isVis) )
                    menus[i].show(false);

                if((menus[i].triggerY==y)&&(menus[i].triggerID==id))
                    menus[i].show(true);
            }
        }

        return true;
    }

    //////////////////////////////////////////////////////////////
    //  mouse-out handler
    //////////////////////////////////////////////////////////////

    function no_trigger(id,y) {

        onPanel = false;

        if( menus[id].hasChild )
            if ( menus[id].childArr[y]!=-1)
                if( menus[menus[id].childArr[y]].isVis ) {
                    set_img(id,y,menuIin.src);
                    menus[id].hover[y] = true;
                    return;
                }

        if( menus[id].hover[y] )
            img_off(id,y);

        return true;
    }

    ////////////////////////////////////////////////////////////////
    //  resize-fix for netscape 4
    ////////////////////////////////////////////////////////////////

    function netscape_resize() {
        if( ! (document.layers["layer0"]) ) return true;
        cx = document.layers["layer0"].document.width;
        cy = document.layers["layer0"].document.height;
        if (cx != start_width || cy != start_height) {
            whailer = "reloading page ( fix for ne4 layer-resize()-bug )...";
            java.lang.System.out.print(whailer);
            location.reload();
            java.lang.System.out.println(" done.");
        }
    }

    if (document.layers) onresize = netscape_resize;

    ////////////////////////////////////////////////////////////////
    //  resize-fix for opera
    ////////////////////////////////////////////////////////////////

    function opera_resize() {
        if( ( start_width != window.innerWidth ) || ( start_height != window.innerHeight ) )
            location.reload();
        setTimeout("opera_resize()",1000);
    }

    /////////////////////////////////////////////////////
    //  handler for mouse-clicks
    /////////////////////////////////////////////////////

    function check_click(evt) { 
		if( ! onPanel ) {
			close_menus();
		} 
	}
	
    function check_click() { 
		if( ! onPanel ) {
			close_menus();
		} 
	}

    if (document.layers) 
		document.captureEvents(Event.MOUSEDOWN);

    document.onmousedown = check_click;

    if(document.addEventListener) {
		document.addEventListener("mousedown",check_click,true);
	}


    /////////////////////////////////////////////////////
    //  menu-control functions
    /////////////////////////////////////////////////////

    function menu_open( id , a ) {
        url = menus[id].lArr[a].substring(menus[id].lArr[a].indexOf("|")+1,menus[id].lArr[a].length);
		if( url.indexOf("index.htm") != -1 ) {
			window.top.location.href = url;
		}
		else if( url.indexOf("http://") != -1 ) {
			window.open(url);
		}
		else 
			window.self.location.href = url;
    }

    function show_root_menu() {
        if( ! menus[0].isVis )
            menus[0].show(true);
    }

    function close_menus() {
        for(i=0;i<menus.length;i++)
			if( menus[i].isVis )
				menus[i].show(false);
    }

    function prep_menus() {
        for(i=0;i<menus.length;i++) {
            if( menus[i].isVis )
				menus[i].show(false);
            menus[i].move();
        }
    }
