tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(t,e){var n=this;t.onKeyDown.addToTop((function(t,e){if(13==e.keyCode)return n.handleEnter(t)})),tinyMCE.isIE||(t.onKeyPress.add((function(t,e){if(41==e.which)return n.handleEclipse(t)})),t.onKeyUp.add((function(t,e){if(32==e.keyCode)return n.handleSpacebar(t)})))},handleEclipse:function(t){this.parseCurrentLine(t,-1,"(",!0)},handleSpacebar:function(t){this.parseCurrentLine(t,0,"",!0)},handleEnter:function(t){this.parseCurrentLine(t,-1,"",!1)},parseCurrentLine:function(t,e,n,i){var o,r,s,a,l,d,c,f,u;if((o=t.selection.getRng(!0).cloneRange()).startOffset<5){if(null==(c=o.endContainer.previousSibling)){if(null==o.endContainer.firstChild||null==o.endContainer.firstChild.nextSibling)return;c=o.endContainer.firstChild.nextSibling}if(f=c.length,o.setStart(c,f),o.setEnd(c,f),o.endOffset<5)return;r=o.endOffset,a=c}else{if(3!=(a=o.endContainer).nodeType&&a.firstChild){for(;3!=a.nodeType&&a.firstChild;)a=a.firstChild;3==a.nodeType&&(o.setStart(a,0),o.setEnd(a,a.nodeValue.length))}r=1==o.endOffset?2:o.endOffset-1-e}s=r;do{o.setStart(a,r>=2?r-2:0),o.setEnd(a,r>=1?r-1:0),r-=1}while(" "!=o.toString()&&""!=o.toString()&&160!=o.toString().charCodeAt(0)&&r-2>=0&&o.toString()!=n);if(o.toString()==n||160==o.toString().charCodeAt(0)?(o.setStart(a,r),o.setEnd(a,s),r+=1):0==o.startOffset?(o.setStart(a,0),o.setEnd(a,s)):(o.setStart(a,r),o.setEnd(a,s)),"."==(u=o.toString()).charAt(u.length-1)&&o.setEnd(a,s-1),(d=(u=o.toString()).match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i))&&("www."==d[1]?d[1]="http://www.":/@$/.test(d[1])&&!/^mailto:/.test(d[1])&&(d[1]="mailto:"+d[1]),l=t.selection.getBookmark(),t.selection.setRng(o),tinyMCE.execCommand("createlink",!1,d[1]+d[2]),t.selection.moveToBookmark(l),t.nodeChanged(),tinyMCE.isWebKit)){t.selection.collapse(!1);var h=Math.min(a.length,s+1);o.setStart(a,h),o.setEnd(a,h),t.selection.setRng(o)}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}}),tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin);
