(function(n){window.lbb=n.extend(window.lbb||{},{Guid:function(){var n=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()},inherit:function(n,t){var i=function(){this.constructor=n};i.prototype=t.prototype;n.prototype=new i},showLoading:function(t,i){var u=t?n(t).addClass("loading-wrap"):n("body"),r=u.find(">.loading");r.size()==0&&(u.append(n("
<\/div>
<\/div>
<\/div><\/div>")),r=u.find(">.loading"),r.find(".close").click(function(){u.hideLoading()}));r.find(".text").html(i||"Loading ...");r.find(".close").hide();n.isNumeric(r.stop(!0,!0).hide().fadeIn().data("timer"))&&clearTimeout(r.data("timer"));r.data("timer",setTimeout(function(){r.find(".text").html("The internet speed is a bit slow right now, please wait patiently.");r.find(".close").show();n.ajax("/favicon.ico",{cache:!1}).fail(function(){r.find(".text").html("Lost connection to the server, please check your internet connection.")});r.data("timer",setTimeout(function(){r.find(".text").html("Lost connection to the server, please check your internet connection.")},6e4))},15e3))},hideLoading:function(t){var i=t?n(t):n("body");i.find(".loading").stop(!0,!0).fadeOut().each(function(){var t=n(this);n.isNumeric(t.data("timer"))&&(clearTimeout(t.data("timer")),t.removeData("timer"))})},updatePartial:function(t,i,r){top.lbb.showLoading();n.post(t,r,function(t){top.lbb.hideLoading();n(i).html(t)})},initLinkElement:function(t){n.isFunction(lbb.initLinkElement.linkFn)||(lbb.initLinkElement.linkFn=function(){var i=n(this);if(i.attr("link"))return window.open(i.attr("link"),i.attr("target")||t),!1});n.isFunction(lbb.initLinkElement.link_aFn)||(lbb.initLinkElement.link_aFn=function(){return $aTag=n(this),$aTag.attr("href")?(window.open($aTag.attr("href"),$aTag.attr("target")),!1):void 0})}});n.extend(n.fn,{showLoading:function(t){return n(this).each(function(){lbb.showLoading(this,t)}),this},hideLoading:function(){return n(this).each(function(){lbb.hideLoading(this)}),this},ajaxSubmit:function(t,i,r){return n(this).each(function(){r||(r="frame_"+lbb.Guid());var e=n(this),u=n("iframe[name='"+r+"']"),f;u.size()==0&&(f=r,u=n(['