jQuery(function(c){var b={width:300,autoOpen:false,draggable:false,resizable:false,closeOnEscape:false,show:"fade",open:function(){var d=c(this).parent();d.find(".ui-dialog-buttonpane .ui-state-focus").removeClass("ui-state-focus");d.find(".ui-dialog-buttonpane button[icon]").each(function(){var f=c(this),e=f.attr("icon");f.removeAttr("icon").removeClass("ui-button-text-only").addClass("ui-button-text-icon-primary ui-button-text-icon").prepend('<span class="ui-button-icon-primary ui-icon '+e+'"></span>')})}},a={cache:true};c(".jqUIDialog").livequery(function(){var f=c(this),e=c.extend({},b,f.metadata()),d=[];if(f.data("autoOpen")){e.autoOpen=true}f.find(".jqUIDialogButton").each(function(){var i=c(this),h={},g=i.attr("href");h.text=i.text();if(typeof(g)!=="undefined"){h.click=function(){window.location.href=g}}if(i.is(".jqUIDialogClose")){h.click=function(){c(this).dialog("close")}}if(i.is(".jqUIDialogSubmit")){h.click=function(){c(this).find("form:first").submit()}}d.push(c.extend(h,i.metadata()))}).remove();if(d.length){e.buttons=d}if(e.autoCenter){c(window).bind("resize",function(){f.dialog("option","position","center")});e.draggable=false}f.removeClass("jqUIDialog").dialog(e)});c(".jqUIDialogLink").live("click",function(){var f=c(this),d=f.attr("href"),e=c.extend({},a,f.metadata());if(d.match(/^https?:/)){c.get(d,function(h){var g=c(h),i=g.attr("id");if(!i){i="dialog-"+foswiki.getUniqueID();g.attr("id",i)}if(e.cache){f.attr("href","#"+i)}g.hide();c("body").append(g);g.data("autoOpen",true)})}else{c(d).dialog("open")}return false})});