* Readonly document view.
[redakcja.git] / platforma / static / js / jquery.blockui.js
index d2da4bc..5491667 100644 (file)
-/*!\r
- * jQuery blockUI plugin\r
- * Version 2.31 (06-JAN-2010)\r
- * @requires jQuery v1.2.3 or later\r
- *\r
- * Examples at: http://malsup.com/jquery/block/\r
- * Copyright (c) 2007-2008 M. Alsup\r
- * Dual licensed under the MIT and GPL licenses:\r
- * http://www.opensource.org/licenses/mit-license.php\r
- * http://www.gnu.org/licenses/gpl.html\r
- *\r
- * Thanks to Amir-Hossein Sobhi for some excellent contributions!\r
- */\r
-\r
-;(function($) {\r
-\r
-if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {\r
-       alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);\r
-       return;\r
-}\r
-\r
-$.fn._fadeIn = $.fn.fadeIn;\r
-\r
-var noOp = function() {};\r
-\r
-// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle\r
-// retarded userAgent strings on Vista)\r
-var mode = document.documentMode || 0;\r
-var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);\r
-var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;\r
-\r
-// global $ methods for blocking/unblocking the entire page\r
-$.blockUI   = function(opts) { install(window, opts); };\r
-$.unblockUI = function(opts) { remove(window, opts); };\r
-\r
-// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)\r
-$.growlUI = function(title, message, timeout, onClose) {\r
-       var $m = $('<div class="growlUI"></div>');\r
-       if (title) $m.append('<h1>'+title+'</h1>');\r
-       if (message) $m.append('<h2>'+message+'</h2>');\r
-       if (timeout == undefined) timeout = 3000;\r
-       $.blockUI({\r
-               message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,\r
-               timeout: timeout, showOverlay: false,\r
-               onUnblock: onClose, \r
-               css: $.blockUI.defaults.growlCSS\r
-       });\r
-};\r
-\r
-// plugin method for blocking element content\r
-$.fn.block = function(opts) {\r
-       return this.unblock({ fadeOut: 0 }).each(function() {\r
-               if ($.css(this,'position') == 'static')\r
-                       this.style.position = 'relative';\r
-               if ($.browser.msie)\r
-                       this.style.zoom = 1; // force 'hasLayout'\r
-               install(this, opts);\r
-       });\r
-};\r
-\r
-// plugin method for unblocking element content\r
-$.fn.unblock = function(opts) {\r
-       return this.each(function() {\r
-               remove(this, opts);\r
-       });\r
-};\r
-\r
-$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost!\r
-\r
-// override these in your code to change the default behavior and style\r
-$.blockUI.defaults = {\r
-       // message displayed when blocking (use null for no message)\r
-       message:  '<h1>Please wait...</h1>',\r
-\r
-       title: null,      // title string; only used when theme == true\r
-       draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)\r
-       \r
-       theme: false, // set to true to use with jQuery UI themes\r
-       \r
-       // styles for the message when blocking; if you wish to disable\r
-       // these and use an external stylesheet then do this in your code:\r
-       // $.blockUI.defaults.css = {};\r
-       css: {\r
-               padding:        0,\r
-               margin:         0,\r
-               width:          '30%',\r
-               top:            '40%',\r
-               left:           '35%',\r
-               textAlign:      'center',\r
-               color:          '#000',\r
-               border:         '3px solid #aaa',\r
-               backgroundColor:'#fff',\r
-               cursor:         'wait'\r
-       },\r
-       \r
-       // minimal style set used when themes are used\r
-       themedCSS: {\r
-               width:  '30%',\r
-               top:    '40%',\r
-               left:   '35%'\r
-       },\r
-\r
-       // styles for the overlay\r
-       overlayCSS:  {\r
-               backgroundColor: '#000',\r
-               opacity:                 0.6,\r
-               cursor:                  'wait'\r
-       },\r
-\r
-       // styles applied when using $.growlUI\r
-       growlCSS: {\r
-               width:          '350px',\r
-               top:            '10px',\r
-               left:           '',\r
-               right:          '10px',\r
-               border:         'none',\r
-               padding:        '5px',\r
-               opacity:        0.6,\r
-               cursor:         'default',\r
-               color:          '#fff',\r
-               backgroundColor: '#000',\r
-               '-webkit-border-radius': '10px',\r
-               '-moz-border-radius':    '10px'\r
-       },\r
-       \r
-       // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w\r
-       // (hat tip to Jorge H. N. de Vasconcelos)\r
-       iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',\r
-\r
-       // force usage of iframe in non-IE browsers (handy for blocking applets)\r
-       forceIframe: false,\r
-\r
-       // z-index for the blocking overlay\r
-       baseZ: 1000,\r
-\r
-       // set these to true to have the message automatically centered\r
-       centerX: true, // <-- only effects element blocking (page block controlled via css above)\r
-       centerY: true,\r
-\r
-       // allow body element to be stetched in ie6; this makes blocking look better\r
-       // on "short" pages.  disable if you wish to prevent changes to the body height\r
-       allowBodyStretch: true,\r
-\r
-       // enable if you want key and mouse events to be disabled for content that is blocked\r
-       bindEvents: true,\r
-\r
-       // be default blockUI will supress tab navigation from leaving blocking content\r
-       // (if bindEvents is true)\r
-       constrainTabKey: true,\r
-\r
-       // fadeIn time in millis; set to 0 to disable fadeIn on block\r
-       fadeIn:  200,\r
-\r
-       // fadeOut time in millis; set to 0 to disable fadeOut on unblock\r
-       fadeOut:  400,\r
-\r
-       // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock\r
-       timeout: 0,\r
-\r
-       // disable if you don't want to show the overlay\r
-       showOverlay: true,\r
-\r
-       // if true, focus will be placed in the first available input field when\r
-       // page blocking\r
-       focusInput: true,\r
-\r
-       // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)\r
-       applyPlatformOpacityRules: true,\r
-       \r
-       // callback method invoked when fadeIn has completed and blocking message is visible\r
-       onBlock: null,\r
-\r
-       // callback method invoked when unblocking has completed; the callback is\r
-       // passed the element that has been unblocked (which is the window object for page\r
-       // blocks) and the options that were passed to the unblock call:\r
-       //       onUnblock(element, options)\r
-       onUnblock: null,\r
-\r
-       // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493\r
-       quirksmodeOffsetHack: 4\r
-};\r
-\r
-// private data and functions follow...\r
-\r
-var pageBlock = null;\r
-var pageBlockEls = [];\r
-\r
-function install(el, opts) {\r
-       var full = (el == window);\r
-       var msg = opts && opts.message !== undefined ? opts.message : undefined;\r
-       opts = $.extend({}, $.blockUI.defaults, opts || {});\r
-       opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});\r
-       var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});\r
-       var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});\r
-       msg = msg === undefined ? opts.message : msg;\r
-\r
-       // remove the current block (if there is one)\r
-       if (full && pageBlock)\r
-               remove(window, {fadeOut:0});\r
-\r
-       // if an existing element is being used as the blocking content then we capture\r
-       // its current place in the DOM (and current display style) so we can restore\r
-       // it when we unblock\r
-       if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {\r
-               var node = msg.jquery ? msg[0] : msg;\r
-               var data = {};\r
-               $(el).data('blockUI.history', data);\r
-               data.el = node;\r
-               data.parent = node.parentNode;\r
-               data.display = node.style.display;\r
-               data.position = node.style.position;\r
-               if (data.parent)\r
-                       data.parent.removeChild(node);\r
-       }\r
-\r
-       var z = opts.baseZ;\r
-\r
-       // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;\r
-       // layer1 is the iframe layer which is used to supress bleed through of underlying content\r
-       // layer2 is the overlay layer which has opacity and a wait cursor (by default)\r
-       // layer3 is the message content that is displayed while blocking\r
-\r
-       var lyr1 = ($.browser.msie || opts.forceIframe) \r
-               ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')\r
-               : $('<div class="blockUI" style="display:none"></div>');\r
-       var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');\r
-       \r
-       var lyr3;\r
-       if (opts.theme && full) {\r
-               var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +\r
-                                       '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || '&nbsp;')+'</div>' +\r
-                                       '<div class="ui-widget-content ui-dialog-content"></div>' +\r
-                               '</div>';\r
-               lyr3 = $(s);\r
-       }\r
-       else {\r
-               lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')\r
-                                       : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');\r
-       }                                                  \r
-\r
-       // if we have a message, style it\r
-       if (msg) {\r
-               if (opts.theme) {\r
-                       lyr3.css(themedCSS);\r
-                       lyr3.addClass('ui-widget-content');\r
-               }\r
-               else \r
-                       lyr3.css(css);\r
-       }\r
-\r
-       // style the overlay\r
-       if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))\r
-               lyr2.css(opts.overlayCSS);\r
-       lyr2.css('position', full ? 'fixed' : 'absolute');\r
-\r
-       // make iframe layer transparent in IE\r
-       if ($.browser.msie || opts.forceIframe)\r
-               lyr1.css('opacity',0.0);\r
-\r
-       //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);\r
-       var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);\r
-       $.each(layers, function() {\r
-               this.appendTo($par);\r
-       });\r
-       \r
-       if (opts.theme && opts.draggable && $.fn.draggable) {\r
-               lyr3.draggable({\r
-                       handle: '.ui-dialog-titlebar',\r
-                       cancel: 'li'\r
-               });\r
-       }\r
-\r
-       // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)\r
-       var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);\r
-       if (ie6 || expr) {\r
-               // give body 100% height\r
-               if (full && opts.allowBodyStretch && $.boxModel)\r
-                       $('html,body').css('height','100%');\r
-\r
-               // fix ie6 issue when blocked element has a border width\r
-               if ((ie6 || !$.boxModel) && !full) {\r
-                       var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');\r
-                       var fixT = t ? '(0 - '+t+')' : 0;\r
-                       var fixL = l ? '(0 - '+l+')' : 0;\r
-               }\r
-\r
-               // simulate fixed position\r
-               $.each([lyr1,lyr2,lyr3], function(i,o) {\r
-                       var s = o[0].style;\r
-                       s.position = 'absolute';\r
-                       if (i < 2) {\r
-                               full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')\r
-                                        : s.setExpression('height','this.parentNode.offsetHeight + "px"');\r
-                               full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')\r
-                                        : s.setExpression('width','this.parentNode.offsetWidth + "px"');\r
-                               if (fixL) s.setExpression('left', fixL);\r
-                               if (fixT) s.setExpression('top', fixT);\r
-                       }\r
-                       else if (opts.centerY) {\r
-                               if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');\r
-                               s.marginTop = 0;\r
-                       }\r
-                       else if (!opts.centerY && full) {\r
-                               var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;\r
-                               var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';\r
-                               s.setExpression('top',expression);\r
-                       }\r
-               });\r
-       }\r
-\r
-       // show the message\r
-       if (msg) {\r
-               if (opts.theme)\r
-                       lyr3.find('.ui-widget-content').append(msg);\r
-               else\r
-                       lyr3.append(msg);\r
-               if (msg.jquery || msg.nodeType)\r
-                       $(msg).show();\r
-       }\r
-\r
-       if (($.browser.msie || opts.forceIframe) && opts.showOverlay)\r
-               lyr1.show(); // opacity is zero\r
-       if (opts.fadeIn) {\r
-               var cb = opts.onBlock ? opts.onBlock : noOp;\r
-               var cb1 = (opts.showOverlay && !msg) ? cb : noOp;\r
-               var cb2 = msg ? cb : noOp;\r
-               if (opts.showOverlay)\r
-                       lyr2._fadeIn(opts.fadeIn, cb1);\r
-               if (msg)\r
-                       lyr3._fadeIn(opts.fadeIn, cb2);\r
-       }\r
-       else {\r
-               if (opts.showOverlay)\r
-                       lyr2.show();\r
-               if (msg)\r
-                       lyr3.show();\r
-               if (opts.onBlock)\r
-                       opts.onBlock();\r
-       }\r
-\r
-       // bind key and mouse events\r
-       bind(1, el, opts);\r
-\r
-       if (full) {\r
-               pageBlock = lyr3[0];\r
-               pageBlockEls = $(':input:enabled:visible',pageBlock);\r
-               if (opts.focusInput)\r
-                       setTimeout(focus, 20);\r
-       }\r
-       else\r
-               center(lyr3[0], opts.centerX, opts.centerY);\r
-\r
-       if (opts.timeout) {\r
-               // auto-unblock\r
-               var to = setTimeout(function() {\r
-                       full ? $.unblockUI(opts) : $(el).unblock(opts);\r
-               }, opts.timeout);\r
-               $(el).data('blockUI.timeout', to);\r
-       }\r
-};\r
-\r
-// remove the block\r
-function remove(el, opts) {\r
-       var full = (el == window);\r
-       var $el = $(el);\r
-       var data = $el.data('blockUI.history');\r
-       var to = $el.data('blockUI.timeout');\r
-       if (to) {\r
-               clearTimeout(to);\r
-               $el.removeData('blockUI.timeout');\r
-       }\r
-       opts = $.extend({}, $.blockUI.defaults, opts || {});\r
-       bind(0, el, opts); // unbind events\r
-       \r
-       var els;\r
-       if (full) // crazy selector to handle odd field errors in ie6/7\r
-               els = $('body').children().filter('.blockUI').add('body > .blockUI');\r
-       else\r
-               els = $('.blockUI', el);\r
-\r
-       if (full)\r
-               pageBlock = pageBlockEls = null;\r
-\r
-       if (opts.fadeOut) {\r
-               els.fadeOut(opts.fadeOut);\r
-               setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);\r
-       }\r
-       else\r
-               reset(els, data, opts, el);\r
-};\r
-\r
-// move blocking element back into the DOM where it started\r
-function reset(els,data,opts,el) {\r
-       els.each(function(i,o) {\r
-               // remove via DOM calls so we don't lose event handlers\r
-               if (this.parentNode)\r
-                       this.parentNode.removeChild(this);\r
-       });\r
-\r
-       if (data && data.el) {\r
-               data.el.style.display = data.display;\r
-               data.el.style.position = data.position;\r
-               if (data.parent)\r
-                       data.parent.appendChild(data.el);\r
-               $(el).removeData('blockUI.history');\r
-       }\r
-\r
-       if (typeof opts.onUnblock == 'function')\r
-               opts.onUnblock(el,opts);\r
-};\r
-\r
-// bind/unbind the handler\r
-function bind(b, el, opts) {\r
-       var full = el == window, $el = $(el);\r
-\r
-       // don't bother unbinding if there is nothing to unbind\r
-       if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))\r
-               return;\r
-       if (!full)\r
-               $el.data('blockUI.isBlocked', b);\r
-\r
-       // don't bind events when overlay is not in use or if bindEvents is false\r
-       if (!opts.bindEvents || (b && !opts.showOverlay)) \r
-               return;\r
-\r
-       // bind anchors and inputs for mouse and key events\r
-       var events = 'mousedown mouseup keydown keypress';\r
-       b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);\r
-\r
-// former impl...\r
-//        var $e = $('a,:input');\r
-//        b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);\r
-};\r
-\r
-// event handler to suppress keyboard/mouse events when blocking\r
-function handler(e) {\r
-       // allow tab navigation (conditionally)\r
-       if (e.keyCode && e.keyCode == 9) {\r
-               if (pageBlock && e.data.constrainTabKey) {\r
-                       var els = pageBlockEls;\r
-                       var fwd = !e.shiftKey && e.target == els[els.length-1];\r
-                       var back = e.shiftKey && e.target == els[0];\r
-                       if (fwd || back) {\r
-                               setTimeout(function(){focus(back)},10);\r
-                               return false;\r
-                       }\r
-               }\r
-       }\r
-       // allow events within the message content\r
-       if ($(e.target).parents('div.blockMsg').length > 0)\r
-               return true;\r
-\r
-       // allow events for content that is not being blocked\r
-       return $(e.target).parents().children().filter('div.blockUI').length == 0;\r
-};\r
-\r
-function focus(back) {\r
-       if (!pageBlockEls)\r
-               return;\r
-       var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];\r
-       if (e)\r
-               e.focus();\r
-};\r
-\r
-function center(el, x, y) {\r
-       var p = el.parentNode, s = el.style;\r
-       var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');\r
-       var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');\r
-       if (x) s.left = l > 0 ? (l+'px') : '0';\r
-       if (y) s.top  = t > 0 ? (t+'px') : '0';\r
-};\r
-\r
-function sz(el, p) {\r
-       return parseInt($.css(el,p))||0;\r
-};\r
-\r
+/*!
+ * jQuery blockUI plugin
+ * Version 2.31 (06-JAN-2010)
+ * @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($) {
+
+if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
+       alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);
+       return;
+}
+
+$.fn._fadeIn = $.fn.fadeIn;
+
+var noOp = function() {};
+
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
+// retarded userAgent strings on Vista)
+var mode = document.documentMode || 0;
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
+
+// global $ methods for blocking/unblocking the entire page
+$.blockUI   = function(opts) { install(window, opts); };
+$.unblockUI = function(opts) { remove(window, opts); };
+
+// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)
+$.growlUI = function(title, message, timeout, onClose) {
+       var $m = $('<div class="growlUI"></div>');
+       if (title) $m.append('<h1>'+title+'</h1>');
+       if (message) $m.append('<h2>'+message+'</h2>');
+       if (timeout == undefined) timeout = 3000;
+       $.blockUI({
+               message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
+               timeout: timeout, showOverlay: false,
+               onUnblock: onClose,
+               css: $.blockUI.defaults.growlCSS
+       });
+};
+
+// plugin method for blocking element content
+$.fn.block = function(opts) {
+       return this.unblock({ fadeOut: 0 }).each(function() {
+               if ($.css(this,'position') == 'static')
+                       this.style.position = 'relative';
+               if ($.browser.msie)
+                       this.style.zoom = 1; // force 'hasLayout'
+               install(this, opts);
+       });
+};
+
+// plugin method for unblocking element content
+$.fn.unblock = function(opts) {
+       return this.each(function() {
+               remove(this, opts);
+       });
+};
+
+$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost!
+
+// override these in your code to change the default behavior and style
+$.blockUI.defaults = {
+       // message displayed when blocking (use null for no message)
+       message:  '<h1>Please wait...</h1>',
+
+       title: null,      // title string; only used when theme == true
+       draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)
+
+       theme: false, // set to true to use with jQuery UI themes
+
+       // styles for the message when blocking; if you wish to disable
+       // these and use an external stylesheet then do this in your code:
+       // $.blockUI.defaults.css = {};
+       css: {
+               padding:        0,
+               margin:         0,
+               width:          '30%',
+               top:            '40%',
+               left:           '35%',
+               textAlign:      'center',
+               color:          '#000',
+               border:         '3px solid #aaa',
+               backgroundColor:'#fff',
+               cursor:         'wait'
+       },
+
+       // minimal style set used when themes are used
+       themedCSS: {
+               width:  '30%',
+               top:    '40%',
+               left:   '35%'
+       },
+
+       // styles for the overlay
+       overlayCSS:  {
+               backgroundColor: '#000',
+               opacity:                 0.6,
+               cursor:                  'wait'
+       },
+
+       // styles applied when using $.growlUI
+       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'
+       },
+
+       // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
+       // (hat tip to Jorge H. N. de Vasconcelos)
+       iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
+
+       // force usage of iframe in non-IE browsers (handy for blocking applets)
+       forceIframe: false,
+
+       // z-index for the blocking overlay
+       baseZ: 1000,
+
+       // set these to true to have the message automatically centered
+       centerX: true, // <-- only effects element blocking (page block controlled via css above)
+       centerY: true,
+
+       // allow body element to be stetched in ie6; this makes blocking look better
+       // on "short" pages.  disable if you wish to prevent changes to the body height
+       allowBodyStretch: true,
+
+       // enable if you want key and mouse events to be disabled for content that is blocked
+       bindEvents: true,
+
+       // be default blockUI will supress tab navigation from leaving blocking content
+       // (if bindEvents is true)
+       constrainTabKey: true,
+
+       // fadeIn time in millis; set to 0 to disable fadeIn on block
+       fadeIn:  200,
+
+       // fadeOut time in millis; set to 0 to disable fadeOut on unblock
+       fadeOut:  400,
+
+       // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
+       timeout: 0,
+
+       // disable if you don't want to show the overlay
+       showOverlay: true,
+
+       // if true, focus will be placed in the first available input field when
+       // page blocking
+       focusInput: true,
+
+       // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
+       applyPlatformOpacityRules: true,
+
+       // callback method invoked when fadeIn has completed and blocking message is visible
+       onBlock: null,
+
+       // callback method invoked when unblocking has completed; the callback is
+       // passed the element that has been unblocked (which is the window object for page
+       // blocks) and the options that were passed to the unblock call:
+       //       onUnblock(element, options)
+       onUnblock: null,
+
+       // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
+       quirksmodeOffsetHack: 4
+};
+
+// private data and functions follow...
+
+var pageBlock = null;
+var pageBlockEls = [];
+
+function install(el, opts) {
+       var full = (el == window);
+       var msg = opts && opts.message !== undefined ? opts.message : undefined;
+       opts = $.extend({}, $.blockUI.defaults, opts || {});
+       opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
+       var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
+       var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
+       msg = msg === undefined ? opts.message : msg;
+
+       // remove the current block (if there is one)
+       if (full && pageBlock)
+               remove(window, {fadeOut:0});
+
+       // if an existing element is being used as the blocking content then we capture
+       // its current place in the DOM (and current display style) so we can restore
+       // it when we unblock
+       if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
+               var node = msg.jquery ? msg[0] : msg;
+               var data = {};
+               $(el).data('blockUI.history', data);
+               data.el = node;
+               data.parent = node.parentNode;
+               data.display = node.style.display;
+               data.position = node.style.position;
+               if (data.parent)
+                       data.parent.removeChild(node);
+       }
+
+       var z = opts.baseZ;
+
+       // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
+       // layer1 is the iframe layer which is used to supress bleed through of underlying content
+       // layer2 is the overlay layer which has opacity and a wait cursor (by default)
+       // layer3 is the message content that is displayed while blocking
+
+       var lyr1 = ($.browser.msie || opts.forceIframe)
+               ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
+               : $('<div class="blockUI" style="display:none"></div>');
+       var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
+
+       var lyr3;
+       if (opts.theme && full) {
+               var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
+                                       '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
+                                       '<div class="ui-widget-content ui-dialog-content"></div>' +
+                               '</div>';
+               lyr3 = $(s);
+       }
+       else {
+               lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')
+                                       : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
+       }
+
+       // if we have a message, style it
+       if (msg) {
+               if (opts.theme) {
+                       lyr3.css(themedCSS);
+                       lyr3.addClass('ui-widget-content');
+               }
+               else
+                       lyr3.css(css);
+       }
+
+       // style the overlay
+       if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
+               lyr2.css(opts.overlayCSS);
+       lyr2.css('position', full ? 'fixed' : 'absolute');
+
+       // make iframe layer transparent in IE
+       if ($.browser.msie || opts.forceIframe)
+               lyr1.css('opacity',0.0);
+
+       //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
+       var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
+       $.each(layers, function() {
+               this.appendTo($par);
+       });
+
+       if (opts.theme && opts.draggable && $.fn.draggable) {
+               lyr3.draggable({
+                       handle: '.ui-dialog-titlebar',
+                       cancel: 'li'
+               });
+       }
+
+       // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+       var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+       if (ie6 || expr) {
+               // give body 100% height
+               if (full && opts.allowBodyStretch && $.boxModel)
+                       $('html,body').css('height','100%');
+
+               // fix ie6 issue when blocked element has a border width
+               if ((ie6 || !$.boxModel) && !full) {
+                       var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
+                       var fixT = t ? '(0 - '+t+')' : 0;
+                       var fixL = l ? '(0 - '+l+')' : 0;
+               }
+
+               // simulate fixed position
+               $.each([lyr1,lyr2,lyr3], function(i,o) {
+                       var s = o[0].style;
+                       s.position = 'absolute';
+                       if (i < 2) {
+                               full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
+                                        : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+                               full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+                                        : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+                               if (fixL) s.setExpression('left', fixL);
+                               if (fixT) s.setExpression('top', fixT);
+                       }
+                       else if (opts.centerY) {
+                               if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+                               s.marginTop = 0;
+                       }
+                       else if (!opts.centerY && full) {
+                               var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
+                               var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
+                               s.setExpression('top',expression);
+                       }
+               });
+       }
+
+       // show the message
+       if (msg) {
+               if (opts.theme)
+                       lyr3.find('.ui-widget-content').append(msg);
+               else
+                       lyr3.append(msg);
+               if (msg.jquery || msg.nodeType)
+                       $(msg).show();
+       }
+
+       if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
+               lyr1.show(); // opacity is zero
+       if (opts.fadeIn) {
+               var cb = opts.onBlock ? opts.onBlock : noOp;
+               var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
+               var cb2 = msg ? cb : noOp;
+               if (opts.showOverlay)
+                       lyr2._fadeIn(opts.fadeIn, cb1);
+               if (msg)
+                       lyr3._fadeIn(opts.fadeIn, cb2);
+       }
+       else {
+               if (opts.showOverlay)
+                       lyr2.show();
+               if (msg)
+                       lyr3.show();
+               if (opts.onBlock)
+                       opts.onBlock();
+       }
+
+       // bind key and mouse events
+       bind(1, el, opts);
+
+       if (full) {
+               pageBlock = lyr3[0];
+               pageBlockEls = $(':input:enabled:visible',pageBlock);
+               if (opts.focusInput)
+                       setTimeout(focus, 20);
+       }
+       else
+               center(lyr3[0], opts.centerX, opts.centerY);
+
+       if (opts.timeout) {
+               // auto-unblock
+               var to = setTimeout(function() {
+                       full ? $.unblockUI(opts) : $(el).unblock(opts);
+               }, opts.timeout);
+               $(el).data('blockUI.timeout', to);
+       }
+};
+
+// remove the block
+function remove(el, opts) {
+       var full = (el == window);
+       var $el = $(el);
+       var data = $el.data('blockUI.history');
+       var to = $el.data('blockUI.timeout');
+       if (to) {
+               clearTimeout(to);
+               $el.removeData('blockUI.timeout');
+       }
+       opts = $.extend({}, $.blockUI.defaults, opts || {});
+       bind(0, el, opts); // unbind events
+
+       var els;
+       if (full) // crazy selector to handle odd field errors in ie6/7
+               els = $('body').children().filter('.blockUI').add('body > .blockUI');
+       else
+               els = $('.blockUI', el);
+
+       if (full)
+               pageBlock = pageBlockEls = null;
+
+       if (opts.fadeOut) {
+               els.fadeOut(opts.fadeOut);
+               setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
+       }
+       else
+               reset(els, data, opts, el);
+};
+
+// move blocking element back into the DOM where it started
+function reset(els,data,opts,el) {
+       els.each(function(i,o) {
+               // remove via DOM calls so we don't lose event handlers
+               if (this.parentNode)
+                       this.parentNode.removeChild(this);
+       });
+
+       if (data && data.el) {
+               data.el.style.display = data.display;
+               data.el.style.position = data.position;
+               if (data.parent)
+                       data.parent.appendChild(data.el);
+               $(el).removeData('blockUI.history');
+       }
+
+       if (typeof opts.onUnblock == 'function')
+               opts.onUnblock(el,opts);
+};
+
+// bind/unbind the handler
+function bind(b, el, opts) {
+       var full = el == window, $el = $(el);
+
+       // don't bother unbinding if there is nothing to unbind
+       if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
+               return;
+       if (!full)
+               $el.data('blockUI.isBlocked', b);
+
+       // don't bind events when overlay is not in use or if bindEvents is false
+       if (!opts.bindEvents || (b && !opts.showOverlay))
+               return;
+
+       // bind anchors and inputs for mouse and key events
+       var events = 'mousedown mouseup keydown keypress';
+       b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
+
+// former impl...
+//        var $e = $('a,:input');
+//        b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
+};
+
+// event handler to suppress keyboard/mouse events when blocking
+function handler(e) {
+       // allow tab navigation (conditionally)
+       if (e.keyCode && e.keyCode == 9) {
+               if (pageBlock && e.data.constrainTabKey) {
+                       var els = pageBlockEls;
+                       var fwd = !e.shiftKey && e.target == els[els.length-1];
+                       var back = e.shiftKey && e.target == els[0];
+                       if (fwd || back) {
+                               setTimeout(function(){focus(back)},10);
+                               return false;
+                       }
+               }
+       }
+       // allow events within the message content
+       if ($(e.target).parents('div.blockMsg').length > 0)
+               return true;
+
+       // allow events for content that is not being blocked
+       return $(e.target).parents().children().filter('div.blockUI').length == 0;
+};
+
+function focus(back) {
+       if (!pageBlockEls)
+               return;
+       var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
+       if (e)
+               e.focus();
+};
+
+function center(el, x, y) {
+       var p = el.parentNode, s = el.style;
+       var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
+       var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
+       if (x) s.left = l > 0 ? (l+'px') : '0';
+       if (y) s.top  = t > 0 ? (t+'px') : '0';
+};
+
+function sz(el, p) {
+       return parseInt($.css(el,p))||0;
+};
+
 })(jQuery);
\ No newline at end of file