var Map = new Class({
  initialize: function(map){
    this.map = $(map);
    if (!this.map) return;
    
    this.overlayContainer = $('location_overlays');
    this.setHovers(this.map.getElements('area'));
  },
  
  setHovers: function(elements){
    elements.each(function(el){
      el.addEvent('mouseover', function(){
        // create the image element
        var img = $(html.IMG({src:this.getAttribute('thumb'), 'class':'thumb'}));
        var coords = this.getAttribute('coords').match(/([0-9]+),([0-9]+),([0-9]+),([0-9]+)/);
        var top = coords[2];
        var right = coords[3];
        img.setStyle('position', 'absolute');
        img.setStyle('z-index', 500)
        img.setStyle('top', top + 'px');
        img.setStyle('left', right + 'px');
        $('location_overlays').appendChild(img);
      });
      el.addEvent('mouseout', function(){
        var img = $('location_overlays').getElement('img.thumb');
        $('location_overlays').removeChild(img);
      })
    })
  }
})