require.def("domplate/toolTip",["domplate/domplate","core/lib","core/trace"],function(Domplate,Lib,Trace){with(Domplate){var mouseEvents="mousemove mouseover mousedown click mouseout",currentToolTip=null;function ToolTip(){this.element=null}ToolTip.prototype=domplate({tag:DIV({"class":"toolTip"},DIV()),show:function(a,b){currentToolTip&¤tToolTip.hide(),this.target=a,this.addListeners();var c=Lib.getBody(document);this.element=this.tag.append({options:b},c,this);var d=Lib.getElementBox(this.target);this.element.style.top=d.top+d.height+"px",this.element.style.left=d.left+d.width+"px",this.element.style.display="block",currentToolTip=this;return this.element},hide:function(){this.element&&(this.removeListeners(),this.element.parentNode.removeChild(this.element),currentToolTip=this.element=null)},addListeners:function(){this.onMouseEvent=Lib.bind(this.onMouseEvent,this),$(document).bind(mouseEvents,this.onMouseEvent,!0)},removeListeners:function(){$(document).unbind(mouseEvents,this.onMouseEvent,this,!0)},onMouseEvent:function(a){var b=Lib.fixEvent(a),c=Lib.getAncestorByClass(b.target,"toolTip");if(!c){var d=a.clientX,e=a.clientY,f=Lib.getElementBox(this.element);a.type!="click"&&a.type!="mousedown"&&(f=Lib.inflateRect(f,10,10));if(Lib.pointInRect(f,d,e)){Lib.cancelEvent(b);return}if(Lib.isAncestor(b.target,this.target)){Lib.cancelEvent(b);return}this.hide(),Lib.cancelEvent(b)}}});return ToolTip}})