title: attachEvent gives trouble
body: <p>I am trying to do drop down horizontal menu in javascript. It's works fine on Firefox and Chrome, however giving me troubles in IE.</p>
  
  <p>Here is the code i have </p>
  
  <pre><code>function init(){
  
      hideAllSubMenu();
  
      var menuItem = document.getElementById("menu_wrap").getElementsByTagName("div");
  
      for(var index = 0; index &lt; menuItem.length; index++)
      {
          // if firefox and all oother browsers
          if(typeof menuItem[index].addEventListener != "undefined")  
          {
              menuItem[index].addEventListener("mouseover", ShowListener, false);
              menuItem[index].addEventListener("click", ShowListener, false);
          }
          else //IE
          {
              menuItem[index].attachEvent("onclick", ShowListener);
              menuItem[index].attachEvent("onmouseover", ShowListener);
          }       
      }
  }
  
  
  function ShowListener(event)
  {
      hideAllSubMenu();
  
      var menuItemIdStr = this.id;
      var menuItemIdNum = menuItemIdStr.replace(/menu/i, "");
      var subMenu = document.getElementById("submenu_wrap" + menuItemIdNum);
  
      subMenu.style.left = this.offsetLeft + "px";
      subMenu.style.top = this.offsetTop + this.offsetHeight + 2 + "px";
      subMenu.style.display = "block";
  }
  </code></pre>
  
  <p>It's seems like its complaining about <strong>this</strong>.
  I understand that in IE event listener function is not copy but a reference, and thats why <strong>this</strong> giving me a problem.
  Is there a way around this problem ?</p>
  
  <p>I even tried to create separate function for attachEvent for IE and path there object directly, however it still complaining.</p>
  
  <p>Something like that </p>
  
  <pre><code>menuItem[index].attachEvent("onmouseover", ShowListenerIE(menuItem[index]));
  </code></pre>
  
  <p>Note: I do plan to rewrite this simple menu in feature to JQuery, but for now I am interested in learning JavaScript Core + DOM, and would like to find a way around this problem.</p>
  
  <p>Thanks in advance.</p>