var pwModalWindows=[];function pwModalWindowSettings(name){var modal=ProcessWire.config.modals[name];if(typeof modal=="undefined")modal=ProcessWire.config.modals["medium"];modal=modal.split(",");var options={modal:true,draggable:false,resizable:true,hide:250,show:100,hideOverflow:true,closeOnEscape:false};if(modal.length>=4){for(var n=4;n").find(".ui-icon").remove();if(frameElement){if(typeof parent.jQuery!=="undefined"){if(parent.jQuery(".ui-dialog").length){parent.jQuery(".ui-dialog .ui-button").addClass("pw-modal-hidden").hide();parent.jQuery(".ui-dialog-buttonpane").css("margin-top","-10px");jQuery("body").css("overflow","hidden")}}else{if(parent.document.querySelector(".ui-dialog")){var parentButtons=parent.document.querySelectorAll(".ui-dialog .ui-button");var i;for(i=0;i0){url=href}else{url=href+(href.indexOf("?")>-1?"&":"?")+"modal=1"}$iframe=jQuery('');$iframe.attr("id","pw-modal-window-"+(pwModalWindows.length+1));pwModalWindows[pwModalWindows.length]=$iframe;if(typeof size=="undefined"||size.length==0)size="large";var settings=pwModalWindowSettings(size);if(settings==null){alert("Unknown modal setting: "+size);return $iframe}if(typeof options!="undefined")jQuery.extend(settings,options);$iframe.on("dialogopen",function(event,ui){jQuery(document).trigger("pw-modal-opened",{event:event,ui:ui})});$iframe.on("dialogclose",function(event,ui){jQuery(document).trigger("pw-modal-closed",{event:event,ui:ui})});$iframe.dialog(settings);$iframe.data("settings",settings);$iframe.on("load",function(){if(typeof settings.title=="undefined"||!settings.title){var title=jQuery("