tinyMCE.importPluginLanguagePack('magnify_publisher');function makeOpaque(bool,url){var hh=document.getElementsByTagName('head')[0];var removeOpacity=document.getElementById('removeOpacity');if(bool){var ss=document.createElement('style');ss.id="removeOpacity";var def='html, body, div, span, applet, object, iframe, '+'h1, h2, h3, h4, h5, h6, p, blockquote, pre, '+'a, abbr, acronym, address, big, cite, code, '+'del, dfn, em, font, img, ins, kbd, q, s, samp, '+'small, strike, strong, sub, sup, tt, var, '+'dl, dt, dd, ol, ul, li, '+'fieldset, form, label, legend, '+'table, caption, tbody, tfoot, thead, tr, th, td, '+'.defaultSkin .mceButtonDisabled .icon, .wp_themeSkin .mceButtonDisabled .mceIcon { opacity: 1.0; filter: alpha(opacity=100); } ';if(navigator.product=='Gecko'){def=def+'div.clearlooks2_modalBlocker { background: url('+url+'/img/white_alpha_60.png); opacity: 1.0; filter: alpha(opacity=100); }'}ss.setAttribute("type","text/css");if(ss.styleSheet){ss.styleSheet.cssText=def}else{var tt=document.createTextNode(def);ss.appendChild(tt)}hh.appendChild(ss)}else{if(removeOpacity){hh.removeChild(removeOpacity)}}}var TinyMCE_MagnifyPublisher={getInfo:function(){return{longname:'Magnify Publisher plugin for tinyMCE 2.*',author:'Magnify.net',authorurl:'http://www.magnify.net',infourl:'http://www.magnify.net',version:"1.0"}},getControlHTML:function(cn){switch(cn){case"magnify_publisher":return tinyMCE.getButtonHTML(cn,'lang_magnify_publisher_desc','{$pluginurl}/images/publisher_icon.gif','mceMagnifyPublisher',true,'{$pluginurl}')}return""},execCommand:function(editor_id,element,command,user_interface,value){var mce_publisher_url=value;makeOpaque(true,mce_publisher_url);var prefix=window.location.protocol+'//'+window.location.hostname;var host_regex=new RegExp(prefix,"i");if(host_regex.test(mce_publisher_url)){prefix=""}switch(command){case"mceMagnifyPublisher":if(user_interface){var magnify_publisher=new Array();magnify_publisher['file']=mce_publisher_url+'/publisher.html',magnify_publisher['width']=650;magnify_publisher['height']=550;tinyMCE.openWindow(magnify_publisher,{editor_id:editor_id,plugin_url:mce_publisher_url,magnify_publisher_url:tinyMCE.getParam('magnify_publisher_url'),magnify_publisher_target:tinyMCE.getParam('magnify_publisher_target','tinymce2'),magnify_publisher_iframe:'<iframe width="650" height="550" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" id="mvp_publisher_iframe" src="'+tinyMCE.getParam('magnify_publisher_url')+'/embed/publisher?application='+tinyMCE.getParam('magnify_publisher_target','tinymce2')+'&callback_type=GetFrame&amp;callback='+prefix+mce_publisher_url+'/embed.html'+'"></iframe>'});tinyMCE.triggerNodeChange(false)}return true}return false},cleanup:function(type,content,inst){var t=this;var newContent;switch(type){case"get_from_editor":var imgRegex=/(<img [^>]*?)\brel="([^">]*?iframe[^">]+?)"([^>]*?>)/ig;if(content){newContent=content.replace(imgRegex,t._convert_to_iframe);content=newContent}break;case"insert_to_editor":var iframeRegex=/(<iframe [^>]*?)\brel="([^">]*?img[^">]+?)"([^>]*?(?:\/>|>\s*<\/iframe>))/ig;if(content){newContent=content.replace(iframeRegex,t._convert_to_img);content=newContent}break}return content},_convert_to_iframe:function(input,m1,m2,m3){var iframe=decodeURIComponent(m2);var placeholder=encodeURIComponent(m1+m3);var newIframe=iframe.replace(/(<iframe)/i,"$1"+" rel=\""+placeholder+"\"");return newIframe},_convert_to_img:function(input,m1,m2,m3){var image=decodeURIComponent(m2);var placeholder=encodeURIComponent(m1+m3);var newImg=image.replace(/([<]img)/i,"$1"+" rel=\""+placeholder+"\"");return newImg}};tinyMCE.addPlugin("magnify_publisher",TinyMCE_MagnifyPublisher);