(function(b){var a=function(e,d){var f=0;b.each(d.split(/\s+/)||[],function(h,g){f+=parseInt(b(e).css(g))||0});return f};b.fn.msgTip=function(f){var d=(typeof f=="string"),e=Array.prototype.slice.call(arguments,1);return this.each(function(){var g=b(this).data("msgTip");if(d&&g&&b.isFunction(g[f])){g[f].apply(g,e)}else{if(!g){b(this).data("msgTip",new b.msgTip(this,f))}}})};b.msgTip=function(e,d){this.element=b(e);this.options=b.extend(true,{},b.msgTip.defaults,d);this.init()};b.extend(b.msgTip.prototype,{init:function(){var e,d;if(this.element[0].nodeName=="A"){d=this.element.attr("href").replace("#","")||"";if(d!=""&&b("#"+d).length){e=b("#"+d)}}if(typeof e==="undefined"&&this.element.attr("title")!=""){e=b("<p/>").text(this.element.attr("title"))}if(typeof e!=="undefined"){this.msg=new b.msgTip.createMessage(e,this.options.tipClassName)}this.element.bind("mouseover",b.proxy(this.show,this)).bind("mouseout",b.proxy(this.hide,this));if(this.options.tipSelectable){this.hideTipTimeout=null;this.msg.box.bind("mouseover",b.proxy(this.show,this)).bind("mouseout",b.proxy(this.hide,this))}},show:function(){if(this.options.tipSelectable){this.clearHideTimeout()}b.msgTip.show(this.msg,this.element)},hide:function(e,d){if(this.options.tipSelectable&&d!==true){this.setHideTimeout()}else{this.msg.box.hide()}},setHideTimeout:function(){var d=this;this.clearHideTimeout();this.hideTipTimeout=window.setTimeout(function(){d.hide.call(d,null,true)},200)},clearHideTimeout:function(){if(this.hideTipTimeout){window.clearTimeout(this.hideTipTimeout);this.hideTipTimeout=null}}});b.extend(b.msgTip,{destoryMessage:function(d){d.box.remove();d.box.boxContent=null;d.box=null;d=null},createMessage:function(g,d){this.uid="msgTip_"+(new Date()).getTime();this.box=b.msgTip.createBox(this.uid,d);this.boxContent=b(".msgTipContent",this.box);if(typeof g=="string"){this.boxContent.html(g)}else{if(b.isFunction(g)){this.boxContent.html(g.call())}else{if(typeof g!=="undefined"&&(typeof g.nodeName!==undefined||typeof g[0].nodeName!=="undefined")){try{this.boxContent.append(g)}catch(f){}}}}this.boxW=this.boxContent.outerWidth(true);this.boxH=this.boxContent.outerHeight(true);b.msgTip.initBorders(this.box);this.location=b(".bdr-a",this.box).css("display")==="none"?"bottom":"top";return this},createBox:function(f,g){var e=f||"",d;if(e==""){e="msgTip_"+(new Date()).getTime()}d='<div class="msgTip '+(typeof g==="string"?g:"")+'" id="'+e+'"><div class="bdr-t1"></div><div class="bdr-t2"></div><div class="bdr-b1"></div><div class="bdr-b2"></div><div class="bdr-l"></div><div class="bdr-r"></div><div class="bdr-tl"></div><div class="bdr-tr"></div><div class="bdr-bl"></div><div class="bdr-br"></div><div class="bdr-a"></div><div class="bdr-at"></div><div class="msgTipContent"></div></div>';return b(d).appendTo("body").css("visibility","hidden")},show:function(f,g){var d,e=0;if(typeof g==="undefined"){return}if(b.isFunction(g)){g=g.call()}else{if(g.nodeName){d=b(g).outerWidth();e=b(g).outerHeight();g=b(g).offset();g.x=g.left+(d/2);g.y=g.top}else{if(typeof g.jquery!=="undefined"&&typeof g[0]!=="undefined"&&g[0].nodeName){d=b(g).outerWidth();e=b(g).outerHeight();g=b(g[0]).offset();g.x=g.left+(d/2);g.y=g.top}else{if(g.pageX&&g.pageY){g.x=g.pageX;g.y=g.pageY}}}}if(typeof g.x!=="undefined"&&typeof g.y!=="undefined"){x=g.x-(f.boxW/2);if(f.location==="top"){y=g.y-f.boxH}else{y=g.y+e}}f.box.css({left:x,top:y,visibility:"visible",display:"block"})},initBorders:function(g){var l={},k=b(".msgTipContent",g),j=k.outerWidth(true),e=k.outerHeight(true),m,i,h,f,d,n;b.each(["bdr-t1","bdr-t2","bdr-b1","bdr-b2","bdr-l","bdr-r","bdr-tl","bdr-tr","bdr-bl","bdr-br","bdr-a","bdr-at"],function(p,o){l[o]=b("."+o,g);if(!l[o].length){l[o]=b("<div class='"+o+"'></div>").appendTo(g)}});m=j-(l["bdr-tl"].outerWidth()+a(l["bdr-tl"],"marginLeft marginRight"))-(l["bdr-tr"].outerWidth()+a(l["bdr-tr"],"marginLeft marginRight"));if(l["bdr-at"].css("display")!=="none"){n=l["bdr-tl"].outerWidth()+a(l["bdr-tl"],"marginLeft");d=l["bdr-at"].outerWidth();h=Math.ceil((m-d)/2);f=h+d;l["bdr-t1"].css({left:n,width:h});f=m-h-d;l["bdr-t2"].css({left:h+d+n,width:f});l["bdr-at"].css({left:h+n})}else{l["bdr-t1"].css({width:m,left:l["bdr-tl"].outerWidth()+a(l["bdr-tl"],"marginLeft")});l["bdr-t2"].hide()}i=e-(l["bdr-tl"].outerHeight()+a(l["bdr-tl"],"marginTop marginBottom"))-(l["bdr-bl"].outerHeight()+a(l["bdr-bl"],"marginTop marginBottom"));l["bdr-l"].css({height:i,top:l["bdr-tl"].outerHeight()+a(l["bdr-tl"],"marginTop")});if(b.browser.msie&&b.browser.version<7){l["bdr-br"].css({bottom:"auto",top:i+l["bdr-tr"].outerHeight()+a(l["bdr-tr"],"marginTop")});l["bdr-bl"].css({bottom:"auto",top:i+l["bdr-tl"].outerHeight()+a(l["bdr-tl"],"marginTop")});l["bdr-b1"].css({bottom:"auto",top:i+l["bdr-tl"].outerHeight()+a(l["bdr-tl"],"marginTop")});l["bdr-b2"].css({bottom:"auto",top:i+l["bdr-tr"].outerHeight()+a(l["bdr-tr"],"marginTop")});l["bdr-a"].css({bottom:"auto",top:i+l["bdr-tr"].outerHeight()+a(l["bdr-tr"],"marginTop")});l["bdr-tr"].css({right:"auto",left:m+l["bdr-tl"].outerWidth()+a(l["bdr-tl"],"marginLeft")});l["bdr-br"].css({right:"auto",left:m+l["bdr-tl"].outerWidth()+a(l["bdr-tl"],"marginLeft")});l["bdr-r"].css({right:"auto",left:m+l["bdr-bl"].outerWidth()+a(l["bdr-bl"],"marginLeft")})}l["bdr-r"].css({height:i,top:l["bdr-tr"].outerHeight()+a(l["bdr-tr"],"marginTop")});if(l["bdr-a"].css("display")!=="none"){n=l["bdr-bl"].outerWidth()+a(l["bdr-bl"],"marginLeft");d=l["bdr-a"].outerWidth();h=Math.ceil((m-d)/2);f=h+d;l["bdr-b1"].css({left:n,width:h});f=m-h-d;l["bdr-b2"].css({left:h+d+n,width:f});l["bdr-a"].css({left:h+n})}else{l["bdr-b1"].css({width:m,left:l["bdr-bl"].outerWidth()+a(l["bdr-bl"],"marginLeft")});l["bdr-b2"].hide()}}});b.extend(b.msgTip,{defaults:{tipClassName:"",tipSelectable:false,tipLocation:"top"}});var c=window.messageTip=function(d,e){var f=new b.msgTip.createMessage(e);b.msgTip.show(f,d);b("html").bind("mousedown.msgTip"+f.uid,function(g){if(b(g.target).closest("#"+f.uid).length<1){b("html").unbind("mousedown.msgTip"+f.uid);b.msgTip.destoryMessage(f);f=null}});return f}})(jQuery);(function(a){a.fn.toolTip=function(e){var c=(typeof e=="string"),d=Array.prototype.slice.call(arguments,1);return this.each(function(){var f=a(this).data("msgTip");if(c&&f&&a.isFunction(f[e])){f[e].apply(f,d)}else{if(!f){a(this).msgTip({tipClassName:"toolsTip"})}}})};var b=window.showTooltip=function(c,d){var e=new a.msgTip.createMessage(d,"toolsTip");a.msgTip.show(e,c);a("html").bind("mousedown.msgTip"+e.uid,function(f){if(a(f.target).closest("#"+e.uid).length<1){a("html").unbind("mousedown.msgTip"+e.uid);a.msgTip.destoryMessage(e);e=null}});return e}})(jQuery);(function(a){a.fn.menuTip=function(d){var b=(typeof d=="string"),c=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this).data("msgTip");if(b&&e&&a.isFunction(e[d])){e[d].apply(e,c)}else{if(!e){a(this).msgTip({tipClassName:"menuTipHolder",tipSelectable:true,tipLocation:"bottom"})}}})}})(jQuery);(function(a){a.fn.menuTipSml=function(d){var b=(typeof d=="string"),c=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this).data("msgTip");if(b&&e&&a.isFunction(e[d])){e[d].apply(e,c)}else{if(!e){a(this).msgTip({tipClassName:"menuTipHolderSml",tipSelectable:true,tipLocation:"bottom"})}}})}})(jQuery);
