/**
 * Copyright (c) 2009 Sergiy Kovalchuk (serg472@gmail.com)
 * 
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *  
 * Following code is based on Element.mask() implementation from ExtJS framework (http://extjs.com/)
 *
 */
(function(a){a.fn.mask=function(c){this.unmask();if(this.css("position")=="static"){this.addClass("masked-relative")}this.addClass("masked");var f=a('<div class="loadmask"></div>');var d=navigator.userAgent.toLowerCase();var h=document.compatMode=="CSS1Compat";var e=d.indexOf("msie")>-1;var g=d.indexOf("msie 7");if(e&&!(g&&h)&&this.css("height")=="auto"){f.height(this.height());f.width(this.width())}this.append(f);if(typeof c=="string"){var b=a('<div class="loadmask-msg" style="display:none;"></div>');b.append("<div>"+c+"</div>");this.append(b);b.css("top",Math.round(this.height()/2-b.height()/2)+"px");b.css("left",Math.round(this.width()/2-b.width()/2)+"px");b.show()}};a.fn.unmask=function(b){this.find(".loadmask-msg,.loadmask").remove();this.removeClass("masked");this.removeClass("masked-relative")}})(jQuery);