/** * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing **/ !function(win){var undef,whiteSpaceRe=/^\s*|\s*$/g,isRegExpBroken="$1"==="B".replace(/A(.)|B/,"$1"),slice=[].slice,tinymce={majorVersion:"@@tinymce_major_version@@",minorVersion:"@@tinymce_minor_version@@",releaseDate:"@@tinymce_release_date@@",_init:function(){function getBase(n){return n.src&&/tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(n.src)?(/_(src|dev)\.js/g.test(n.src)&&(t.suffix="_src"),(p=n.src.indexOf("?"))!=-1&&(t.query=n.src.substring(p+1)),t.baseURL=n.src.substring(0,n.src.lastIndexOf("/")),base&&t.baseURL.indexOf("://")==-1&&0!==t.baseURL.indexOf("/")&&(t.baseURL=base+t.baseURL),t.baseURL):null}var i,nl,n,base,p,v,t=this,d=document,na=navigator,ua=na.userAgent;t.isOpera=win.opera&&win.opera.buildNumber||!1,t.isWebKit=/WebKit/.test(ua);var isIE=!t.isWebKit&&!t.isOpera&&/MSIE/gi.test(ua)&&/Explorer/gi.test(na.appName);if(isIE=isIE&&/MSIE (\w+)\./.exec(ua)[1],t.isIE11=ua.indexOf("Trident/")!=-1&&(ua.indexOf("rv:")!=-1||na.appName.indexOf("Netscape")!=-1)&&11,t.isIE=isIE||t.isIE11,t.isIE12=ua.indexOf("Edge/")!=-1&&!t.isIE&&12,t.isIE12&&(t.isWebKit=!1),t.isIE6=t.isIE&&/MSIE [56]/.test(ua),t.isIE7=t.isIE&&/MSIE [7]/.test(ua),t.isIE8=t.isIE&&/MSIE [8]/.test(ua),t.isIE9=t.isIE&&/MSIE [9]/.test(ua),t.isIE10=t.isIE&&/MSIE [10]/.test(ua),t.isGecko=!t.isWebKit&&!t.isIE11&&/Gecko/.test(ua),t.isMac=ua.indexOf("Mac")!=-1,t.isAir=/adobeair/i.test(ua),t.isIDevice=/(iPad|iPhone)/.test(ua),t.isIOS=t.isIDevice,t.isIOS5=t.isIDevice&&ua.match(/AppleWebKit\/(\d*)/)[1]>=534,win.tinyMCEPreInit)return t.suffix=tinyMCEPreInit.suffix,t.baseURL=tinyMCEPreInit.base,void(t.query=tinyMCEPreInit.query);for(t.suffix="",nl=d.getElementsByTagName("base"),i=0;i=fn.length?fn.apply(this,args.slice(1)):function(){var tempArgs=args.concat([].slice.call(arguments));return tinymce.curry.apply(this,tempArgs)}},_addVer:function(u){var v;return this.query?(v=(u.indexOf("?")==-1?"?":"&")+this.query,u.indexOf("#")==-1?u+v:u.replace("#",v+"#")):u},_replace:function(find,replace,str){return isRegExpBroken?str.replace(find,function(){var i,val=replace,args=arguments;for(i=0;i0?args:[listener.scope]),returnValue!==!1);i++);return self.inDispatch=!1,returnValue}}),function(){var each=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(u,s){var b,base_url,t=this;return u=tinymce.trim(u),s=t.settings=s||{},/^([\w\-]+):([^\/]{2})/i.test(u)||/^\s*#/.test(u)?void(t.source=u):(0===u.indexOf("/")&&0!==u.indexOf("//")&&(u=(s.base_uri?s.base_uri.protocol||"http":"http")+"://mce_host"+u),/^[\w\-]*:?\/\//.test(u)||(base_url=s.base_uri?s.base_uri.path:new tinymce.util.URI(location.href).directory,u=(s.base_uri&&s.base_uri.protocol||"http")+"://mce_host"+t.toAbsPath(base_url,u)),u=u.replace(/@@/g,"(mce_at)"),u=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u),each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(v,i){var s=u[i];s&&(s=s.replace(/\(mce_at\)/g,"@@")),t[v]=s}),b=s.base_uri,void(b&&(t.protocol||(t.protocol=b.protocol),t.userInfo||(t.userInfo=b.userInfo),t.port||"mce_host"!==t.host||(t.port=b.port),t.host&&"mce_host"!==t.host||(t.host=b.host),t.source="")))},setPath:function(p){var t=this;p=/^(.*?)\/?(\w+)?$/.exec(p),t.path=p[0],t.directory=p[1],t.file=p[2],t.source="",t.getURI()},toRelative:function(u){var o,t=this;if("./"===u)return u;if(u=new tinymce.util.URI(u,{base_uri:t}),"mce_host"!=u.host&&t.host!=u.host&&u.host||t.port!=u.port||t.protocol!=u.protocol)return u.getURI();var tu=t.getURI(),uu=u.getURI();return tu==uu||"/"==tu.charAt(tu.length-1)&&tu.substr(0,tu.length-1)==uu?tu:(o=t.toRelPath(t.path,u.path),u.query&&(o+="?"+u.query),u.anchor&&(o+="#"+u.anchor),o)},toAbsolute:function(u,nh){return u=new tinymce.util.URI(u,{base_uri:this}),u.getURI(this.host==u.host&&this.protocol==u.protocol?nh:0)},toRelPath:function(base,path){var items,i,l,bp=0,out="";if(base=base.substring(0,base.lastIndexOf("/")),base=base.split("/"),items=path.split("/"),base.length>=items.length)for(i=0,l=base.length;i=items.length||base[i]!=items[i]){bp=i+1;break}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break}if(1===bp)return path;for(i=0,l=base.length-(bp-1);i=0;i--)0!==path[i].length&&"."!==path[i]&&(".."!==path[i]?nb>0?nb--:o.push(path[i]):nb++);return i=base.length-nb,outPath=i<=0?o.reverse().join("/"):base.slice(0,i).join("/")+"/"+o.reverse().join("/"),0!==outPath.indexOf("/")&&(outPath="/"+outPath),tr&&outPath.lastIndexOf("/")!==outPath.length-1&&(outPath+=tr),outPath},getURI:function(nh){var s,t=this;return t.source&&!nh||(s="",nh||(t.protocol&&(s+=t.protocol+"://"),t.userInfo&&(s+=t.userInfo+"@"),t.host&&(s+=t.host),t.port&&(s+=":"+t.port)),t.path&&(s+=t.path),t.query&&(s+="?"+t.query),t.anchor&&(s+="#"+t.anchor),t.source=s),t.source}})}(),function(){var each=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(n){var h,v=this.get(n);return v&&each(v.split("&"),function(v){v=v.split("="),h=h||{},h[unescape(v[0])]=unescape(v[1])}),h},setHash:function(n,v,e,p,d,s){var o="";each(v,function(v,k){o+=(o?"&":"")+escape(k)+"="+escape(v)}),this.set(n,o,e,p,d,s)},get:function(n){var e,b,c=document.cookie,p=n+"=";if(c){if(b=c.indexOf("; "+p),b==-1){if(b=c.indexOf(p),0!==b)return null}else b+=2;return e=c.indexOf(";",b),e==-1&&(e=c.length),unescape(c.substring(b+p.length,e))}},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+(e?"; expires="+e.toGMTString():"")+(p?"; path="+escape(p):"")+(d?"; domain="+d:"")+(s?"; secure":"")},remove:function(name,path,domain){var date=new Date;date.setTime(date.getTime()-1e3),this.set(name,"",date,path,domain)}})}(),function(){function serialize(o,quote){var i,v,t,name;if(quote=quote||'"',null==o)return"null";if(t=typeof o,"string"==t)return v="\bb\tt\nn\ff\rr\"\"''\\\\",quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){return'"'===quote&&"'"===a?a:(i=v.indexOf(b),i+1?"\\"+v.charAt(i+1):(a=b.charCodeAt().toString(16),"\\u"+"0000".substring(a.length)+a))})+quote;if("object"==t){if(o.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(o)){for(i=0,v="[";i0?",":"")+serialize(o[i],quote);return v+"]"}v="{";for(name in o)o.hasOwnProperty(name)&&(v+="function"!=typeof o[name]?(v.length>1?","+quote:quote)+name+quote+":"+serialize(o[name],quote):"");return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,parse:function(s){try{return eval("("+s+")")}catch(ex){}}}}(),tinymce.create("static tinymce.util.XHR",{send:function(o){function ready(){!o.async||4==x.readyState||c++>1e4?(o.success&&c<1e4&&200==x.status?o.success.call(o.success_scope,""+x.responseText,x,o):o.error&&o.error.call(o.error_scope,c>1e4?"TIMED_OUT":"GENERAL",x,o),x=null):w.setTimeout(ready,10)}function get(s){x=0;try{x=new ActiveXObject(s)}catch(ex){}return x}var x,t,w=window,c=0;if(o.scope=o.scope||this,o.success_scope=o.success_scope||o.scope,o.error_scope=o.error_scope||o.scope,o.async=o.async!==!1,o.data=o.data||"",x=w.XMLHttpRequest?new XMLHttpRequest:get("Microsoft.XMLHTTP")||get("Msxml2.XMLHTTP")){if(x.overrideMimeType&&x.overrideMimeType(o.content_type),x.open(o.type||(o.data?"POST":"GET"),o.url,o.async),o.content_type&&x.setRequestHeader("Content-Type",o.content_type),x.setRequestHeader("X-Requested-With","XMLHttpRequest"),x.send(o.data),!o.async)return ready();t=w.setTimeout(ready,10)}}}),function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(s){this.settings=extend({},s),this.count=0},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o),o.success=function(c,x){c=JSON.parse(c),"undefined"==typeof c&&(c={error:"JSON Parse error."}),c.error?ecb.call(o.error_scope||o.scope,c.error,x):scb.call(o.success_scope||o.scope,c.result)},o.error=function(ty,x){ecb&&ecb.call(o.error_scope||o.scope,ty,x)},o.data=JSON.serialize({id:o.id||"c"+this.count++,method:o.method,params:o.params}),o.content_type="application/json",XHR.send(o)},static:{sendRPC:function(o){return(new tinymce.util.JSONRequest).send(o)}}})}(),function(tinymce){tinymce.VK={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(e){return e.shiftKey||e.ctrlKey||e.altKey},metaKeyPressed:function(e){return tinymce.isMac?e.metaKey:e.ctrlKey&&!e.altKey}}}(tinymce),tinymce.util.Quirks=function(editor){function setEditorCommandState(cmd,state){try{editor.getDoc().execCommand(cmd,!1,state)}catch(ex){}}function getDocumentMode(){var documentMode=editor.getDoc().documentMode;return documentMode?documentMode:6}function isDefaultPrevented(e){return e.isDefaultPrevented()}function cleanupStylesWhenDeleting(){function removeMergedFormatSpans(isDelete){function isAtStartOrEndOfElm(){if(3==container.nodeType){if(isDelete&&offset==container.length)return!0;if(!isDelete&&0===offset)return!0}}var rng,blockElm,wrapperElm,bookmark,container,offset,elm;rng=selection.getRng();var tmpRng=[rng.startContainer,rng.startOffset,rng.endContainer,rng.endOffset];if(rng.collapsed||(isDelete=!0),container=rng[(isDelete?"start":"end")+"Container"],offset=rng[(isDelete?"start":"end")+"Offset"],3==container.nodeType&&(blockElm=dom.getParent(rng.startContainer,dom.isBlock),isDelete&&(blockElm=dom.getNext(blockElm,dom.isBlock)),!blockElm||!isAtStartOrEndOfElm()&&rng.collapsed||(wrapperElm=dom.create("em",{id:"__mceDel"}),each(tinymce.grep(blockElm.childNodes),function(node){wrapperElm.appendChild(node)}),blockElm.appendChild(wrapperElm))),rng=dom.createRng(),rng.setStart(tmpRng[0],tmpRng[1]),rng.setEnd(tmpRng[2],tmpRng[3]),selection.setRng(rng),editor.getDoc().execCommand(isDelete?"ForwardDelete":"Delete",!1,null),wrapperElm){for(bookmark=selection.getBookmark();elm=dom.get("__mceDel");)dom.remove(elm,!0);selection.moveToBookmark(bookmark)}}editor.onKeyDown.add(function(editor,e){var isDelete;isDelete=e.keyCode==DELETE,isDefaultPrevented(e)||!isDelete&&e.keyCode!=BACKSPACE||VK.modifierPressed(e)||(e.preventDefault(),removeMergedFormatSpans(isDelete))}),editor.addCommand("Delete",function(){removeMergedFormatSpans()})}function emptyEditorWhenDeleting(){function serializeRng(rng){var body=dom.create("body"),contents=rng.cloneContents();return body.appendChild(contents),selection.serializer.serialize(body,{format:"html"})}function allContentsSelected(rng){var selection=serializeRng(rng),allRng=dom.createRng();allRng.selectNode(editor.getBody());var allSelection=serializeRng(allRng);return selection===allSelection}editor.onKeyDown.add(function(editor,e){var isCollapsed,keyCode=e.keyCode;if(!isDefaultPrevented(e)&&(keyCode==DELETE||keyCode==BACKSPACE)){if(isCollapsed=editor.selection.isCollapsed(),isCollapsed&&!dom.isEmpty(editor.getBody()))return;if(tinymce.isIE&&!isCollapsed)return;if(!isCollapsed&&!allContentsSelected(editor.selection.getRng()))return;editor.setContent(""),editor.selection.setCursorLocation(editor.getBody(),0),editor.nodeChanged()}})}function selectAll(){editor.onKeyDown.add(function(editor,e){!isDefaultPrevented(e)&&65==e.keyCode&&VK.metaKeyPressed(e)&&(e.preventDefault(),editor.execCommand("SelectAll"))})}function inputMethodFocus(){editor.settings.content_editable||(dom.bind(editor.getDoc(),"focusin",function(e){selection.setRng(selection.getRng())}),dom.bind(editor.getDoc(),"mousedown",function(e){e.target==editor.getDoc().documentElement&&(editor.getWin().focus(),selection.setRng(selection.getRng()))}))}function removeHrOnBackspace(){editor.onKeyDown.add(function(editor,e){if(!isDefaultPrevented(e)&&e.keyCode===BACKSPACE&&selection.isCollapsed()&&0===selection.getRng(!0).startOffset){var node=selection.getNode(),previousSibling=node.previousSibling;previousSibling&&previousSibling.nodeName&&"hr"===previousSibling.nodeName.toLowerCase()&&(dom.remove(previousSibling),tinymce.dom.Event.cancel(e))}})}function focusBody(){Range.prototype.getClientRects||editor.onMouseDown.add(function(editor,e){if(!isDefaultPrevented(e)&&"HTML"===e.target.nodeName){var body=editor.getBody();body.blur(),setTimeout(function(){body.focus()},0)}})}function selectControlElements(){editor.onClick.add(function(editor,e){var target=e.target;/^(IMG|HR)$/.test(target.nodeName)&&(e.preventDefault(),editor.selection.select(target)),"A"==e.nodeName&&dom.hasClass(e,"mce-item-anchor")&&selection.select(target),editor.nodeChanged()})}function removeStylesWhenDeletingAccrossBlockElements(){function getAttributeApplyFunction(){var template=dom.getAttribs(selection.getStart().cloneNode(!1));return function(){var target=selection.getStart();target!==editor.getBody()&&(dom.setAttrib(target,"style",null),each(template,function(attr){target.setAttributeNode(attr.cloneNode(!0))}))}}function isSelectionAcrossElements(){return!selection.isCollapsed()&&dom.getParent(selection.getStart(),dom.isBlock)!=dom.getParent(selection.getEnd(),dom.isBlock)}function blockEvent(editor,e){return e.preventDefault(),!1}editor.onKeyPress.add(function(editor,e){var applyAttributes;if(!isDefaultPrevented(e)&&(8==e.keyCode||46==e.keyCode)&&isSelectionAcrossElements())return applyAttributes=getAttributeApplyFunction(),editor.getDoc().execCommand("delete",!1,null),applyAttributes(),e.preventDefault(),!1}),dom.bind(editor.getDoc(),"cut",function(e){var applyAttributes;!isDefaultPrevented(e)&&isSelectionAcrossElements()&&(applyAttributes=getAttributeApplyFunction(),editor.onKeyUp.addToTop(blockEvent),setTimeout(function(){applyAttributes(),editor.onKeyUp.remove(blockEvent)},0))})}function selectionChangeNodeChanged(){var lastRng,selectionTimer;dom.bind(editor.getDoc(),"selectionchange",function(){selectionTimer&&(clearTimeout(selectionTimer),selectionTimer=0),selectionTimer=window.setTimeout(function(){var rng=selection.getRng();lastRng&&tinymce.dom.RangeUtils.compareRanges(rng,lastRng)||(editor.nodeChanged(),lastRng=rng)},50)})}function ensureBodyHasRoleApplication(){document.body.setAttribute("role","application")}function disableBackspaceIntoATable(){editor.onKeyDown.add(function(editor,e){if(!isDefaultPrevented(e)&&e.keyCode===BACKSPACE&&selection.isCollapsed()&&0===selection.getRng(!0).startOffset){var previousSibling=selection.getNode().previousSibling;if(previousSibling&&previousSibling.nodeName&&"table"===previousSibling.nodeName.toLowerCase())return tinymce.dom.Event.cancel(e)}})}function addNewLinesBeforeBrInPre(){getDocumentMode()>7||(setEditorCommandState("RespectVisibilityInDesign",!0),editor.contentStyles.push(".mceHideBrInPre pre br {display: none}"),dom.addClass(editor.getBody(),"mceHideBrInPre"),parser.addNodeFilter("pre",function(nodes,name){for(var brNodes,j,brElm,sibling,i=nodes.length;i--;)for(brNodes=nodes[i].getAll("br"),j=brNodes.length;j--;)brElm=brNodes[j],sibling=brElm.prev,sibling&&3===sibling.type&&"\n"!=sibling.value.charAt(sibling.value-1)?sibling.value+="\n":brElm.parent.insert(new tinymce.html.Node("#text",3),brElm,!0).value="\n"}),serializer.addNodeFilter("pre",function(nodes,name){for(var brNodes,j,brElm,sibling,i=nodes.length;i--;)for(brNodes=nodes[i].getAll("br"),j=brNodes.length;j--;)brElm=brNodes[j],sibling=brElm.prev,sibling&&3==sibling.type&&(sibling.value=sibling.value.replace(/\r?\n$/,""))}))}function removePreSerializedStylesWhenSelectingControls(){dom.bind(editor.getBody(),"mouseup",function(e){var value,node=selection.getNode();"IMG"==node.nodeName&&((value=dom.getStyle(node,"width"))&&(dom.setAttrib(node,"width",value.replace(/[^0-9%]+/g,"")),dom.setStyle(node,"width","")),(value=dom.getStyle(node,"height"))&&(dom.setAttrib(node,"height",value.replace(/[^0-9%]+/g,"")),dom.setStyle(node,"height","")))})}function keepInlineElementOnDeleteBackspace(){editor.onKeyDown.add(function(editor,e){var isDelete,rng,container,offset,brElm,sibling,collapsed;if(isDelete=e.keyCode==DELETE,!isDefaultPrevented(e)&&(isDelete||e.keyCode==BACKSPACE)&&!VK.modifierPressed(e)&&(rng=selection.getRng(),container=rng.startContainer,offset=rng.startOffset,collapsed=rng.collapsed,3==container.nodeType&&container.nodeValue.length>0&&(0===offset&&!collapsed||collapsed&&offset===(isDelete?0:1)))){if(sibling=container.previousSibling,sibling&&"IMG"==sibling.nodeName)return;nonEmptyElements=editor.schema.getNonEmptyElements(),e.preventDefault(),brElm=dom.create("br",{id:"__tmp"}),container.parentNode.insertBefore(brElm,container),editor.getDoc().execCommand(isDelete?"ForwardDelete":"Delete",!1,null),container=selection.getRng().startContainer,sibling=container.previousSibling,sibling&&1==sibling.nodeType&&!dom.isBlock(sibling)&&dom.isEmpty(sibling)&&!nonEmptyElements[sibling.nodeName.toLowerCase()]&&dom.remove(sibling),dom.remove("__tmp")}})}function removeBlockQuoteOnBackSpace(){editor.onKeyDown.add(function(editor,e){var rng,container,offset,root,parent;if(!isDefaultPrevented(e)&&e.keyCode==VK.BACKSPACE&&(rng=selection.getRng(),container=rng.startContainer,offset=rng.startOffset,root=dom.getRoot(),parent=container,rng.collapsed&&0===offset)){for(;parent&&parent.parentNode&&parent.parentNode.firstChild==parent&&parent.parentNode!=root;)parent=parent.parentNode;"BLOCKQUOTE"===parent.tagName&&(editor.formatter.toggle("blockquote",null,parent),rng=dom.createRng(),rng.setStart(container,0),rng.setEnd(container,0),selection.setRng(rng))}})}function setGeckoEditingOptions(){function setOpts(){editor._refreshContentEditable(),setEditorCommandState("StyleWithCSS",!1),setEditorCommandState("enableInlineTableEditing",!1),settings.object_resizing||setEditorCommandState("enableObjectResizing",!1)}settings.readonly||(editor.onBeforeExecCommand.add(setOpts),editor.onMouseDown.add(setOpts))}function addBrAfterLastLinks(){function fixLinks(editor,o){each(dom.select("a"),function(node){var parentNode=node.parentNode,root=dom.getRoot();if(parentNode.lastChild===node){for(;parentNode&&!dom.isBlock(parentNode);){if(parentNode.parentNode.lastChild!==parentNode||parentNode===root)return;parentNode=parentNode.parentNode}dom.add(parentNode,"br",{"data-mce-bogus":1})}})}editor.onExecCommand.add(function(editor,cmd){"mceInsertLink"===cmd&&fixLinks(editor)}),editor.onSetContent.add(selection.onSetContent.add(fixLinks))}function setDefaultBlockType(){settings.forced_root_block&&editor.onInit.add(function(){setEditorCommandState("DefaultParagraphSeparator",settings.forced_root_block)})}function removeGhostSelection(){function repaint(sender,args){sender&&args.initial||editor.execCommand("mceRepaint")}editor.onUndo.add(repaint),editor.onRedo.add(repaint),editor.onSetContent.add(repaint)}function deleteControlItemOnBackSpace(){editor.onKeyDown.add(function(editor,e){var rng;isDefaultPrevented(e)||e.keyCode!=BACKSPACE||(rng=editor.getDoc().selection.createRange(),rng&&rng.item&&(e.preventDefault(),editor.undoManager.beforeChange(),dom.remove(rng.item(0)),editor.undoManager.add()))})}function renderEmptyBlocksFix(){var emptyBlocksCSS;getDocumentMode()>=10&&(emptyBlocksCSS="",each("p div h1 h2 h3 h4 h5 h6".split(" "),function(name,i){emptyBlocksCSS+=(i>0?",":"")+name+":empty"}),editor.contentStyles.push(emptyBlocksCSS+"{padding-right: 1px !important}"))}function fakeImageResize(){function resizeElement(e){var deltaX,deltaY;deltaX=e.screenX-startX,deltaY=e.screenY-startY,width=deltaX*selectedHandle[2]+startW,height=deltaY*selectedHandle[3]+startH,width=width<5?5:width,height=height<5?5:height,(VK.modifierPressed(e)||"IMG"==selectedElm.nodeName&&selectedHandle[2]*selectedHandle[3]!==0)&&(width=Math.round(height/ratio),height=Math.round(width*ratio)),dom.setStyles(selectedElmGhost,{width:width,height:height}),selectedHandle[2]<0&&selectedElmGhost.clientWidth<=width&&dom.setStyle(selectedElmGhost,"left",selectedElmX+(startW-width)),selectedHandle[3]<0&&selectedElmGhost.clientHeight<=height&&dom.setStyle(selectedElmGhost,"top",selectedElmY+(startH-height))}function endResize(){function setSizeProp(name,value){value&&(selectedElm.style[name]||!editor.schema.isValid(selectedElm.nodeName.toLowerCase(),name)?dom.setStyle(selectedElm,name,value):dom.setAttrib(selectedElm,name,value))}setSizeProp("width",width),setSizeProp("height",height),dom.unbind(editableDoc,"mousemove",resizeElement),dom.unbind(editableDoc,"mouseup",endResize),rootDocument!=editableDoc&&(dom.unbind(rootDocument,"mousemove",resizeElement),dom.unbind(rootDocument,"mouseup",endResize)),dom.remove(selectedElmGhost),showResizeRect(selectedElm)}function showResizeRect(targetElm){var position,targetWidth,targetHeight;hideResizeRect(),position=dom.getPos(targetElm),selectedElmX=position.x,selectedElmY=position.y,targetWidth=targetElm.offsetWidth,targetHeight=targetElm.offsetHeight,selectedElm!=targetElm&&(selectedElm=targetElm,width=height=0),each(resizeHandles,function(handle,name){var handleElm;handleElm=dom.get("mceResizeHandle"+name),handleElm?dom.show(handleElm):(handleElm=dom.add(editableDoc.documentElement,"div",{id:"mceResizeHandle"+name,class:"mceResizeHandle","data-mce-bogus":1,style:"cursor:"+name+"-resize; margin:0; padding:0"}),dom.bind(handleElm,"mousedown",function(e){e.preventDefault(),endResize(),startX=e.screenX,startY=e.screenY,startW=selectedElm.clientWidth,startH=selectedElm.clientHeight,ratio=startH/startW,selectedHandle=handle,selectedElmGhost=selectedElm.cloneNode(!0),dom.addClass(selectedElmGhost,"mceClonedResizable"),dom.setStyles(selectedElmGhost,{left:selectedElmX,top:selectedElmY,margin:0}),editableDoc.documentElement.appendChild(selectedElmGhost),dom.bind(editableDoc,"mousemove",resizeElement),dom.bind(editableDoc,"mouseup",endResize),rootDocument!=editableDoc&&(dom.bind(rootDocument,"mousemove",resizeElement),dom.bind(rootDocument,"mouseup",endResize))})),dom.setStyles(handleElm,{left:targetWidth*handle[0]+selectedElmX-handleElm.offsetWidth/2,top:targetHeight*handle[1]+selectedElmY-handleElm.offsetHeight/2})}),tinymce.isOpera||"IMG"!=selectedElm.nodeName||selectedElm.setAttribute("data-mce-selected","1")}function hideResizeRect(){selectedElm&&selectedElm.removeAttribute("data-mce-selected");for(var name in resizeHandles)dom.hide("mceResizeHandle"+name)}function updateResizeRect(){var controlElm=dom.getParent(selection.getNode(),"table,img");each(dom.select("img[data-mce-selected]"),function(img){img.removeAttribute("data-mce-selected")}),controlElm?showResizeRect(controlElm):hideResizeRect()}var selectedElmX,selectedElmY,selectedElm,selectedElmGhost,selectedHandle,startX,startY,startW,startH,ratio,resizeHandles,width,height,rootDocument=document,editableDoc=editor.getDoc();settings.object_resizing&&settings.webkit_fake_resize!==!1&&(setEditorCommandState("enableObjectResizing",!1),resizeHandles={n:[.5,0,0,-1],e:[1,.5,1,0],s:[.5,1,0,1],w:[0,.5,-1,0],nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},editor.contentStyles.push(".mceResizeHandle {position: absolute;border: 1px solid black;background: #FFF;width: 5px;height: 5px;z-index: 10000}.mceResizeHandle:hover {background: #000}img[data-mce-selected] {outline: 1px solid black}img.mceClonedResizable, table.mceClonedResizable {position: absolute;outline: 1px dashed black;opacity: .5;z-index: 10000}"),editor.onNodeChange.add(updateResizeRect),dom.bind(editableDoc,"selectionchange",updateResizeRect),editor.serializer.addAttributeFilter("data-mce-selected",function(nodes,name){for(var i=nodes.length;i--;)nodes[i].attr(name,null)}))}function keepNoScriptContents(){getDocumentMode()<9&&(parser.addNodeFilter("noscript",function(nodes){for(var node,textNode,i=nodes.length;i--;)node=nodes[i],textNode=node.firstChild,textNode&&node.attr("data-mce-innertext",textNode.value)}),serializer.addNodeFilter("noscript",function(nodes){for(var node,textNode,value,i=nodes.length;i--;)node=nodes[i],textNode=nodes[i].firstChild,textNode?textNode.value=tinymce.html.Entities.decode(textNode.value):(value=node.attributes.map["data-mce-innertext"],value&&(node.attr("data-mce-innertext",null),textNode=new tinymce.html.Node("#text",3),textNode.value=value,textNode.raw=!0,node.append(textNode)))}))}function bodyHeight(){editor.contentStyles.push("body {min-height: 100px}"),editor.onClick.add(function(ed,e){"HTML"==e.target.nodeName&&(editor.execCommand("SelectAll"),editor.selection.collapse(!0),editor.nodeChanged())})}function fixControlSelection(){editor.onInit.add(function(){var selectedRng;editor.getBody().addEventListener("mscontrolselect",function(e){setTimeout(function(){editor.selection.getNode()!=e.target&&(selectedRng=editor.selection.getRng(),selection.fakeRng=editor.dom.createRng(),selection.fakeRng.setStartBefore(e.target),selection.fakeRng.setEndAfter(e.target))},0),"IMG"==e.target.tagName&&(e.preventDefault(),window.setTimeout(function(){editor.selection.select(e.target)},0))},!1),editor.getDoc().addEventListener("selectionchange",function(e){selectedRng&&!tinymce.dom.RangeUtils.compareRanges(editor.selection.getRng(),selectedRng)&&(selection.fakeRng=selectedRng=null)},!1)}),tinymce.isIE12&&editor.onClick.add(function(editor,e){e=e.target,/^(IMG|HR|TABLE)$/.test(e.nodeName)&&selection.select(e),"A"==e.nodeName&&dom.hasClass(e,"mce-item-anchor")&&selection.select(e),editor.nodeChanged()})}function imageFloatLinkBug(){editor.onBeforeExecCommand.add(function(ed,cmd,ui,v,o){if("mceInsertLink"==cmd){var se=ed.selection,n=se.getNode();n&&"IMG"==n.nodeName&&(ed.dom.setAttrib(n,"data-mce-style",n.style.cssText),n.style.cssText=null)}}),editor.onExecCommand.add(function(ed,cmd,ui,v,o){if("mceInsertLink"==cmd){var se=ed.selection,n=se.getNode();tinymce.each(ed.dom.select("img[data-mce-style]",n),function(el){"A"!=el.parentNode.nodeName||el.style.cssText||(el.style.cssText=ed.dom.getAttrib(el,"data-mce-style"))})}})}var VK=tinymce.VK,BACKSPACE=VK.BACKSPACE,DELETE=VK.DELETE,dom=editor.dom,selection=editor.selection,settings=editor.settings,parser=editor.parser,serializer=editor.serializer,each=tinymce.each;disableBackspaceIntoATable(),removeBlockQuoteOnBackSpace(),emptyEditorWhenDeleting(),tinymce.isWebKit&&(keepInlineElementOnDeleteBackspace(),cleanupStylesWhenDeleting(),inputMethodFocus(),selectControlElements(),setDefaultBlockType(),imageFloatLinkBug(),tinymce.isIDevice?selectionChangeNodeChanged():(fakeImageResize(),selectAll())),tinymce.isIE&&!tinymce.isIE11&&(removeHrOnBackspace(),ensureBodyHasRoleApplication(),addNewLinesBeforeBrInPre(),removePreSerializedStylesWhenSelectingControls(),deleteControlItemOnBackSpace(),renderEmptyBlocksFix(),keepNoScriptContents()),tinymce.isIE11&&(bodyHeight(),fixControlSelection(),fakeImageResize()),tinymce.isIE12&&(fixControlSelection(), fakeImageResize()),tinymce.isGecko&&!tinymce.isIE11&&(removeHrOnBackspace(),focusBody(),removeStylesWhenDeletingAccrossBlockElements(),setGeckoEditingOptions(),addBrAfterLastLinks(),removeGhostSelection()),tinymce.isOpera&&fakeImageResize()},function(tinymce){function nativeDecode(text){var elm;return elm=document.createElement("div"),elm.innerHTML=text,elm.textContent||elm.innerText||text}function buildEntitiesLookup(items,radix){var i,chr,entity,lookup={};if(items){for(items=items.split(","),radix=radix||10,i=0;i\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,textCharsRegExp=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,rawCharsRegExp=/[<>&\"\']/g,entityRegExp=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,asciiMap={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};baseEntities={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},reverseEntities={"<":"<",">":">","&":"&",""":'"',"'":"'"},namedEntities=buildEntitiesLookup("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),tinymce.html=tinymce.html||{},tinymce.html.Entities={encodeRaw:function(text,attr){return text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return baseEntities[chr]||chr})},encodeAllRaw:function(text){return(""+text).replace(rawCharsRegExp,function(chr){return baseEntities[chr]||chr})},encodeNumeric:function(text,attr){return text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return chr.length>1?"&#"+(1024*(chr.charCodeAt(0)-55296)+(chr.charCodeAt(1)-56320)+65536)+";":baseEntities[chr]||"&#"+chr.charCodeAt(0)+";"})},encodeNamed:function(text,attr,entities){return entities=entities||namedEntities,text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return baseEntities[chr]||entities[chr]||chr})},getEncodeFunc:function(name,entities){function encodeNamedAndNumeric(text,attr){return text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return baseEntities[chr]||entities[chr]||"&#"+chr.charCodeAt(0)+";"||chr})}function encodeCustomNamed(text,attr){return Entities.encodeNamed(text,attr,entities)}var Entities=tinymce.html.Entities;return entities=buildEntitiesLookup(entities)||namedEntities,name=tinymce.makeMap(name.replace(/\+/g,",")),name.named&&name.numeric?encodeNamedAndNumeric:name.named?entities?encodeCustomNamed:Entities.encodeNamed:name.numeric?Entities.encodeNumeric:Entities.encodeRaw},decode:function(text){return text.replace(entityRegExp,function(all,numeric){return numeric?(numeric="x"===numeric.charAt(0).toLowerCase()?parseInt(numeric.substr(1),16):parseInt(numeric,10),numeric>65535?(numeric-=65536,String.fromCharCode(55296+(numeric>>10),56320+(1023&numeric))):asciiMap[numeric]||String.fromCharCode(numeric)):reverseEntities[all]||namedEntities[all]||nativeDecode(all)})}}}(tinymce),tinymce.html.Styles=function(settings,schema){function toHex(match,r,g,b){function hex(val){return val=parseInt(val,10).toString(16),val.length>1?val:"0"+val}return"#"+hex(r)+hex(g)+hex(b)}var undef,i,encodingItems,validStyles,invalidStyles,rgbRegExp=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,urlOrStrRegExp=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,styleRegExp=/\s*([^:]+):\s*([^;]+);?/g,trimRightRegExp=/\s+$/,encodingLookup={},invisibleChar="\ufeff";for(settings=settings||{},schema&&(validStyles=schema.getValidStyles(),invalidStyles=schema.getInvalidStyles()),encodingItems=("\\\" \\' \\; \\: ; : "+invisibleChar).split(" "),i=0;i-1&&noJoin||(styles[prefix+suffix]=i==-1?box[0]:box.join(" "),delete styles[prefix+"-top"+suffix],delete styles[prefix+"-right"+suffix],delete styles[prefix+"-bottom"+suffix],delete styles[prefix+"-left"+suffix])}}function canCompress(key){var i,value=styles[key];if(value){for(value=value.split(" "),i=value.length;i--;)if(value[i]!==value[0])return!1;return styles[key]=value[0],!0}}function compress2(target,a,b,c){canCompress(a)&&canCompress(b)&&canCompress(c)&&(styles[target]=styles[a]+" "+styles[b]+" "+styles[c],delete styles[a],delete styles[b],delete styles[c])}function encode(str){return isEncoded=!0,encodingLookup[str]}function decode(str,keep_slashes){return isEncoded&&(str=str.replace(/\uFEFF[0-9]/g,function(str){return encodingLookup[str]})),keep_slashes||(str=str.replace(/\\([\'\";:])/g,"$1")),str}function processUrl(match,url,url2,url3,str,str2){if(str=str||str2)return str=decode(str),"'"+str.replace(/\'/g,"\\'")+"'";if(url=decode(url||url2||url3),!settings.allow_script_urls){var scriptUrl=url.replace(/[\s\r\n]+/,"");if(/(java|vb)script:/i.test(scriptUrl))return"";if(!settings.allow_svg_data_urls&&/^data:image\/svg/i.test(scriptUrl))return""}return urlConverter&&(url=urlConverter.call(urlConverterScope,url,"style")),"url('"+url.replace(/\'/g,"\\'")+"')"}var matches,name,value,isEncoded,styles={},urlConverter=settings.url_converter,urlConverterScope=settings.url_converter_scope||this;if(css){for(css=css.replace(/[\u0000-\u001F]/g,""),css=css.replace(/\\[\"\';:\uFEFF]/g,encode).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(str){return str.replace(/[;:]/g,encode)});matches=styleRegExp.exec(css);){if(name=matches[1].replace(trimRightRegExp,"").toLowerCase(),value=matches[2].replace(trimRightRegExp,""),value=value.replace(/\\[0-9a-f]+/g,function(e){return String.fromCharCode(parseInt(e.substr(1),16))}),name&&value.length>0){if(!settings.allow_script_urls&&("behavior"==name||/expression\s*\(|\/\*|\*\//.test(value)))continue;"font-weight"===name&&"700"===value?value="bold":"color"!==name&&"background-color"!==name||(value=value.toLowerCase()),value=value.replace(rgbRegExp,toHex),value=value.replace(urlOrStrRegExp,processUrl),styles[name]=isEncoded?decode(value,!0):value}styleRegExp.lastIndex=matches.index+matches[0].length}compress("border","",!0),compress("border","-width"),compress("border","-color"),compress("border","-style"),compress("padding",""),compress("margin",""),compress2("border","border-width","border-style","border-color"),"medium none"===styles.border&&delete styles.border,"none"===styles["border-image"]&&delete styles["border-image"]}return styles},serialize:function(styles,elementName){function serializeStyles(name){var styleList,i,l,value;if(styleList=validStyles[name])for(i=0,l=styleList.length;i0&&(css+=(css.length>0?" ":"")+name+": "+value+";")}function isValid(name,elementName){var styleMap;return styleMap=invalidStyles["*"],(!styleMap||!styleMap[name])&&(styleMap=invalidStyles[elementName],!styleMap||!styleMap[name])}var name,value,css="";if(elementName&&validStyles)serializeStyles("*"),serializeStyles(elementName);else for(name in styles)value=styles[name],value!==undef&&value.length>0&&(invalidStyles&&!isValid(name,elementName)||(css+=(css.length>0?" ":"")+name+": "+value+";"));return css}}},function(tinymce){function split(items,delim){return items?items.split(delim||" "):[]}function compileSchema(type){function add(name,attributes,children){function arrayToMap(array,obj){var i,l,map={};for(i=0,l=array.length;i