(function(h){var l,k,g,e,j=false,c,f,i,a,d={dgId:"dialog",dgInitialWidth:10,dgInitialHeight:10,dgWidth:350,dgHeight:200,dgTitle:"",dgContent:"",dgMinWidth:250,dgMinHeight:150,dgDuration:300},b={init:function(m){return this.each(function(){if(m){a=h.extend(d,m)}c=h(this).offset().left;topTrigger=h(this).offset().top;if(h("#"+a.dgId).get()){h("#"+a.dgId).remove()}i="";i+='<div id = "'+a.dgId+'"><div id = "'+a.dgId+'Header">'+a.dgTitle+'</div><p id="closeButton"><a href="#"><span class="hide">close</span></a></p><div id = "'+a.dgId+'Content"></div><div id = "'+a.dgId+'Footer"><a id="okButton" href="#">OK</a></div><p id="resizeButton"><a href="#"><span class="hide">resize</span></a></p></div>';h(i).prependTo("body");a.dgContent.prependTo(h("#"+a.dgId+"Content"));var n=h("#"+a.dgId);n.css({left:c+"px",top:topTrigger+"px",width:a.dgInitialWidth+"px",height:a.dgInitialHeight+"px",display:"none"});n.animate({left:Math.round((h(window).width()-a.dgWidth)/2),top:Math.round((h(window).height()-a.dgHeight)/2),width:a.dgWidth+"px",height:a.dgHeight+"px",opacity:"show"},{duration:a.dgDuration,easing:"linear"}).draggable().draggable("disable");h("p#closeButton a, a#okButton").bind("click",function(o){o.stopPropagation();n.animate({left:c+"px",top:topTrigger+"px",width:a.dgInitialWidth+"px",height:a.dgInitialHeight+"px",opacity:"hide"},{duration:a.dgDuration,easing:"linear"})});h("#"+a.dgId+"Header").bind("mouseenter",function(){h("#"+a.dgId).draggable("enable")});h("#"+a.dgId+"Header").bind("mouseleave",function(){h("#"+a.dgId).draggable("disable")});h("p#resizeButton a").bind("mousedown",function(o){l=o.pageX;k=o.pageY;j=true;h("body").bind("mousemove",function(p){ePageX=p.pageX;ePageY=p.pageY;g=ePageX-l;e=ePageY-k;l=ePageX;k=ePageY;n.css({width:Math.max(n.width()+g,a.dgMinWidth),height:Math.max(n.height()+e,a.dgMinHeight)});return false});return false});h("body").bind("mouseup",function(o){j=false;h("body").unbind("mousemove")})})}};h.fn.easyDialog=function(m){if(b[m]){return b[m].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof m==="object"||!m){return b.init.apply(this,arguments)}else{h.error("Method "+m+" does not exist on jQuery.tooltip")}}}})(jQuery);
