(function($$$$){function $toOpts$$($s$$,$l$$){if($l$$===undefined)$l$$=typeof $s$$=="boolean"?{show:$s$$}:$s$$;else $l$$.show=$s$$;if($l$$&&($l$$.img||$l$$.element)&&!$l$$.pulse)$l$$.pulse=false;if($l$$&&$l$$.onAjax!==undefined&&$l$$.show===undefined)$l$$.show=false;return $l$$}function $css$$($el$$,$prop$$){$el$$=$el$$.css($prop$$);return $el$$=="auto"?0:parseFloat($el$$,10)}var $L$$=$$$$.loading=function $$$$$$loading$($show$$,$opts$$){return $$$$("body").loading($show$$,$opts$$,true)};$$$$.fn.loading=
function $$$$$$fn$loading$($show$$,$opts$$,$page$$){$opts$$=$toOpts$$($show$$,$opts$$);var $base$$=$page$$?$$$$.extend(true,{},$L$$,$L$$.pageOptions):$L$$;return this.each(function(){var $$el$$=$$$$(this),$l$$=$$$$.extend(true,{},$base$$,$$$$.metadata?$$el$$.metadata():null,$opts$$);typeof $l$$.onAjax=="boolean"?$L$$.setAjax.call($$el$$,$l$$):$L$$.toggle.call($$el$$,$l$$)})};var $fixed$$={position:"fixed"};$$$$.extend($L$$,{version:"1.6.4",align:"top-left",pulse:"working error",mask:false,img:null,
element:null,text:"Loading...",onAjax:undefined,delay:0,max:0,classname:"loading",imgClass:"loading-img",elementClass:"loading-element",maskClass:"loading-mask",css:{position:"absolute",whiteSpace:"nowrap",zIndex:1001},maskCss:{position:"absolute",opacity:0.15,background:"#333",zIndex:101,display:"block",cursor:"wait"},cloneEvents:true,pageOptions:{page:true,align:"top-center",css:$fixed$$,maskCss:$fixed$$},html:"<div></div>",maskHtml:"<div></div>",maskedClass:"loading-masked",maskEvents:"mousedown mouseup keydown keypress",
resizeEvents:"resize",working:{time:1E4,text:"Still working...",run:function($l$$){var $w$$=$l$$.working,$self$$=this;$w$$.timeout=setTimeout(function(){$self$$.height("auto").width("auto").text($l$$.text=$w$$.text);$l$$.place.call($self$$,$l$$)},$w$$.time)}},error:{time:1E5,text:"Task may have failed...",classname:"loading-error",run:function($l$$){var $e$$=$l$$.error,$self$$=this;$e$$.timeout=setTimeout(function(){$self$$.height("auto").width("auto").text($l$$.text=$e$$.text).addClass($e$$.classname);
$l$$.place.call($self$$,$l$$)},$e$$.time)}},fade:{time:800,speed:"slow",run:function($f_l$$){$f_l$$=$f_l$$.fade;var $s$$=$f_l$$.speed,$self$$=this;$f_l$$.interval=setInterval(function(){$self$$.fadeOut($s$$).fadeIn($s$$)},$f_l$$.time)}},ellipsis:{time:300,run:function($l$$){function $dotIndex$$($t$$){var $x$$=$t$$.indexOf(".");return $x$$<0?$t$$.length:$x$$}var $e$$=$l$$.ellipsis,$self$$=this;$e$$.interval=setInterval(function(){var $et$$=$self$$.text(),$t$$=$l$$.text,$i$$=$dotIndex$$($t$$);$self$$.text($et$$.length-
$i$$<3?$et$$+".":$t$$.substring(0,$i$$))},$e$$.time)}},type:{time:100,run:function($l$$){var $t$$=$l$$.type,$self$$=this;$t$$.interval=setInterval(function(){var $el$$=$self$$.text().length,$txt$$=$l$$.text;$self$$.text($el$$==$txt$$.length?$txt$$.charAt(0):$txt$$.substring(0,$el$$+1))},$t$$.time)}},toggle:function($l$$){var $old$$=this.data("loading");if($old$$)$l$$.show!==true&&$old$$.off.call(this,$old$$,$l$$);else $l$$.show!==false&&$l$$.on.call(this,$l$$)},setAjax:function($l$$){if($l$$.onAjax){var $self$$=
this,$count$$=0,$A$$=$l$$.ajax={start:function $$l$$$ajax$start$(){$count$$++||$l$$.on.call($self$$,$l$$)},stop:function $$l$$$ajax$stop$(){--$count$$||$l$$.off.call($self$$,$l$$,$l$$)}};this.bind("ajaxStart.loading",$A$$.start).bind("ajaxStop.loading",$A$$.stop)}else this.unbind("ajaxStart.loading ajaxStop.loading")},on:function($l$$,$force$$){var $p$$=$l$$.parent=this.data("loading",$l$$);if($l$$.max)$l$$.maxout=setTimeout(function(){$l$$.off.call($p$$,$l$$,$l$$)},$l$$.max);if($l$$.delay&&!$force$$)return $l$$.timeout=
setTimeout(function(){delete $l$$.timeout;$l$$.on.call($p$$,$l$$,true)},$l$$.delay);if($l$$.mask)$l$$.mask=$l$$.createMask.call($p$$,$l$$);$l$$.display=$l$$.create.call($p$$,$l$$);if($l$$.img)$l$$.initImg.call($p$$,$l$$);else $l$$.element?$l$$.initElement.call($p$$,$l$$):$l$$.init.call($p$$,$l$$);$p$$.trigger("loadingStart",[$l$$])},initImg:function($l$$){var $self$$=this;$l$$.imgElement=$$$$('<img src="'+$l$$.img+'"/>').bind("load",function(){$l$$.init.call($self$$,$l$$)});$l$$.display.addClass($l$$.imgClass).append($l$$.imgElement)},
initElement:function($l$$){$l$$.element=$$$$($l$$.element).clone($l$$.cloneEvents).show();$l$$.display.addClass($l$$.elementClass).append($l$$.element);$l$$.init.call(this,$l$$)},init:function($l$$){$l$$.place.call($l$$.display,$l$$);$l$$.pulse&&$l$$.initPulse.call(this,$l$$)},initPulse:function($l$$){$$$$.each($l$$.pulse.split(" "),function(){$l$$[this].run.call($l$$.display,$l$$)})},create:function($l$$){var $el$$=$$$$($l$$.html).addClass($l$$.classname).css($l$$.css).appendTo(this);if($l$$.text&&
!$l$$.img&&!$l$$.element)$el$$.text($l$$.originalText=$l$$.text);$$$$(window).bind($l$$.resizeEvents,$l$$.resizer=function $$l$$$resizer$(){$l$$.resize($l$$)});return $el$$},resize:function($l$$){$l$$.parent.box=null;$l$$.mask&&$l$$.mask.hide();$l$$.place.call($l$$.display.hide(),$l$$);$l$$.mask&&$l$$.mask.show().css($l$$.parent.box)},createMask:function($l$$){var $box$$=$l$$.measure.call(this.addClass($l$$.maskedClass),$l$$);$l$$.handler=function $$l$$$handler$($e$$){return $l$$.maskHandler($e$$,
$l$$)};$$$$(document).bind($l$$.maskEvents,$l$$.handler);return $$$$($l$$.maskHtml).addClass($l$$.maskClass).css($box$$).css($l$$.maskCss).appendTo(this)},maskHandler:function($$els_e$$,$l$$){$$els_e$$=$$$$($$els_e$$.target).parents().andSelf();if($$els_e$$.filter("."+$l$$.classname).length!=0)return true;return!$l$$.page&&$$els_e$$.filter("."+$l$$.maskedClass).length==0},place:function($l$$){var $box$$1_s$$=$l$$.align,$v$$="top",$h$$="left";if(typeof $box$$1_s$$=="object")$box$$1_s$$=$$$$.extend($l$$.calc.call(this,
$v$$,$h$$,$l$$),$box$$1_s$$);else{if($box$$1_s$$!="top-left"){$box$$1_s$$=$box$$1_s$$.split("-");if($box$$1_s$$.length==1)$v$$=$h$$=$box$$1_s$$[0];else{$v$$=$box$$1_s$$[0];$h$$=$box$$1_s$$[1]}}this.hasClass($v$$)||this.addClass($v$$);this.hasClass($h$$)||this.addClass($h$$);$box$$1_s$$=$l$$.calc.call(this,$v$$,$h$$,$l$$)}this.show().css($l$$.box=$box$$1_s$$)},calc:function($v$$,$h$$,$box$$2_l$$){$box$$2_l$$=$$$$.extend({},$box$$2_l$$.measure.call($box$$2_l$$.parent,$box$$2_l$$));var $H$$=$$$$.boxModel?
this.height():this.innerHeight(),$W$$=$$$$.boxModel?this.width():this.innerWidth();if($v$$!="top"){var $d$$=$box$$2_l$$.height-$H$$;if($v$$=="center")$d$$/=2;else if($v$$!="bottom")$d$$=0;else if($$$$.boxModel)$d$$-=$css$$(this,"paddingTop")+$css$$(this,"paddingBottom");$box$$2_l$$.top+=$d$$}if($h$$!="left"){$d$$=$box$$2_l$$.width-$W$$;if($h$$=="center")$d$$/=2;else if($h$$!="right")$d$$=0;else if($$$$.boxModel)$d$$-=$css$$(this,"paddingLeft")+$css$$(this,"paddingRight");$box$$2_l$$.left+=$d$$}$box$$2_l$$.height=
$H$$;$box$$2_l$$.width=$W$$;return $box$$2_l$$},measure:function($l$$){return this.box||(this.box=$l$$.page?$l$$.pageBox($l$$):$l$$.elementBox(this,$l$$))},elementBox:function($e$$){if($e$$.css("position")=="absolute")var $box$$={top:0,left:0};else{$box$$=$e$$.position();$box$$.top+=$css$$($e$$,"marginTop");$box$$.left+=$css$$($e$$,"marginLeft")}$box$$.height=$e$$.outerHeight();$box$$.width=$e$$.outerWidth();return $box$$},pageBox:function($full_l$$){function $get$$($c_d$$1_full$$,$s$$4_side_w$$){var $doc$$=
document;if($c_d$$1_full$$){$s$$4_side_w$$=$s$$4_side_w$$.toLowerCase();$c_d$$1_full$$=$$$$($doc$$)[$s$$4_side_w$$]();$s$$4_side_w$$=$$$$(window)[$s$$4_side_w$$]();return $c_d$$1_full$$-$css$$($$$$($doc$$.body),"marginTop")>$s$$4_side_w$$?$c_d$$1_full$$:$s$$4_side_w$$}$c_d$$1_full$$="client"+$s$$4_side_w$$;return Math.max($doc$$.documentElement[$c_d$$1_full$$],$doc$$.body[$c_d$$1_full$$])}$full_l$$=$$$$.boxModel&&$full_l$$.css.position!="fixed";return{top:0,left:0,height:$get$$($full_l$$,"Height"),
width:$get$$($full_l$$,"Width")}},off:function($old$$,$l$$){this.data("loading",null);$old$$.maxout&&clearTimeout($old$$.maxout);if($old$$.timeout)return clearTimeout($old$$.timeout);$old$$.pulse&&$old$$.stopPulse.call(this,$old$$,$l$$);if($old$$.originalText)$old$$.text=$old$$.originalText;$old$$.mask&&$old$$.stopMask.call(this,$old$$,$l$$);$$$$(window).unbind($old$$.resizeEvents,$old$$.resizer);$old$$.display&&$old$$.display.remove();$old$$.parent&&$old$$.parent.trigger("loadingEnd",[$old$$])},
stopPulse:function($old$$,$l$$){$$$$.each($old$$.pulse.split(" "),function(){var $p$$=$old$$[this];$p$$.end&&$p$$.end.call($l$$.display,$old$$,$l$$);$p$$.interval&&clearInterval($p$$.interval);$p$$.timeout&&clearTimeout($p$$.timeout)})},stopMask:function($old$$,$l$$){this.removeClass($l$$.maskedClass);$$$$(document).unbind($old$$.maskEvents,$old$$.handler);$old$$.mask.remove()}})})(jQuery);
