jQuery.fn.tip=function(){this.click(function(){D(this);return false});function B(){return C++}function E(G,F){$(G).parent().remove();F.removeClass("opened")}function D(T){$("div.tip a.close").click();var F=T.id;var R=T.className;var L=380;if((/.*width-(\d+).*/).exec(R)){L=parseInt(RegExp.$1,10)}T=$(T);if(T.hasClass("opened")){return false}T.addClass("opened");var O="";if(T.hasClass("help")){(/.*help-(\d+).*/).exec(F);F=RegExp.$1;O=$("#help-content-"+F).html()}else{O=T.html()}var H="";if(T.hasClass("top-right")){H="top-right"}if(T.hasClass("top-left")){H="top-left"}if(T.hasClass("left-top")){H="left-top"}if(T.hasClass("right-top")){H="right-top"}if(T.hasClass("left-bottom")){H="left-bottom"}if(T.hasClass("right-bottom")){H="right-bottom"}var J=T.offset();var Q=T.width();var N=T.height();var F="tip-"+B();var M=A.split("||direction||").join(H).split("||content||").join(O).split("||id||").join(F);$("#doc").append(M);var K=$("#"+F);K.width(L);var S=0;var I=0;if(H=="top-right"){S=10,I=-(L-68-Q/2)}if(H=="top-left"){S=10,I=(-68+Q/2)}if(H=="left-top"){S=-60,I=Q}if(H=="right-top"){S=-60,I=-(L)}if(H=="left-bottom"){S=0,I=Q}if(H=="right-bottom"){S=0,I=-(L)}var P=J.top+S;var G=J.left+I;K.css({top:(P),left:(G)});K.prepend('<a class="close" href="#">close</a>');$("a.close,div.top,div.bottom,div.side-left",K).click(function(){E(this,T);return false});$("div.side-right",K).click(function(){E($(this).parent(),T);return false});$("div.content",K).click(function(){return false});K.show()}var A='<div id="||id||" class="tip tip-||direction||">';A+='<div class="top"><div class="corner top-left"></div><div class="background"></div><div class="arrow"></div><div class="corner top-right"></div></div>';A+='<div class="side-left"><div class="side-right"><div class="content"><div class="arrow"></div>||content||</div></div></div>';A+='<div class="bottom"><div class="corner bottom-left"></div><div class="background"></div><div class="corner bottom-right"></div></div>';A+="</div>";var C=0};