var ToolTipWidget = new Class({
  initialize: function(trigger_tag,tip_tag) {
    this.trigger_tag = trigger_tag;
    this.tip_tag = tip_tag;

    this.fx = new Fx.Styles(tip_tag, {duration:200, wait:false});
    this.trigger_tag.addEvent("mouseover", this.show.bind(this));
    this.trigger_tag.addEvent("mouseout", this.hide.bind(this));
  },

  show: function() {
    this.tip_tag.style.top = this.trigger_tag.offsetHeight+"px";
    this.tip_tag.style.opacity= 0;
    this.tip_tag.style.display = '';
    this.fx.start({'opacity': '1'});
  },

  hide: function() {
    /*this.tip_tag.fade(0);//style.display = 'none';*/
    this.fx.start({'opacity': '0'});
  }
});

window.addEvent("domready", function()
  {
  $$(".tooltip").each(
    function(info_tag)
      {
      trigger_tag=info_tag.getElement(".tooltip_trigger");
      tip_tag=info_tag.getElement(".tip");
      if (trigger_tag && tip_tag) new ToolTipWidget(trigger_tag,tip_tag);
      })
  })
