File: D:/HostingSpaces/RMourik/bassol.nl/CMS/CMSAdminControls/CKeditor/plugins/CMSPlugins/plugin.js
var CMSPlugin={window:this.window,requires:["iframedialog","fakeobjects"],currentEditor:null,lang:["en"],regNumber:/^\d+(?:\.\d+)?$/,regFlashFilename:/\.swf(?:$|\?)/i,selection:null,selectedElement:null,selectionBookmarks:null,cssifyLength:function(e){return CMSPlugin.regNumber.test(e)?e+"px":e},createFakeControl:function(e,t){if(null!==e){var i,n=null,a=e.attributes.type.toLowerCase();switch(a){case"youtubevideo":n=t.createFakeParserElement(e,"cke_youtube","object",!0),n.attributes.cms_youtube="true",n.attributes.cms_disable_media="true";break;case"flash":case"media":var r=this.getMediaType(e,t);"flash"===r||"flash"===a?(n=t.createFakeParserElement(e,"cke_flash","object",!0),n.attributes.cms_media="true"):(n=t.createFakeParserElement(e,"cke_media","object",!0),n.attributes.cms_media="true");break;case"mediafilecontrol":n=t.createFakeParserElement(e,"cke_old_media","object",!0),n.attributes.cms_media="true";break;case"image":e.attributes.width&&parseInt(e.attributes.width,10)>0&&e.attributes.height&&parseInt(e.attributes.height,10)>0||(i=this.getElementObject(e),i&&((!e.attributes.width||parseInt(e.attributes.width,10)<=0)&&(!e.attributes.height||parseInt(e.attributes.height,10)<=0)?(e.attributes.width=i.originalwidth,e.attributes.height=i.originalheight):!e.attributes.height||parseInt(e.attributes.height,10)<=0?e.attributes.height=Math.round(e.attributes.width/(parseFloat(i.originalwidth)/i.originalheight)):(!e.attributes.width||parseInt(e.attributes.width,10)<=0)&&(e.attributes.width=Math.round(e.attributes.height/(parseFloat(i.originalheight)/i.originalwidth))))),n=t.createFakeParserElement(e,"cke_image","object",!0),n.attributes.cms_media="true";var o=this.getImageUrl(e,t);o&&(n.attributes.src=o);break;case"widget":i=this.getElementObject(e),n=t.createFakeParserElement(e,"cke_widget","object",!0),n.attributes.cms_disable_media="true",n.attributes.cke_widget="true",i.image_guid&&(l=n.attributes.style||"",n.attributes.style=l+"background-image:url("+t.config.ApplicationPath+"CMSPages/GetMetaFile.aspx?fileguid="+i.image_guid+"&maxsidesize=32);"),i.widget_displayname&&(n.attributes.title=i.widget_displayname.replace(/\+/g," "));break;default:n=t.createFakeParserElement(e,"cke_inlinecontrol","object",!1),n.attributes.cms_disable_media="true"}n.attributes.cms_inline="true",n.attributes.alt="";var l=n.attributes.style||"",s=e.attributes.width,u=e.attributes.height;return"widget"!=a.toLowerCase()&&(n.attributes.title="","undefined"!=typeof s&&(l=n.attributes.style=l+"width:"+this.cssifyLength(s)+";"),"undefined"!=typeof u&&(l=n.attributes.style=l+"height:"+this.cssifyLength(u)+";")),n}return null},getNodeList:function(e){return new CKEDITOR.dom.nodeList(e)},getElementObject:function(e){var t,i,n={};if(e){var a;if(e._)for(a=0;a<e.children.length;a++)t=e.children[a].attributes.name,i=e.children[a].attributes.value,n[t]=i;else for(a=0;a<e.children.length;a++)t=e.children[a].getAttribute("name"),i=e.children[a].getAttribute("value"),n[t]=i}return n},getCurrentEditor:function(){return null!==this.currentEditor?this.currentEditor:null!==CKEDITOR.currentInstance?CKEDITOR.currentInstance:null},getImageUrl:function(e,t){t=t||this.getCurrentEditor();var i=null,n=CMSPlugin.getElementObject(e);return n.url&&(i=n.url,0===i.indexOf("~/")&&(i=i.replace("~/",t.config.ApplicationPath))),i},getMediaType:function(e){var t=this.getElementObject(e);return t.cms_type?t.cms_type.toLowerCase():t.ext&&".swf"===t.ext.toLowerCase()||CMSPlugin.isFlashEmbed(e)?"flash":"audiovideo"},isFlashEmbed:function(e){var t=e.attributes;return"application/x-shockwave-flash"==t.type||"flash"==t.type||CMSPlugin.regFlashFilename.test(t.src||"")},initCss:function(e){var t="background-position: center center;background-repeat: no-repeat;border: 1px solid #CCC;width: 80px;height: 80px;";CKEDITOR.addCss("img.cke_inlinecontrol { background-image: url("+CKEDITOR.getUrl(e.config.CMSPluginUrl+"images/CMSInline_bg.png")+");"+t+"}"),CKEDITOR.addCss("img.cke_youtube { background-image: url("+CKEDITOR.getUrl(e.config.CMSPluginUrl+"images/InsertYouTube_bg.png")+");"+t+"}"),CKEDITOR.addCss("img.cke_media { background-image: url("+CKEDITOR.getUrl(e.config.CMSPluginUrl+"images/InsertImageOrMedia_bg.png")+");"+t+"}"),CKEDITOR.addCss("img.cke_flash { background-image: url("+CKEDITOR.getUrl(e.config.CMSPluginUrl+"images/InsertFlash_bg.png")+");"+t+"}"),CKEDITOR.addCss("img.cke_widget { background-image: url("+CKEDITOR.getUrl(e.config.CMSPluginUrl+"images/InsertWidget_bg.png")+");"+t+"width: 32px;height: 32px;}"),CKEDITOR.addCss("img.cke_old_media { background-image: url("+CKEDITOR.getUrl(e.config.CMSPluginUrl+"images/InsertImageOrMediaOld_bg.png")+");"+t+"}")},openWidget:function(e,t,i,n,a){this.currentEditor=e;var r,o=e.getSelection().getSelectedElement();if(r=e.config.IsLiveSite?e.config.ApplicationPath+"CMSModules/Widgets/LiveDialogs/"+t:e.config.ApplicationPath+"CMSModules/Widgets/Dialogs/"+t,o&&o.hasAttribute("cms_inline")){var l=e.restoreRealElement(o),s=this.getInline(l.$);"widget"!==s.cms_type||null!==i&&i!==s.name||(r=e.config.IsLiveSite?e.config.ApplicationPath+"CMSModules/Widgets/LiveDialogs/WidgetProperties.aspx?inline=true":e.config.ApplicationPath+"CMSModules/Widgets/Dialogs/WidgetProperties.aspx?inline=true",n=900,a=650)}e.config.CurrentGroupID&&(r+="&groupid="+e.config.CurrentGroupID),CMSPlugin.openModalDialog(r,i,n,a)},pluginInsertForms:function(e){var t="InsertForms",i={exec:function(e){CMSPlugin.openWidget(e,"WidgetProperties.aspx?inline=true&isnew=1&widgetname=BizForm","BizForm","900","600")}},n={label:e.lang.CMSPlugins.InsertForms.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"};e.ui.addButton(t,n),e.addCommand(t,i)},pluginInsertMacro:function(e){var t="InsertMacro",i="";e.config.ResolverName&&(i="resolver="+e.config.ResolverName),e.config.CurrentDocumentID&&(i&&(i+="&"),i+="documentid="+e.config.CurrentDocumentID),e.config.CurrentCulture&&(i&&(i+="&"),i+="culture="+e.config.CurrentCulture);var n={exec:function(e){CMSPlugin.currentEditor=e;var t=e.config.ApplicationPath+"CMSAdminControls/UI/Macros/Dialogs/Default.aspx?"+i;CMSPlugin.openModalDialog(t,"insertMacro",1024,660)}},a={label:e.lang.CMSPlugins.InsertMacro.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"};e.ui.addButton(t,a),e.addCommand(t,n)},pluginInsertPolls:function(e){var t="InsertPolls",i={exec:function(e){var t="WidgetProperties.aspx?inline=true&isnew=1&widgetname=Poll";CMSPlugin.openWidget(e,t,"Poll","900","660")}},n={label:e.lang.CMSPlugins.InsertPolls.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"};e.ui.addButton(t,n),e.addCommand(t,i)},pluginInsertGroupPolls:function(e){var t="InsertGroupPolls",i={exec:function(e){var t="WidgetProperties.aspx?inline=true&isnew=1&widgetname=GroupPoll";CMSPlugin.openWidget(e,t,"GroupPoll","900","660")}},n={label:e.lang.CMSPlugins.InsertGroupPolls.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"};e.ui.addButton(t,n),e.addCommand(t,i)},pluginInsertRating:function(e){var t="InsertRating",i={exec:function(e){CMSPlugin.openWidget(e,"WidgetProperties.aspx?inline=true&isnew=1&widgetname=ContentRating_1","ContentRating_1","715","550")}},n={label:e.lang.CMSPlugins.InsertRating.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"};e.ui.addButton(t,n),e.addCommand(t,i)},pluginKeyPress:function(e){var t=!1,i=!1,n=!1;e.on("instanceReady",function(e){var a=function(e){return e.ctrlKey&&e.altKey},r=function(e){var a=e.data;return a.key=a.getKey(),a.ctrlKey=t,a.altKey=i,a.shiftKey=n,a},o=function(e){var o,l=e.data.$.keyCode;17===l?t=!0:16===l?n=!0:18===l?i=!0:(o=r(e),a(o)||s(o))},l=function(e){var o,l=e.data.$.keyCode;17===l?t=!1:16===l?n=!1:18===l?i=!1:(o=r(e),a(o)&&s(o))},s=function(e){if(!window.disableShortcuts){if(window.HtmlEditor)return window.HtmlEditor.keyPressed(e);if(null!==window.parent&&window.parent.HtmlEditor)return window.parent.HtmlEditor.keyPressed(e)}return!0};e.editor.document.on("keydown",o),e.editor.document.on("keyup",l),e.editor.on("mode",function(e){var t=e.editor;"source"!=t.mode&&(t.document.on("keydown",o),t.document.on("keyup",l))})})},pluginInsertYouTube:function(e){var t="InsertYouTubeVideo",i={exec:function(e){CMSPlugin.currentEditor=e;var t;t=e.config.IsLiveSite?e.config.ApplicationPath+"CMSFormControls/LiveSelectors/InsertYouTubeVideo/Default.aspx":e.config.ApplicationPath+"CMSFormControls/Selectors/InsertYouTubeVideo/Default.aspx",CMSPlugin.openModalDialog(t,"youtube",1024,660)}},n={label:e.lang.CMSPlugins.InsertYouTubeVideo.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"},a=function(e){var i=e.data.element;i.is("img")&&"true"==i.getAttribute("cms_youtube")&&e.editor.execCommand(t)},r={youtube:{label:e.lang.CMSPlugins.InsertYouTubeVideo.menu,command:t,group:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"}};e.addCommand(t,i),e.ui.addButton(t,n),e.on("doubleclick",a),e.addMenuItems&&(e.addMenuGroup(t),e.addMenuItems(r)),e.contextMenu&&e.contextMenu.addListener(function(e){return e&&e.is("img")&&"true"==e.getAttribute("cms_youtube")?{youtube:CKEDITOR.TRISTATE_OFF}:void 0})},pluginInsertWidget:function(e){var t="InsertWidget",i={exec:function(e){CMSPlugin.openWidget(e,"WidgetSelector.aspx?isnew=true&inline=true",null,"90%","85%")},open:function(e,t){t=t||CMSPlugin.currentEditor;var i;i=t.config.IsLiveSite?t.config.ApplicationPath+"CMSModules/Widgets/LiveDialogs/WidgetProperties.aspx?inline=true&isnew=1&widgetid="+e:t.config.ApplicationPath+"CMSModules/Widgets/Dialogs/WidgetProperties.aspx?inline=true&isnew=1&widgetid="+e,t.config.CurrentGroupID&&(i+="&groupid="+t.config.CurrentGroupID),CMSPlugin.openModalDialog(i,"widget",950,"95%")}},n={label:e.lang.CMSPlugins.InsertWidget.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"},a=function(e){var i=e.data.element;i.is("img")&&"true"==i.getAttribute("cke_widget")&&e.editor.execCommand(t)},r={widget:{label:e.lang.CMSPlugins.InsertWidget.menu,command:t,group:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"}};e.addCommand(t,i),e.ui.addButton(t,n),e.on("doubleclick",a),e.addMenuItems&&(e.addMenuGroup(t),e.addMenuItems(r)),e.contextMenu&&e.contextMenu.addListener(function(e){return e&&e.is("img")&&"true"==e.getAttribute("cke_widget")?{widget:CKEDITOR.TRISTATE_OFF}:void 0})},pluginInsertImageOrMedia:function(e){var t="InsertImageOrMedia",i={exec:function(e){var t=window.unescape(e.config.MediaDialogWidth),i=window.unescape(e.config.MediaDialogHeight);CMSPlugin.currentEditor=e,CMSPlugin.openModalDialog(e.config.MediaDialogURL,"imageormedia",t,i)}},n={label:e.lang.CMSPlugins.InsertImageOrMedia.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"},a=function(e){var i=e.data.element;if(e.editor.config.removeButtons)for(var n in e.editor.config.removeButtons)if("InsertImageOrMedia"===e.editor.config.removeButtons[n])return void e.cancel();!i.is("img")||"true"!==i.getAttribute("cms_media")&&i.data("cke-realelement")||(e.editor.execCommand(t),e.cancel())},r={imageormedia:{label:e.lang.CMSPlugins.InsertImageOrMedia.menu,command:t,group:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"}};e.addCommand(t,i),e.ui.addButton(t,n),e.on("doubleclick",a,null,null,1),e.addMenuItems&&(e.addMenuGroup(t),e.addMenuItems(r)),e.contextMenu&&e.contextMenu.addListener(function(e){return e&&e.is("img")&&"cke_anchor"!=e.getAttribute("class")&&"flash"!=e.data("cke-real-element-type")&&("true"==e.getAttribute("cms_media")||"true"!=e.getAttribute("cms_disable_media"))?{imageormedia:CKEDITOR.TRISTATE_OFF}:void 0}),e.on("toHtml",function(e){function t(e){if(e.children&&e.children.forEach(t),"img"==e.name&&"undefined"!=typeof e.attributes.src){var i=e.attributes.src;-1==i.indexOf("?")&&(i+="?"),i+="&"+n,e.attributes.src=i}}var i=e.data.dataValue,n=e.editor.config.AppendToImagePath;"undefined"!=typeof n&&n.length>0&&t(i)})},pluginInsertLink:function(e){var t="InsertLink",i={exec:function(e){var t=window.unescape(e.config.LinkDialogWidth),i=window.unescape(e.config.LinkDialogHeight);CMSPlugin.currentEditor=e,CMSPlugin.openModalDialog(e.config.LinkDialogURL,"imageormedia",t,i)}},n={label:e.lang.CMSPlugins.InsertLink.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"},a=function(i){var n;try{n=CKEDITOR.plugins.link.getSelectedLink(e)||i.data.element}catch(a){}if(i.editor.config.removeButtons)for(var r in i.editor.config.removeButtons)if("InsertLink"===i.editor.config.removeButtons[r])return void i.cancel();n&&(n.isReadOnly()||"Disabled"==i.editor.config.toolbar?i.stop():n.is("a")?n.getAttribute("name")&&!n.getAttribute("href")?i.data.dialog="anchor":(i.editor.execCommand(t),i.cancel()):n.is("img")&&"anchor"==n.data("cke-real-element-type")&&(i.data.dialog="anchor"))},r={insertLink:{label:e.lang.CMSPlugins.InsertLink.menu,command:t,group:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"}};e.addCommand(t,i,1),e.ui.addButton(t,n),e.on("doubleclick",a,null,null,1),e.addMenuItems&&(e.addMenuGroup(t),e.addMenuItems(r)),e.contextMenu&&e.contextMenu.addListener(function(t){if(!t||t.isReadOnly())return null;var i=t.is("img")&&"anchor"==t.data("cke-real-element-type");if(!i){if(!(t=CKEDITOR.plugins.link.getSelectedLink(e)))return null;i=t.getAttribute("name")&&!t.getAttribute("href")}return i?void 0:{insertLink:CKEDITOR.TRISTATE_OFF}})},pluginQuicklyInsertMedia:function(e){var t="QuicklyInsertImage",i={exec:function(e){CMSPlugin.currentEditor=e,CMSPlugin.saveFocus(e)}};e.addCommand(t,i),e.ui.addButton(t,{label:e.lang.CMSPlugins.QuicklyInsertImage.button,icon:e.config.CMSPluginUrl+"images/"+t+".png",onRender:function(){e.config.qimId||(e.config.qimId=[]),e.config.qimId.push(this._.id),e.on("instanceReady",function(){function i(e){if(e){var t=e.match(/(?:formGuid=)([a-z\d-]+)/i),i=e.match(/(?:documentid=)([\d]+)/i),n=e.match(/(?:parentid=)([\d]+)/i);if(t&&n&&/^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i.test(t[1])&&parseInt(n[1],10)>=0)return!0;if(i&&parseInt(i[1],10)>=0)return!0}return!1}for(window.InsertImageOrMedia=function(e,t,i,n,a){CMSPlugin.insert(a)},l=0;l<e.config.qimId.length;l++){var n=e.config.qimId[l],a=document.getElementById(n);if(null!==a&&!a.QIM_set)if(a.QIM_set=!0,i(this.config.QuickInsertURL)&&!window.disableQim){a.className+=" CMS_QIM",$cmsj(a).mouseenter(function(){CMSPlugin.currentEditor=e,CMSPlugin.saveFocus(e)}),a.onmousemove=function(){CMSPlugin.currentEditor=e};for(var r,o=a.getElementsByTagName("span"),l=0;l<o.length;l++)o[l].className.indexOf("cke_button_icon")>-1&&(r=o[l]);if("undefined"!=typeof r){r.style.position="relative",r.style.background="";var s=document.createElement("div");s.className="InnerDiv",s.style.position="absolute",s.style.top="0px",s.style.left="0px",s.style.display="inline-block",s.innerHTML='<img src="'+e.config.CMSPluginUrl+"images/"+t+'.png" style="width:16px; height:16px;" />',r.appendChild(s);var u=document.createElement("div");u.className="UploaderDiv",u.style.position="absolute",u.style.top="0px",u.style.width="16px",u.style.height="16px",u.style.visibility="visible",u.style.opacity="1",u.innerHTML='<iframe name="QuickInsertImage" src="'+e.config.QuickInsertURL+"&containerid="+n+'" frameborder="0" marginWidth="0" marginHeight="0" scrolling="no" border="0" style="width:16px; height:16px; overflow:hidden;" allowtransparency="true" ></iframe>',r.appendChild(u);var g=document.createElement("div");g.className="LoadingDiv",g.style.position="absolute",g.style.opacity="1",g.style.display="none",g.style.top="0px",g.style.left="0px",g.innerHTML='<img src="'+e.config.ApplicationPath+'CMSPages/GetResource.ashx?image=Design/Preloaders/preload16.gif" style="width:16px; height:16px;" />',r.appendChild(g);var c=document.createElement("script");c.type="text/javascript",c.src=e.config.ApplicationPath+"CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploader.js",a.appendChild(c)}}else a.parentNode.removeChild(a)}})}}),e.on("mode",function(){if(e.config.qimId)for(var t=0;t<e.config.qimId.length;t++){var i=e.config.qimId[t],n=document.getElementById(i);if(n){var a=n.getElementsByTagName("iframe");"source"==e.mode?(n.className+=" cke_button_disabled",a&&1===a.length&&(a[0].style.display="none")):(n.className=n.className.replace(/\s+cke_button_disabled/gi,""),a&&1===a.length&&(a[0].style.display=""))}}})},pluginInsertStrandsRecommender:function(e){var t="InsertStrandsRecommender",i={exec:function(e){CMSPlugin.currentEditor=e;var t=e.config.ApplicationPath+"CMSModules/StrandsRecommender/Pages/InsertEmailWidget.aspx";CMSPlugin.openModalDialog(t,"strandsRecommender",1e3,660)}},n={label:e.lang.CMSPlugins.InsertStrandsRecommender.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"};e.ui.addButton(t,n),e.addCommand(t,i)},pluginForumButtons:function(e){var t="InsertQuote",i={exec:function(e){e.insertHtml("[quote=][/quote]")}},n={label:e.lang.CMSPlugins.InsertQuote.button,command:t,icon:e.config.CMSPluginUrl+"images/"+t+".png"},a="InsertImage",r={exec:function(e){var t=prompt(e.lang.CMSPlugins.InsertQuote.prompturl,"http://");t&&e.insertHtml("[img]"+t+"[/img]")}},o={label:e.lang.CMSPlugins.InsertImage.button,command:a,icon:e.config.CMSPluginUrl+"images/"+a+".png"},l="InsertUrl",s={exec:function(e){var t=prompt(e.lang.CMSPlugins.InsertUrl.prompturl,"http://");if(t){var i=prompt(e.lang.CMSPlugins.InsertUrl.promptdesc,"");e.insertHtml("[url="+t+"]"+i+"[/url]")}}},u={label:e.lang.CMSPlugins.InsertUrl.button,command:l,icon:e.config.CMSPluginUrl+"images/"+l+".png"};e.ui.addButton(t,n),e.addCommand(t,i),e.ui.addButton(a,o),e.addCommand(a,r),e.ui.addButton(l,u),e.addCommand(l,s)},initMaximalization:function(e){e.on("maximize",function(t){var i=t.data;if(e.config.sharedSpaces&&i==CKEDITOR.TRISTATE_ON){var n=new CKEDITOR.dom.element(document.body),a=n.getCustomData("maximize_saved_styles")["class"];a.indexOf("cms-bootstrap")>-1&&(document.body.className+=" cms-bootstrap");var r=$cmsj("#"+e.config.sharedSpaces.top),o=r.offset().top+r.outerHeight(),l=e.container.getChild(1);l.setStyle("top",o+"px");var s=CKEDITOR.document.getWindow().getViewPaneSize(),u=$cmsj("#"+e.config.sharedSpaces.bottom),g=s.height-o-u.outerHeight();e.resize(s.width,g,null,!0)}})},initPopupOpener:function(e){e.popup=function(e,t,i,n){CMSPlugin.openModalDialog(e,"CKEditorPopup",t,i,n)}},initContextMenu:function(e){var t={Image:"image",Link:"link",Unlink:"unlink",Flash:"flash",Table:"table"},i=e.config.toolbar instanceof Array?e.config.toolbar:e.config["toolbar_"+e.config.toolbar];if("undefined"!=typeof i){for(var n=0;n<i.length;n++){var a=i[n];if(a)for(var r=0;r<a.length;r++){var o=a[r];t[o]&&delete t[o]}}for(var l in t)delete e._.menuItems[t[l]]}},initSelection:function(e){e.on("beforeCommandExec",function(e){CMSPlugin.saveFocus(e.editor)})},initDataProcesor:function(e){var t=e.dataProcessor,i=t&&t.dataFilter;i&&i.addRules({elements:{"cke:object":function(t){if(t.attributes.codetype&&"cmsinlinecontrol"==t.attributes.codetype.toLowerCase())return CMSPlugin.createFakeControl(t,e);var i=t.attributes,n=i.classid&&String(i.classid).toLowerCase();if(!n&&!CMSPlugin.isFlashEmbed(t)){for(var a=0;a<t.children.length;a++)if("cke:embed"==t.children[a].name)return CMSPlugin.isFlashEmbed(t.children[a])?(t.attributes.type="flash",CMSPlugin.createFakeControl(t,e)):null;return null}return t.attributes.type="flash",CMSPlugin.createFakeControl(t,e)},"cke:embed":function(t){var i=null;return CMSPlugin.isFlashEmbed(t)&&(t.attributes.type="flash",i=CMSPlugin.createFakeControl(t,e)),i}}},3)},getInline:function(e,t){var i={};if(e){var n=e.getAttribute("type"),a=e.getAttribute("width"),r=e.getAttribute("height");if(n&&("media"==n.toLowerCase()&&(n=this.getMediaType(e)),i.cms_type=n),e.childNodes){var o=this.getPropertyPrefix(n);a&&(i[o+"width"]=a),r&&(i[o+"height"]=r);for(var l=e.childNodes.length,s=0;l>s;s++){var u=e.childNodes[s],g=u.getAttribute("name"),c=u.getAttribute("value");g&&(i[o+g]=c,o+g==="flash_movie"&&(i.flash_url=c))}}try{if(e=CKEDITOR.dom.element.get(t)){var d=e.getAscendant("a",!0);d&&(i[o+"link"]=d.getAttribute("data-cke-saved-href")||d.getAttribute("href"),i[o+"target"]=d.getAttribute("target"))}}catch(m){}}return i},getPropertyPrefix:function(e){var t="";switch(e.toLowerCase()){case"youtubevideo":t="youtube_";break;case"image":t="img_";break;case"audiovideo":t="av_";break;case"flash":t="flash_"}return t},getInlineType:function(e){var t="";switch(e.toLowerCase()){case"youtubevideo":t="YouTubeVideo";break;case"image":t="Image";break;case"audiovideo":case"flash":t="Media";break;case"widget":t="Widget"}return t},createCKElement:function(e){var t=this.getCurrentEditor();return t?t.document.createElement(e):null},insertInline:function(e,t){if(e){var i=this.getInlineType(e),n=this.getPropertyPrefix(e),a=this.getCurrentEditor(),r='<object style="display: none" codetype="CMSInlineControl" type="'+i+'" ',o={img_link:1,img_target:1},l={img_hspace:-1,img_vspace:-1,img_borderwidth:-1,flash_loop:"False",flash_autoplay:"False",flash_menu:"False",av_autoplay:"False",av_loop:"False",av_controls:"True"};t[n+"width"]&&(r+='width="'+t[n+"width"]+'" ',t[n+"width"]=null),t[n+"height"]&&(r+='height="'+t[n+"height"]+'" ',t[n+"height"]=null),r+=">";for(var s in t)!o[s]&&t[s]&&t[s]!=l[s]&&(r+='<param name="'+s.replace(n,"")+'" value="'+t[s]+'" />');if(r+="</object>",t.img_link){var u;try{CMSPlugin.restoreFocus(a);var g=a.getSelection();if(g.getType()==CKEDITOR.SELECTION_ELEMENT){var c=g.getSelectedElement();c.is("a")&&(u=c)}var d=g.getRanges(!0)[0];d.shrink(CKEDITOR.SHRINK_TEXT);var m=d.getCommonAncestor();u=m.getAscendant("a",!0)}catch(p){}if(u){var f={href:"javascript:void(0)/*"+CKEDITOR.tools.getNextNumber()+"*/"},h=[];f["data-cke-saved-href"]=t.img_link,t.img_target?f.target=t.img_target:h.push("target"),u.setAttributes(f),u.removeAttributes(h),u.setHtml(r),r=u.getOuterHtml()}else{var b='<a href="'+t.img_link+'" ';t.img_target&&(b+='target="'+t.img_target+'" '),b+=">",r=b+r+"</a>"}}else a.document.$.execCommand("unlink",!1,null);this.insertHtml(r)}},insertLink:function(e){var t={href:"javascript:void(0)/*"+CKEDITOR.tools.getNextNumber()+"*/"},i=[],n=this.getCurrentEditor(),a=null,r=null,o=null,l=null;try{if(CMSPlugin.restoreFocus(n),M=n.getSelection(),M.getType()==CKEDITOR.SELECTION_ELEMENT){var s=M.getSelectedElement();s.is("a")&&(a=s)}y=M.getRanges(!0)[0],y.shrink(CKEDITOR.SHRINK_TEXT);var u=y.getCommonAncestor();a=u.getAscendant("a",!0)}catch(g){}if(e.link_url){var c=e.link_protocol||"",d=e.link_url||"";t["data-cke-saved-href"]=0===d.indexOf("/")?d:c+d}else if(e.anchor_name)r=e.anchor_name||"",o=e.anchor_custom||"",l=e.anchor_id||"",t["data-cke-saved-href"]="#"+(r||o||l||"");else if(e.email_to){var m=e.email_cc,p=e.email_bcc,f=e.email_subject,h=e.email_body,b=[];m&&b.push("cc="+m),p&&b.push("bcc="+p),f&&b.push("subject="+f),h&&b.push("body="+h),b=b.length?"?"+b.join("&"):"",t["data-cke-saved-href"]="mailto:"+e.email_to+b}if(e.link_target?t.target=e.link_target:i.push("target"),e.link_url){var C=function(e,n,a){var r=e[n];r?t[a]=r:i.push(a)};C(e,"link_url","href"),C(e,"link_id","id"),C(e,"link_target","target"),C(e,"link_class","class"),C(e,"link_tooltip","title"),C(e,"link_style","style"),e.link_name?(t.name=t["data-cke-saved-name"]=e.link_name,t["class"]=(t["class"]?t["class"]+" ":"")+"cke_anchor"):i=i.concat(["data-cke-saved-name","name"])}if(a){var _=a;_.setAttributes(t),_.removeAttributes(i),_.getAttribute("name")?_.addClass("cke_anchor"):_.removeClass("cke_anchor"),this.fakeObj&&n.createFakeElement(_,"cke_anchor","anchor").replace(this.fakeObj),delete a}else{var v,I,M=n.getSelection(),k=M.getRanges(!0),y=k[0];if(1==k.length&&y.collapsed&&(v=new CKEDITOR.dom.text(e.email_linktext?e.email_linktext:e.email_to?e.email_to:e.anchor_linktext?e.anchor_linktext:e.anchor_name?e.anchor_name:e.link_text?e.link_text:e.link_url,n.document),k[0].insertNode(v),k[0].selectNodeContents(v),M.selectRanges(k)),I=new CKEDITOR.style({element:"a",attributes:t}),I.type=CKEDITOR.STYLE_INLINE,I.applyToRange(y),e.link_id)for(var P=n.document.$.getElementsByTagName("a"),S=0;S<P.length;S++)if(P[S].getAttribute("href")==t.href){P[S].id=e.link_id;break}}},insertImage:function(e){var t=this.createCKElement("img");if(null!=t){if(e.img_id&&(t.$.id=e.img_id),e.img_url&&(t.$.src=e.img_url,t.$.setAttribute("data-cke-saved-src",e.img_url)),t.$.alt=e.img_alt?e.img_alt:e.img_tooltip?e.img_tooltip:"",e.img_tooltip&&(t.$.title=e.img_tooltip),e.img_class&&t.$.setAttribute("class",e.img_class),e.img_dir&&(t.$.dir=e.img_dir),e.img_usemap&&(t.$.useMap=e.img_usemap),e.img_longdescription&&t.$.setAttribute("longdesc",e.img_longdescription),e.img_lang&&(t.$.lang=e.img_lang),e.img_style&&(t.setAttribute("style",e.img_style),void 0!=t.$.style.cssStyle&&(t.$.style.cssStyle=e.img_style),void 0!=t.$.style.cssText&&(t.$.style.cssText=e.img_style)),e.img_width&&parseInt(e.img_width,10)>=0&&(t.$.style.width=parseInt(e.img_width,10)+"px"),e.img_height&&parseInt(e.img_height,10)>=0&&(t.$.style.height=parseInt(e.img_height,10)+"px"),e.img_borderwidth&&parseInt(e.img_borderwidth,10)>=0&&(t.$.style.borderWidth=e.img_borderwidth+"px",t.$.style.borderStyle="solid"),e.img_bordercolor)try{t.$.style.borderColor=e.img_bordercolor}catch(i){t.$.style.borderColor=""}if(e.img_align&&("left"==e.img_align||"right"==e.img_align?(void 0!=t.$.style.cssFloat&&(t.$.style.cssFloat=e.img_align),void 0!=t.$.style.styleFloat&&(t.$.style.styleFloat=e.img_align)):(void 0!=t.$.style.verticalAlign&&(t.$.style.verticalAlign=e.img_align),void 0!=t.$.style["vartical-align"]&&(t.$.style["vartical-align"]=e.img_align))),e.img_vspace||e.img_hspace){var n=parseInt(e.img_vspace,10),a=parseInt(e.img_hspace,10);n==a&&n>=0?t.$.style.margin=a+"px":n==a&&-1==n||(t.$.style.margin=(n>=0?n+"px ":"auto ")+(a>=0?a+"px":"auto"))}if(e.img_link||e.img_behavior){var r=this.createCKElement("a");e.img_link&&(r.$.href=e.img_link,r.$.setAttribute("data-cke-saved-href",e.img_link)),e.img_target?r.$.setAttribute("target",e.img_target):e.img_behavior&&r.$.setAttribute("target",e.img_behavior),r.append(t),this.insertElement(r)}else this.insertElement(t)}},insertHtml:function(e){var t=this.getCurrentEditor();t&&(CMSPlugin.restoreFocus(t),t.insertHtml(e))},insertElement:function(e){var t=this.getCurrentEditor();t&&(CMSPlugin.restoreFocus(t),t.insertElement(e))},insert:function(e){if(e){var t=e.cms_type;t?this.insertInline(t,e):e.link_url||e.email_to||e.anchor_name?this.insertLink(e):e.img_url&&this.insertImage(e)}},saveFocus:function(e){CMSPlugin.selection=e.getSelection(),CMSPlugin.selection?(CMSPlugin.selectedElement=CMSPlugin.selection.getSelectedElement(),CMSPlugin.selectionBookmarks=CMSPlugin.selection.createBookmarks2()):(CMSPlugin.selectedElement=null,CMSPlugin.selectionBookmarks=null)},restoreFocus:function(e){CMSPlugin.selection?CMSPlugin.selectionBookmarks?CMSPlugin.selection.selectBookmarks(CMSPlugin.selectionBookmarks):CMSPlugin.selectedElement?CMSPlugin.selection.selectElement(CMSPlugin.selectedElement):e.focus():e.focus()},openModalDialog:function(e,t,i,n,a){window.modalDialog(e,t,i,n,a)},beforeInit:function(e){this.pluginKeyPress(e)},init:function(e){this.initCss(e),this.initMaximalization(e),this.initSelection(e),this.pluginInsertForms(e),this.pluginInsertMacro(e),this.pluginInsertPolls(e),this.pluginInsertGroupPolls(e),this.pluginInsertRating(e),this.pluginInsertYouTube(e),this.pluginInsertWidget(e),this.pluginInsertImageOrMedia(e),this.pluginInsertLink(e),this.pluginQuicklyInsertMedia(e),this.pluginInsertStrandsRecommender(e),this.pluginForumButtons(e)},afterInit:function(e){this.initContextMenu(e),this.initDataProcesor(e),this.initPopupOpener(e)}};CKEDITOR.plugins.add("CMSPlugins",CMSPlugin);