/**
 * This fixes the "flicker" of the location details popup by adding 
 * show/hide event handlers on the popup itself, not just the map areas.
 * @author Ben Barber <bbarber@i2rd.com>
 * @requires i2rd-util.js
 */ 
/* Register the locations when the page loads */ 
i2rd.addEvent(window, "load", function(){
  registerPopup("popup_mi");
  registerPopup("popup_ne");
  registerPopup("popup_in");  
  registerPopup("nebraska_iowa_image");
  registerPopup("kansas_missouri_image");
  registerPopup("great_lakes_image");
  registerPopup("illinois_image");
  registerPopup("minnesota_wisconsin_image");
});

/* add show/hide event handlers on the element matching the passed id */
function registerPopup(_id){
  var el=document.getElementById(_id);
  if (el){
    function showEl(){this.style.display="block";}
    function hideEl(){this.style.display="none";}
    i2rd.addEvent(el,"mouseover",i2rd.bind(showEl,el));
    i2rd.addEvent(el,"mouseout",i2rd.bind(hideEl,el));
  }
}
