var delwid = ''; $("#document").ready(function() { $('body').append(''); $("#hutcms_cpopen").click(hutcms_cp_toggle); $("#hutcms_cpwrapper a").tooltip({showURL:false}); $("#hutcms_add_content").dialog( {modal:true, autoOpen:false, position:'center', width:300}); $("#hutcms_add_content_button").click(hutcms_modal_open); $(".hutcms_wedit_delete").click(function() { delwid = $(this).attr('wid'); $("#warning").dialog('destroy'); $("#warning").text('Content block will be removed - are you sure?'); $("#warning").dialog({ width:400, modal:true, buttons: { Cancel: function(){ $("#warning").dialog('destroy'); }, Yes: function(){ window.location = delwid; } } }); return false; }); }); function hutcms_cp_toggle() { if ($("#hutcms_control").html() == "") { $("#hutcms_control").load( "http://lifetouch.ca/ajax/controller/get_panel", function() { $("#hutcms_control").slideDown('slow'); }); } else { $("#hutcms_control").slideUp('slow', function() { $("#hutcms_control").empty(); }); } } function hutcms_modal_open() { $("#hutcms_add_content").dialog("open"); } function hutcms_page_reparent() { $("#hutcms_control").load( "http://lifetouch.ca/ajax/controller/select_page", hutcms_modal_open); } // used in modules' mod_edit files function hutcms_open_dialog(title, url) { $("#record") .dialog("destroy") .remove(); $("body").append("
"); $("#record") .dialog({ modal: true, width: 850, position: "top", autoOpen: false, beforeclose: function(event, ui) { try { if (typeof tinyMCE != "undefined") // tinymce.moxiecode.com/punbb/viewtopic.php?pid=22373#p22373 // for (instanceIndex in tinyMCE.instances) // if (tinyMCE.isInstance(tinyMCE.instances[instanceIndex])) // tinyMCE.removeInstance(tinyMCE.instances[instanceIndex]); // tinymce.moxiecode.com/punbb/viewtopic.php?pid=41536#p41536 for (editorId in tinyMCE.editors) tinyMCE.execCommand('mceRemoveControl', false, editorId); } catch(err) {} } }) .load(url) .dialog("open") .parent().css("z-index", "20007"); // this is getting out of hand return false; }