(function(a){a.browser.ie6=a.browser.msie&&parseInt(a.browser.version)<7;var k=window.setTimeout;window.setTimeout=function(b,c){if(typeof b=="function"){var d=Array.prototype.slice.call(arguments,2),e=function(){b.apply(null,d)};return k(e,c)}return k(b,c)};jQuery.extend({overlay:function(b){return a().overlay(b)},layer:function(b,c,d){return a().layer(b,c,d)},lock:function(b,c,d){return a().lock(b,c,d)},msg:function(b,c,d){return a().msg(b,c,d)},quickMsg:function(b,c,d){return a().quickMsg(b,c,
d)},alert:function(b,c,d){return a().alert(b,c,d)},confirm:function(b,c,d,e){return a().confirm(b,c,d,e)},confirms:function(b,c,d,e,f){return a().confirms(b,c,d,e,f)},window:function(b,c){return a().window(b,c)},tip:function(b,c){return a().tip(b,c)},dialog:function(b,c,d){return a().dialog(b,c,d)},loadingMsg:function(b){return a().loadingMsg(b)}});a.overlay.settings={backgroundColor:"#fff",opacity:0.45};a.overlay.resizeHandler=function(){};a.layer.cache=null;a.layer.timer=null;a.layer.resizeHandler=
function(){};a.dialog.callback=function(){};jQuery.fn.createIframe=function(b,c){if(!a.browser.ie6)return this;var d=this[0]==document,e=typeof c;if(e=="number")c={opacity:c};else if(e=="string")c={backgroundColor:c};c=a.extend({},a.overlay.settings,c||{});e=a("#"+b);if(e.length)e.appendTo(d?document.body:this);else{e='<iframe id="'+b+'" name="'+b+'" style="border:0;padding:0;margin:0;overflow:hidden;z-index:1000" frameborder="0" scrolling="no" src="about:blank"></iframe>';e=a(e).appendTo(d?document.body:
this);window.frames[b].document.write("<body></body>");window.frames[b].document.close()}e.css("opacity",c.opacity);window.frames[b].document.body.style.backgroundColor=c.backgroundColor;return this};jQuery.fn.overlay=function(b){var c=this[0]==document;if(b===false){a("#jqOverlay").length&&a("#jqOverlay").remove();return this}var d=typeof b;if(d=="number")b={opacity:b};else if(d=="string")b={backgroundColor:b};b=a.extend({},a.overlay.settings,b||{});!c&&this.css("position")=="static"&&this.css("position",
"relative");if(c&&!a.browser.ie6){d={backgroundColor:b.backgroundColor,opacity:b.opacity,width:"100%",height:"100%",position:"fixed",zIndex:1E3,left:0,top:0,drag:false};var e=a("#jqOverlay");e.length||(e=a('<div id="jqOverlay" class="jqOverlay"></div>'));e.appendTo(document.body).css(d);return this}var f,g,i;if(c){var h=document.documentElement;d=h.scrollWidth;f=Math.max(h.scrollHeight,h.clientHeight);i=g=0}else{d=this[0].offsetWidth;f=this[0].offsetHeight;g=-parseInt(this[0].style.borderLeftWidth||
0);i=-parseInt(this[0].style.borderTopWidth||0)}d={display:"block",backgroundColor:b.backgroundColor,opacity:b.opacity,width:d,height:f,position:"absolute",zIndex:1E3,left:g,top:i};e=a("#jqOverlay");if(e.length)if(a.browser.ie6){a(c?document.body:this).createIframe("jqOverlay",{opacity:b.opacity,backgroundColor:b.backgroundColor});e.css(d)}else e.appendTo(c?document.body:this).css(d);else if(a.browser.ie6){a(c?document.body:this).createIframe("jqOverlay",{opacity:b.opacity,backgroundColor:b.backgroundColor});
e=a("#jqOverlay").addClass("jqOverlay").css(d)}else e=a('<div id="jqOverlay" class="jqOverlay"></div>').appendTo(c?document.body:this).css(d);if(c){a(window).unbind("resize",a.overlay.resizeHandler);a.overlay.resizeHandler=function(){h=document.documentElement;setTimeout(function(){e.css({width:h.scrollWidth,height:Math.max(h.scrollHeight,h.clientHeight)})},0)};a(window).bind("resize",a.overlay.resizeHandler)}return this};a.fn.layer=function(b,c,d){if(!a.isFunction(c)&&d!==null){d=c;c=function(){}}if(typeof d==
"number")d={speed:d};var e={speed:0,minWidth:null,maxWidth:null};a.extend(e,d||{});d=this[0]==document;!d&&this.css("position")=="static"&&this.css("position","relative");clearTimeout(a.layer.timer);a("#jqMsg").length&&a("#jqMsg").remove();if(a.layer.cache){a.layer.cache.appendTo(document.body);a.layer.cache=null}if(typeof b=="string")b=a('<div id="jqMsg" class="clearfix" style="display:none">'+b+"</div>").appendTo(d?document.body:this);else{b=a("#"+b.attr("id")).css("float","left");a.layer.cache=
b.clone();b=b.appendTo(d?document.body:this).wrap('<div id="jqMsg" class="clearfix" style="display:none"></div>').show().parent()}b.css({position:!d||a.browser.ie6?"absolute":"fixed",zIndex:1001,opacity:0.01,display:"block","float":"left",left:0,top:0});var f=b.get(0).clientWidth;if(e.minWidth&&f<parseInt(e.minWidth))f=parseInt(e.minWidth);if(e.maxWidth&&f>parseInt(e.maxWidth))f=parseInt(e.maxWidth);b.css("width",f+"px");a.browser.msie&&b.find("h2").css("zoom",1);var g,i,h,j;if(b.css("position")==
"fixed"){a(window).unbind("resize",a.layer.resizeHandler);a.layer.resizeHandler=function(m){g=b[0].offsetWidth;i=b[0].offsetHeight;var l=document.documentElement;h=(l.clientWidth-g)/2;j=(l.clientHeight-i)/2;m?b.css({left:h,top:j}):b.animate({left:h,top:j})};a.layer.resizeHandler(1);a(window).bind("resize",a.layer.resizeHandler)}else if(d){b[0].style.setExpression("left","document.documentElement.scrollLeft + parseInt((document.documentElement.clientWidth-this.offsetWidth)/2)");b[0].style.setExpression("top",
"document.documentElement.scrollTop + parseInt((document.documentElement.clientHeight - this.offsetHeight)/2)")}else{g=b[0].offsetWidth;i=b[0].offsetHeight;h=parseInt((this[0].offsetWidth-g)/2)-parseInt(this[0].style.borderLeftWidth||0);j=parseInt((this[0].offsetHeight-i)/2)-parseInt(this[0].style.borderTopWidth||0);b.css({left:h,top:j})}b.css("opacity",1);if(e.speed)b.hide().fadeIn(e.speed,a.isFunction(c)?c:function(){});else{b.show();a.isFunction(c)&&c.call(b)}return this};a.fn.lock=function(b,
c,d){if(!a.isFunction(c)&&c!==null){d=c;c=function(){}}if(typeof d=="number")d={speed:d};var e={speed:0,minWidth:null,maxWidth:null,backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity};a.extend(e,d||{});return this.overlay({backgroundColor:e.backgroundColor,opacity:e.opacity}).layer(b,c,e)};a.unlock=function(b,c){if(typeof c!="number")c=typeof b=="number"?b:0;a.isFunction(b)||(b=function(){});var d=a("#jqMsg");if(d.length){var e=a.layer.cache?function(){a.layer.cache.appendTo(document.body);
a.layer.cache=null;d.remove();a("#jqOverlay").length&&a("#jqOverlay").remove();b&&b.call()}:function(){d.remove();a("#jqOverlay").length&&a("#jqOverlay").remove();b&&b.call()};c?d.fadeOut(c,e):e()}else a("#jqOverlay").length&&a("#jqOverlay").remove()};a.fn.tip=function(b,c){var d=this[0]==document;if(typeof c=="number")c={timeout:c};var e={timeout:3E3,speed1:200,speed2:300,opacity:1};a.extend(e,c||{});!d&&this.css("position")=="static"&&this.css("position","relative");c=a("#jqTips");if(c.length&&
!a("#jqTips div").length)c.remove().length=0;if(!c.length){c=a('<div id="jqTips"></div>').appendTo(d?document.body:this).css({position:d&&!a.browser.ie6?"fixed":"absolute",zIndex:1002,right:"2px",top:0});d&&a.browser.ie6&&c[0].style.setExpression("top","parseInt(document.documentElement.scrollTop)")}a('<div class="jqTip">'+b+"</div>").appendTo(c).css({"float":"right",clear:"both"}).fadeIn(e.speed1,function(){var f=this;setTimeout(function(){a(f).animate({height:"hide",opacity:"hide"},e.speed2,function(){a(this).remove()})},
e.timeout)});return this};a.fn.autoTip=function(b,c){this.width()<350||this.height()<200?a.tip(b,c):this.tip(b,c);return this};a.fn.msg=function(b,c,d){if(!a.isFunction(c)&&c!==null){d=c;c=function(){}}if(typeof d=="number")d={speed:d};var e={speed:100,minWidth:null,maxWidth:null,backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity};a.extend(e,d||{});this.lock('<div class="jqMsg">'+b+"</div>",c,e);return this};a.fn.quickMsg=function(b,c,d){if(!a.isFunction(c)&&c!==
null){d=c;c=function(){}}if(typeof d=="number")d={timeout:d};var e={timeout:500,speed1:100,speed2:300,backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity,minWidth:null,maxWidth:null};a.extend(e,d||{});this.msg(b,null,{speed:e.speed1,minWidth:e.minWidth,maxWidth:e.maxWidth,backgroundColor:e.backgroundColor,opacity:e.opacity});a.layer.timer=setTimeout(a.unlock,e.timeout,c,e.speed2);return this};a.fn.loadingMsg=function(b){b||(b="Loading...");return this.msg('<div class="jqLoading">'+
b+"</div>")};a.fn.alert=function(b,c,d){var e={speed1:200,speed2:200,backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity,title:"Notice",submit:"Ok",focus:true,minWidth:"220px",maxWidth:"480px",drag:true};a.extend(e,d||{});this.lock('<div class="jqAlert"><div class="jqTopic"><a href="" class="jqClose">close</a><h2>'+e.title+'</h2></div><div class="jqBox"><div class="jqContent">'+b+'</div><div class="jqBtns"><button type="button" class="jqSubmit">'+e.submit+"</button></div></div></div>",
function(){e.focus&&a("#jqMsg button").focus()},{speed:e.speed1,minWidth:e.minWidth,maxWidth:e.maxWidth,backgroundColor:e.backgroundColor,opacity:e.opacity});a("#jqMsg a.jqClose").focus(function(){this.blur()}).click(function(){a.unlock(c);return false});a("#jqMsg button").click(function(){a.unlock(c,e.speed2)});return this};a.fn.confirm=function(b,c,d,e){var f={speed1:200,speed2:200,backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity,title:"Notice",submit:"Ok",cancel:"Cancel",
focus:"cancel",minWidth:"220px",maxWidth:"480px",drag:true};a.extend(f,e||{});this.lock('<div class="jqConfirm"><div class="jqTopic"><a href="" class="jqClose">close</a><h2>'+f.title+'</h2></div><div class="jqBox"><div class="jqContent">'+b+'</div><div class="jqBtns"><button type="button" class="jqSubmit">'+f.submit+'</button> <button type="button" class="jqCancel">'+f.cancel+"</button></div></div></div>",function(){if(f.focus=="cancel")a("#jqMsg button.jqCancel").focus();else f.focus=="submit"&&
a("#jqMsg button.jqSubmit").focus()},{speed:f.speed1,minWidth:f.minWidth,maxWidth:f.maxWidth,backgroundColor:f.backgroundColor,opacity:f.opacity,drag:f.drag});a("#jqMsg a.jqClose").focus(function(){this.blur()}).click(function(){a.unlock(d);return false});a("#jqMsg button.jqCancel").click(function(){a.unlock(d,f.speed2)});a("#jqMsg button.jqSubmit").click(function(){a.unlock(c,f.speed2)});return this};a.fn.confirms=function(b,c,d,e,f){var g={speed1:200,speed2:200,backgroundColor:a.overlay.settings.backgroundColor,
opacity:a.overlay.settings.opacity,title:"Notice",yes:"Yes",no:"No",cancel:"Cancel",focus:"cancel",minWidth:"250px",maxWidth:"550px",drag:true};a.extend(g,f||{});this.lock('<div class="jqConfirms"><div class="jqTopic"><a href="" class="jqClose">close</a><h2>'+g.title+'</h2></div><div class="jqBox"><div class="jqContent">'+b+'</div><div class="jqBtns"><button type="button" class="jqYes">'+g.yes+'</button> <button type="button" class="jqNo">'+g.no+'</button> <button type="button" class="jqCancel">'+
g.cancel+"</button></div></div></div>",function(){if(g.focus=="yes")a("#jqMsg button.jqYes").focus();else if(g.focus=="no")a("#jqMsg button.jqNo").focus();else g.focus=="cancel"&&a("#jqMsg button.jqCancel").focus()},{speed:g.speed1,minWidth:g.minWidth,maxWidth:g.maxWidth,backgroundColor:g.backgroundColor,opacity:g.opacity});a("#jqMsg a.jqClose").focus(function(){this.blur()}).click(function(){a.unlock(e);return false});a("#jqMsg button.jqCancel").click(function(){a.unlock(e,g.speed2)});a("#jqMsg button.jqYes").click(function(){a.unlock(c,
g.speed2)});a("#jqMsg button.jqNo").click(function(){a.unlock(d,g.speed2)});return this};a.fn.window=function(b,c){var d={speed:200,title:"",backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity,minWidth:"220px",maxWidth:null,maxHeight:null,drag:true};if(typeof c=="string")c={title:c};a.extend(d,c||{});if(a.className.has(b[0],"jqContent")){a.browser.msie&&d.maxHeight&&b.cutInner().cutInner();p=b.parent().parent();p.find("div.jqTopic h2").html(d.title+"&nbsp;")}else p=
b.addClass("jqContent").wrap('<div class="jqBox"></div>').show().parent().wrap('<div class="jqWindow"></div>').parent().attr("id","jq"+a.uid()).prepend('<div class="jqTopic"><a href="" class="jqClose">close</a><h2>'+d.title+"&nbsp;</h2></div>").hide();if(d.maxHeight){if(a.browser.msie)b=a(b.wrapInner('<div class="jqInner"><div class="jqInner2"></div></div>').get(0).firstChild);b.css("overflow","auto");if(a.browser.msie){p.show();b.css("zoom",1);if(b[0].clientHeight>parseInt(d.maxHeight)){b.css({height:d.maxHeight,
width:b[0].clientWidth});a(b[0].firstChild).css({width:parseInt(b[0].clientWidth)-17+"px"})}p.hide()}else b.css("maxHeight",d.maxHeight)}this.lock(p,d);p.find("a.jqClose").focus(function(){this.blur()}).click(function(){a.unlock();return false});a.browser.msie&&p.find("h2").css("zoom",1);return this};a.fn.dialog=function(b,c,d){var e={speed:0,title:"",width:"500px",height:"350px",backgroundColor:a.overlay.settings.backgroundColor,opacity:a.overlay.settings.opacity,name:"",scroll:false,drag:true};
a.extend(e,c||{});b='<div class="jqDialog"><div class="jqTopic"><a href="" class="jqClose">close</a><h2>'+e.title+'&nbsp;</h2></div><div class="jqBox"><div class="jqContent"><iframe src="'+b+'" scrolling="'+(e.scroll?"yes":"no")+'" frameborder="0" class="jqIframe"'+(e.name?' id="'+e.name+'" name="'+e.name+'"':"")+' style="display:block; margin:0; border:0; width:'+e.width+"; height:"+e.height+'; margin:0; padding:0"></iframe></div></div></div>';this.lock(b,{speed:e.speed,minWidth:null,maxWidth:null,
backgroundColor:e.backgroundColor,opacity:e.opacity});e=a("#jqMsg");e.find("a.jqClose").focus(function(){this.blur()}).click(function(){a.unlock();return false});a.browser.msie&&e.find("h2").css("zoom",1);a.dialog.callback=a.isFunction(d)?d:function(){};return this};a(document.body).keydown(function(b){if(b.keyCode==27){b=a("#jqMsg a.jqClose");b.length&&b.click()}})})(jQuery);
