      
function MMenu(  )  {
   this.timer_id = 0;
   this.current = 0;
   this.config = new MMenu.Config();
  }; 
      
MMenu.prototype.Setup = function () {
   document.getElementById(this.config.mainlayer).style.left=document.getElementById(this.config.maintable).offsetLeft+this.config.offset_left;
   document.getElementById(this.config.mainlayer).style.top=document.getElementById(this.config.maintable).offsetTop+this.config.offset_top;
  };
      
MMenu.Config = function () {
   this.mainlayer="mainlayer";
   this.maintable="maintable";
   this.offset_left=0;
   this.offset_top=0;
   this.layers = new Array();
  };
      
MMenu.prototype.set_menu_layer = function( layer_name, layer_left ) { 
   this.config.layers[""+layer_name+""] = new Array();
   this.config.layers[""+layer_name+""].left=layer_left;
  };
      
MMenu.prototype.set_config = function ( variable, value ) { this.config[""+variable+""]=value ; };
      
MMenu.prototype.get_config = function ( variable ) { return this.config[""+variable+""]; };
      
MMenu.prototype.show = function ( layer_showing ) { 
   this.hide_all(); this.hide_show_forms('hide'); this.Setup();
   for( layer_name in this.config.layers) { document.getElementById( layer_name ).style.left=this.config.layers[layer_name].left; }
   if (this.current!=0) {  // setTimeout("hideone()", 1000); 
     // здесь нужна проверка времению ... по истечении которого прятать слой 
     document.getElementById(this.current).style.display="none"; 
    }
   if (this.current !=0 && this.current != layer_showing )  { this.hide_all();  }
   document.getElementById( layer_showing ).style.display=""; 
   this.current=layer_showing ;
  };
      
MMenu.prototype.hide_all = function ( ) { 
   this.current=0; this.hide_show_forms('show');
   for( layer_name in this.config.layers) { document.getElementById( layer_name ).style.display="none";  }
  };
      
MMenu.prototype.hide_elementD  = function ( elementD )  {  elementD.style.visibility='hidden';  };
MMenu.prototype.show_elementD = function ( elementD )  { elementD.style.visibility='';   };
      
MMenu.prototype.hide_show_forms = function (action) {
    var F=document.forms; 
    if ( this.config.use_hide_form == 1 && navigator.userAgent.indexOf("MSIE")!=-1 )  {
    for (i=0; i<F.length; i++) { elemF= document.forms[i].elements; 
      for (j=0;j<elemF.length; j++ )  {  item_type = elemF[j].type.toString().substring(0,6); 
         if(item_type =="select" ) {
                    if (action=='hide' )  {  this.hide_elementD( elemF[j] );  }
            else if (action=='show' ) {  this.show_elementD( elemF[j] ); } 
          }
        }
      }
    }
   // var elemObj =  document.body.getElementsByTagName('object'); // for (i=0; i<elemObj.length; i++) { }
  }; 

