function fixEvent(e) {
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
}

   
function Menu(p_menuId, p_menuDivId ) {   
   this.started;    
   this.divObject;
   
   this.menuId = p_menuId;
   this.menuDivId = p_menuDivId;
}


Menu.prototype.init  = function() {
    this.started = false;    
    this.divObject =  getElement(this.menuDivId);    
}   

Menu.prototype.show  = function() {


    this.divObject.style.display = 'block';
}

Menu.prototype.close  = function() {
    this.divObject.style.display = 'none';
}


Menu.prototype.toString = function() {
    return ""+this.divObject.id;
}


Menu.prototype.bind  = function( p_elementId, p_command ) {
  var o = getElement( p_elementId );   
  
  setCustomProperty( o, 'menu', this);
  
  if(typeof p_command == 'function' ) {
  	o.onclick = p_command; 
  }
  else {
  	o.onclick = function(p_Param) { 
  	  e = fixEvent(p_Param);
  	  eval( "getCustomProperty( this, 'menu')."+p_command+"(e);") 
  	}; 
  } 
}

Menu.prototype.binds  = function() {
  command = arguments[arguments.length-1];
  for( i = 0; i < arguments.length -1; i++  ) { 
     this.bind( arguments[i], command );     
  }
}

Menu.prototype.getTarget  = function(event) {
    var t = document.all ? window.event.srcElement : e.target;
    
    return t;    
}  





var ARROW_LEFT = 1;
var ARROW_UP = 2;
var ARROW_RIGHT = 4;
var ARROW_DOWN = 8;

