(function($){jQuery.Balloon={_showTimeoutId:-1,timeoutId:null,prepare:function()
{if($("div#BALLOON_ROOT").size()==0)
{tmp=$('<div class="balloon" id="BALLOON_ROOT"><div class="tip"><p></p></div><div class="close"><p></p></div><div class="body"></div></div>').hide().appendTo('body').click(function()
{$.Balloon.hide();});if($.fn.bgiframe)
{tmp.bgiframe();}}
return this;},show:function(settings)
{var s=settings;clearTimeout($.Balloon._showTimeoutId);$.Balloon._showTimeoutId=setTimeout(function()
{$.Balloon._show(s);},500);},_show:function(settings)
{var settings=$.extend({title:"",text:"",top:0,left:0,show:"",hide:"",bodyElement:"body",timeout:1500},settings);window.clearTimeout($.Balloon.timeoutId);$.Balloon.timeoutId=null;width=$("div#BALLOON_ROOT").width();bodyWidth=document.body.clientWidth;tipOffset=0;if(settings.left+width-bodyWidth>0)
{tipOffset=settings.left-(bodyWidth-width-5);settings.left=(bodyWidth-width-5);}
$("div#BALLOON_ROOT").hide().css({top:settings.top,left:settings.left,position:"absolute"}).find("div.body").html('<h1>'+settings.title+'</h1><p>'+settings.text+'</p>').end().find(".tip").each(function()
{$(this).css("background","transparent "+$(this).css("backgroundImage")+" "+(-195+tipOffset)+"px 1px no-repeat");});$("div#BALLOON_ROOT").fadeIn(settings.show);$.Balloon.timeoutId=window.setTimeout(function()
{$.Balloon.hide({hide:settings.hide});},settings.timeout);},extend:function(event)
{clearTimeout($.Balloon.timeoutId);$.Balloon.timeoutId=null;$(document.getElementById("BALLOON_ROOT")).css({top:event.pageY,left:event.pageX,position:"absolute"});},hide:function(settings)
{if($.Balloon.timeoutId==null)return;$.Balloon.timeoutId=null;settings=$.extend({hide:""});$("div#BALLOON_ROOT").fadeOut(settings.hide);}};})(jQuery)