/*
 * jQuery blockUI plugin
 * Version 2.26 (09-SEP-2009)
 * @requires jQuery v1.2.3 or later
 *
 * Examples at: http://malsup.com/jquery/block/
 * Copyright (c) 2007-2008 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Thanks to Amir-Hossein Sobhi for some excellent contributions!
 */
(function(g){if(/1\.(0|1|2)\.(0|1|2)/.test(g.fn.jquery)||/^1.1/.test(g.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later!  You are using v"+g.fn.jquery);return}g.fn._fadeIn=g.fn.fadeIn;var h=document.documentMode||0;var e=g.browser.msie&&((g.browser.version<8&&!h)||h<8);var d=g.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!h;g.blockUI=function(o){b(window,o)};g.unblockUI=function(o){c(window,o)};g.growlUI=function(s,r,o,q){var p=g('<div class="growlUI"></div>');if(s){p.append("<h1>"+s+"</h1>")}if(r){p.append("<h2>"+r+"</h2>")}if(o==undefined){o=3000}g.blockUI({message:p,fadeIn:700,fadeOut:1000,centerY:false,timeout:o,showOverlay:false,onUnblock:q,css:g.blockUI.defaults.growlCSS})};g.fn.block=function(o){return this.unblock({fadeOut:0}).each(function(){if(g.css(this,"position")=="static"){this.style.position="relative"}if(g.browser.msie){this.style.zoom=1}b(this,o)})};g.fn.unblock=function(o){return this.each(function(){c(this,o)})};g.blockUI.version=2.26;g.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:true,theme:false,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:0.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:0.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var a=null;var f=[];function b(o,A){var v=(o==window);var r=A&&A.message!==undefined?A.message:undefined;A=g.extend({},g.blockUI.defaults,A||{});A.overlayCSS=g.extend({},g.blockUI.defaults.overlayCSS,A.overlayCSS||{});var x=g.extend({},g.blockUI.defaults.css,A.css||{});var I=g.extend({},g.blockUI.defaults.themedCSS,A.themedCSS||{});r=r===undefined?A.message:r;if(v&&a){c(window,{fadeOut:0})}if(r&&typeof r!="string"&&(r.parentNode||r.jquery)){var D=r.jquery?r[0]:r;var J={};g(o).data("blockUI.history",J);J.el=D;J.parent=D.parentNode;J.display=D.style.display;J.position=D.style.position;if(J.parent){J.parent.removeChild(D)}}var w=A.baseZ;var H=(g.browser.msie||A.forceIframe)?g('<iframe class="blockUI" style="z-index:'+(w++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+A.iframeSrc+'"></iframe>'):g('<div class="blockUI" style="display:none"></div>');var G=g('<div class="blockUI blockOverlay" style="z-index:'+(w++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var F;if(A.theme&&v){var C='<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+w+';display:none;position:fixed"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(A.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>';F=g(C)}else{F=v?g('<div class="blockUI blockMsg blockPage" style="z-index:'+w+';display:none;position:fixed"></div>'):g('<div class="blockUI blockMsg blockElement" style="z-index:'+w+';display:none;position:absolute"></div>')}if(r){if(A.theme){F.css(I);F.addClass("ui-widget-content")}else{F.css(x)}}if(!A.applyPlatformOpacityRules||!(g.browser.mozilla&&/Linux/.test(navigator.platform))){G.css(A.overlayCSS)}G.css("position",v?"fixed":"absolute");if(g.browser.msie||A.forceIframe){H.css("opacity",0)}g([H[0],G[0],F[0]]).appendTo(v?"body":o);if(A.theme&&A.draggable&&g.fn.draggable){F.draggable({handle:".ui-dialog-titlebar",cancel:"li"})}var q=e&&(!g.boxModel||g("object,embed",v?null:o).length>0);if(d||q){if(v&&A.allowBodyStretch&&g.boxModel){g("html,body").css("height","100%")}if((d||!g.boxModel)&&!v){var B=k(o,"borderTopWidth"),E=k(o,"borderLeftWidth");var u=B?"(0 - "+B+")":0;var y=E?"(0 - "+E+")":0}g.each([H,G,F],function(t,M){var z=M[0].style;z.position="absolute";if(t<2){v?z.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+A.quirksmodeOffsetHack+') + "px"'):z.setExpression("height",'this.parentNode.offsetHeight + "px"');v?z.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):z.setExpression("width",'this.parentNode.offsetWidth + "px"');if(y){z.setExpression("left",y)}if(u){z.setExpression("top",u)}}else{if(A.centerY){if(v){z.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}z.marginTop=0}else{if(!A.centerY&&v){var K=(A.css&&A.css.top)?parseInt(A.css.top):0;var L="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+K+') + "px"';z.setExpression("top",L)}}}})}if(r){if(A.theme){F.find(".ui-widget-content").append(r)}else{F.append(r)}if(r.jquery||r.nodeType){g(r).show()}}if((g.browser.msie||A.forceIframe)&&A.showOverlay){H.show()}if(A.fadeIn){if(A.showOverlay){G._fadeIn(A.fadeIn)}if(r){F.fadeIn(A.fadeIn)}}else{if(A.showOverlay){G.show()}if(r){F.show()}}j(1,o,A);if(v){a=F[0];f=g(":input:enabled:visible",a);if(A.focusInput){setTimeout(n,20)}}else{l(F[0],A.centerX,A.centerY)}if(A.timeout){var p=setTimeout(function(){v?g.unblockUI(A):g(o).unblock(A)},A.timeout);g(o).data("blockUI.timeout",p)}}function c(r,s){var q=(r==window);var p=g(r);var t=p.data("blockUI.history");var u=p.data("blockUI.timeout");if(u){clearTimeout(u);p.removeData("blockUI.timeout")}s=g.extend({},g.blockUI.defaults,s||{});j(0,r,s);var o;if(q){o=g("body").children().filter(".blockUI").add("body > .blockUI")}else{o=g(".blockUI",r)}if(q){a=f=null}if(s.fadeOut){o.fadeOut(s.fadeOut);setTimeout(function(){i(o,t,s,r)},s.fadeOut)}else{i(o,t,s,r)}}function i(o,r,q,p){o.each(function(s,t){if(this.parentNode){this.parentNode.removeChild(this)}});if(r&&r.el){r.el.style.display=r.display;r.el.style.position=r.position;if(r.parent){r.parent.appendChild(r.el)}g(r.el).removeData("blockUI.history")}if(typeof q.onUnblock=="function"){q.onUnblock(p,q)}}function j(o,s,t){var r=s==window,q=g(s);if(!o&&(r&&!a||!r&&!q.data("blockUI.isBlocked"))){return}if(!r){q.data("blockUI.isBlocked",o)}if(!t.bindEvents||(o&&!t.showOverlay)){return}var p="mousedown mouseup keydown keypress";o?g(document).bind(p,t,m):g(document).unbind(p,m)}function m(r){if(r.keyCode&&r.keyCode==9){if(a&&r.data.constrainTabKey){var q=f;var p=!r.shiftKey&&r.target==q[q.length-1];var o=r.shiftKey&&r.target==q[0];if(p||o){setTimeout(function(){n(o)},10);return false}}}if(g(r.target).parents("div.blockMsg").length>0){return true}return g(r.target).parents().children().filter("div.blockUI").length==0}function n(o){if(!f){return}var p=f[o===true?f.length-1:0];if(p){p.focus()}}function l(v,o,z){var w=v.parentNode,u=v.style;var q=((w.offsetWidth-v.offsetWidth)/2)-k(w,"borderLeftWidth");var r=((w.offsetHeight-v.offsetHeight)/2)-k(w,"borderTopWidth");if(o){u.left=q>0?(q+"px"):"0"}if(z){u.top=r>0?(r+"px"):"0"}}function k(o,q){return parseInt(g.css(o,q))||0}})(jQuery);