CKEDITOR.dialog.add("mswordDialog",function(b){var d=b.lang.msword;var a="font-size: 1.1em;";var c='<li style="font-size: 1.1em"><span style="font-size:11pt">';return{title:"MS Word",minWidth:600,minHeight:350,contents:[{id:"tab-basic",label:"Text",elements:[{type:"html",html:'<div contenteditable="true" id="ckgedit_mswin" style="border: 2px solid #ddd; padding:3px; width:600px; height:350px; overflow:auto; cursor:auto;"> </div>',minWidth:350,minHeight:350},{type:"hbox",height:["18px;"],children:[{type:"html",html:b.lang.msword.info}]}]},{id:"Info",label:b.lang.msword.instructionsLabel,elements:[{type:"html",html:"<div style='padding:40px;overflow:break-word'><ol><li style='font-size:1.2em;'><span style='font-size:11pt'>"+d.instructions+'</span></li><li style="font-size:1.2em;"><span style="font-size:11pt"> '+d.instructions_2+'</span></li><ul style="list-style-position: inside;"><li style="margin: 0 0 0 4px"><span style="font-size:11pt;">'+d.instructions_3+'</span></li><li style="margin: 0 0 0 4px;"><span style="font-size:11pt">'+d.instructions_4+'</span></li><li style="margin: 0 0 0 4px"><span style="font-size:11pt">'+d.instructions_5+'</span></ul><li style="font-size:1.2em;"><span style="font-size:11pt;">'+d.instructions_6+"</span></li></ol></div>"}]}],onShow:function(){var f=this;geshi_dialog=f;selection=b.getSelection();var g=b.getSelectedHtml(true);if(g){var e=document.getElementById("ckgedit_mswin");e.innerHTML=g}jQuery("#ckgedit_mswin").keydown(function(h){if(h.which==13){h.stopPropagation()}})},onOk:function(){var f=document.getElementById("ckgedit_mswin");var e=f.innerHTML;e=e.replace(/&lt/gm,"<");e=e.replace(/&gt/mg,">");var g=new RegExp("<xml>([^]*)</xml>","gm");e=e.replace(g,function(h,i){return""});if(e.match(/<img/)){e=e.replace(/<img\s/,'<img alt="msword" ');b.insertHtml(e);e=""}var g=new RegExp("<style>([^]*)</style>","gm");e=e.replace(g,function(h,i){return""});g=new RegExp("\\<\\!--\\[.*?endif\\]--\\>\\<\\!--\\[if gte.*?\\]\\>([^]*)\\<\\!\\[endif\\]-->","mg");e=e.replace(g,"");e=e.replace(/&lt/gm,"<");e=e.replace(/&gt/mg,">");e=e.replace(/<table\s+class=.*?>/mg,"<table>");e=e.replace(/<table.*?>/mg,"<table>");e=e.replace(/<tr.*?>/mg,"<tr>");e=e.replace(/<td.*?>/mg,"<td>");e=e.replace(/style="([^>]+)"/gm,function(h,k){matches=k.match(/level(\d)/);if(matches){return"L_"+matches[1]}return h});e=e.replace(/style="[^>]+"/gm,"");e=e.replace(/<h(\d).*?><span.*?>/gm,"<h$1>");e=e.replace(/(<span\s*>)+/gm,"");e=e.replace(/(<\/span>)+/gm,"");e=e.replace(/<tbody>([^]+)<\/tbody>/,function(h){h=h.replace(/<\/p>/mg,"");return h.replace(/<p.*?>/mg,"")});e=e.replace(/<p class="MsoListParagraphCxSpFirst"\s+L_\d>([\s\S]+)<p class="MsoListParagraphCxSpLast"\s+L_\d>.*?\n(.*?)\/p>/gm,function(h,i){var p=h;p=p.replace(/&nbsp;/gm,"");var l=p.split(/\n/);var o="";var k="ul";for(j=0;j<l.length;j++){if(l[j].match(/SpFirst/)){if(l[j].match(/L_\d+>[a-b0-9]/)){k="ol"}l[j]=l[j].replace(/<p.*?>/,"");l[j]=l[j].replace(/<\/p>/,"");l[j]=l[j].replace(/<p.*?>(\d*|·)/,"");o+="<"+k+">"}else{if(l[j].match(/SpMiddle/)){l[j]=l[j].replace(/<p.*?>/,"");l[j]=l[j].replace(/<p.*?>/,"");l[j]=l[j].replace(/<\/p>/,"")}else{if(l[j].match(/SpLast/)){l[j]=l[j].replace(/<p.*?>/,"");l[j]=l[j].replace(/<\/p>/,"");l[j]=l[j].replace(/^\s+/,"")}else{l[j]=l[j].replace(/<\/p>/,"");l[j]=l[j].replace(/^\s+/,"");l[j]=l[j].replace(/\s+$/,"");o+="<li>";o+=l[j]+"</li>"}}}}o=o.replace(/<li>·*<\/li>/gm,"");o+="</"+k+">";return o});if(e){b.insertHtml(e)}f.innerHTML=""}}});