text: !function(a){return a.dialog=function(b){var d,e,f,g,h,i,j,l,m,n,o,p,k,q,r,s;b=a.extend({title:"",width:500,height:300,left:!1,top:!1,html:"",mask:!0,drag:!0,close:!0,callback:function(){}},b);try{a("#dialog-layout").fadeOut("fast",function(){a("#dialog-mask").remove(),a(this).empty().remove()})}catch(c){}b.mask&&(d=a("<div />"),d.attr("id","dialog-mask"),d.addClass("dialog-mask"),d.css({top:0,left:0,width:a(document).width()+"px",height:a(document).height()+"px"}),a(document.body).append(d)),e=a("<div />"),e.attr("id","dialog-layout"),e.addClass("dialog-layout"),e.css({top:(a(window).height()-b.height)/2+a(document).scrollTop()+"px",left:(a(document).width()-b.width)/2+"px",width:b.width+"px",height:"auto"==b.height?100:b.height+"px"}),a(document.body).append(e),f=a("<div />"),f.attr("id","dialog-content"),f.addClass("dialog-content"),f.width(b.width),f.height(b.height),f.appendTo(e),g=a("<div />"),g.addClass("dialog-title"),g.appendTo(f),g.html(b.title).wrapInner("<span />"),b.close&&(h=a('<a href="javascript:void(0)" id="dialog-close">x</a>'),h.addClass("dialog-close"),h.appendTo(f),h.bind("click",function(){a("#dialog-layout").addClass("dialog-layout-close"),setTimeout(function(){a("#dialog-mask").remove(),a("#dialog-layout").empty().remove()},1e3)})),i=a("<div />"),i.addClass("dialog-html"),i.appendTo(f),i.html(b.html),f.append(i),e.fadeIn("fast",function(){e.addClass("dialog-layout-animate")}),e.css({height:"auto"==b.height?i.innerHeight():b.height+"px"}),e.css({top:(a(window).height()-("auto"==b.height?i.innerHeight():b.height))/2+a(document).scrollTop()+"px"}),b.callback(),b.drag&&(j="ontouchstart"in window,k=!1,q=a(window).width()-b.width,r=a(window).height()-i.innerHeight(),a(window).resize(function(){q=a(window).width()-b.width,r=a(window).height()-i.innerHeight()}),s={start:function(c){var d,f;return k=!0,d=e.offset(),j?(f=c.originalEvent.changedTouches[0],a("#test").html(d.left),l=f.pageX-d.left,m=f.pageY-d.top):(c=c||window.event,l=c.pageX-d.left,m=c.pageY-d.top),g.css("cursor","move"),p=a("<div />"),p.css({position:"absolute",top:d.top+"px",left:d.left+"px",width:b.width+"px",height:"auto"==b.height?i.innerHeight():b.height+"px",border:"1px dotted #ddd",opacity:.8,background:"#efefef",zIndex:9999999999999}),a(document.body).append(p),!1},move:function(a){var b;return k?(j?(b=a.originalEvent.changedTouches[0],n=b.pageX-l,o=b.pageY-m):(a=a=a||window.event,n=a.pageX-l,o=a.pageY-m),0>n&&(n=0),0>o&&(o=0),n>q&&(n=q),o>r&&(o=r),p.css({left:n+"px",top:o+"px",cursor:"move"}),!1):void 0},end:function(){k=!1,e.css({left:n+"px",top:o+"px"}),p.remove(),g.css("cursor","default")}},j?(g.on("touchstart",s.start),a(window).on("touchmove",s.move),a(window).on("touchend",s.end)):(g.on("mousedown",s.start),a(document).on("mousemove",s.move),a(document).on("mouseup",s.end)))},a.dialogClose=function(){a("#dialog-layout").fadeOut("slow",function(){a("#dialog-mask").remove(),a(this).removeClass("dialog-layout-animate").empty().remove()})},this}(jQuery);