//class that represents all drop down menues
var pane;
    function findTarget(shoter){
//alert(pane[0][shoter.id]);
        if(pane[0][shoter.id]+""!="undefined") return document.all[pane[0][shoter.id]];
//alert("shoter");
        if(pane[1][shoter.id]+""!="undefined") return shoter;
//alert("mayBeBody");
        if(shoter==document.body) return null;
//alert(shoter.parentElement.id);
        shoter=shoter.parentElement;
        return findTarget(shoter);
    }

function DropDownMenuBar(){
    
    pane=new Array();
    pane[0]=new Array();
    pane[1]=new Array();
    pane[2]=new Array();

    this.add=function(but, lay){

        
        if(!document.all) return true;
        if(!document.all[but] || !document.all[lay]) return true;

        pane[0][but]=lay;
        pane[1][lay]=but;

        document.all[but].onmouseover=this.showPanel;
        document.all[but].onmouseout=this.hidePanel;

        document.all[lay].style.visibility='hidden';
        document.all[lay].onmouseover=document.all[but].onmouseover;
        document.all[lay].onmouseout =document.all[but].onmouseout;
    };

    this.showPanel=function(e){

        if(!document.all) return true;
        
        var X;
        var Y;
        var shoter=event.srcElement;

        var target=findTarget(shoter); if(target == null) return true;

//alert(target.id+" "+shoter.id);
        X=event.clientX + document.body.scrollLeft-event.offsetX-2;
        Y=event.clientY + document.body.scrollTop -event.offsetY+shoter.height/3*2; 

        if(pane[1][target.id] && pane[0][shoter.id]){
            target.style.left=X;
            target.style.top=Y;
        }

        target.style.visibility='visible';
    };
    
    this.hidePanel=function(e){
        if(!document.all) return true;

        var shoter=event.srcElement;
        var target=findTarget(shoter); if(target == null) return true;
//alert(target.id);
        
        target.style.visibility='hidden';
    };

/*    this.hideDelay=function(e){
          window.setTimeout("ddm.hidePanel();",500);

    };*/
}

var ddtm = new DropDownMenuBar();

////debugg
//    var ddm;
/*function ddmf(){
    alert('load');
    
    ddm=new DropDownMenuBar();
    
    ddm.add('i1','l1');
    ddm.add('i2','l2');
//    return true;
} */

//alert('connected');