var ElementLink = Class.create();
ElementLink.prototype = {
  initialize: function(element) {
    this.element = $(element);
    this.element.observe('mouseover', this.mouseover.bind(this));
    this.element.observe('mouseout', this.mouseout.bind(this));
    this.element.observe('click', this.click.bind(this));
    this.element.setStyle({cursor: 'pointer'});
    this.location = element.readAttribute('href');
    this.element.elementLinkObj = this;
  },
  mouseover: function() {
    window.status = this.location;
    this.element.addClassName('hover')
  },
  mouseout: function() {
    window.status = '';
    this.element.removeClassName('hover')
  },
  click: function() {
    window.location.href = this.location;
  }
};
function setupElementLinks(parent) {
  var linked_elements = new Selector('*[href]').findElements($(parent));
  linked_elements.each(function(element) {
    if (element.tagName != 'A' && !element.elementLinkObj)
      new ElementLink(element);
  });
}
Event.observe(window, 'load', setupElementLinks.curry(document));
