(function() {
// short hands
var $B = YAHOO.CMS.Bubble,
    $L = YAHOO.lang,
    $E = YAHOO.util.Event,
    $C = YAHOO.util.Connect;

  YAHOO.CMS.widget.Tips.config ({
        close: false,
        opacity: 1
  });

  // customizing the tooltips for ajax requesting process
  YAHOO.CMS.widget.Tips.onCompile = function ( el, o ) {
    var id = el.getAttribute('id'), obj = this;
    if ($L.isString(id) && (id !== '')) {
        // the anchor have an id defined, we must send the ajax request
        if ($L.isObject(this.handle)) {
            $C.abort(this.handle);
        }
        var callback = {
            success: function(o) {
                // process the response here...
                obj.body = o.responseText;
                // if the tip was already render, set the body directly
                if ($L.isObject(obj.handleOverlay)) {
                  obj.handleOverlay.setBody (o.responseText);
                }
            },
            failure: function(o) {
            }
        };
        var uri = 'tooltip.php?p='+id;
        if (this.handle = $C.asyncRequest('GET', uri, callback)) {
          this.body = 'Loading, please wait...';
          return true;
        }
    }
    return false;
  };
})();


