(function(u){var B=0;u.fn.wmd=function(E){this.each(function(){var z=u.extend({},E||{},{preview:true});if(!z.button_bar){z.button_bar="wmd-button-bar-"+B;u("<div/>").attr("class","wmd-button-bar").attr("id",z.button_bar).insertBefore(this)}if(typeof z.preview=="boolean"&&z.preview){z.preview="wmd-preview-"+B;u("<div/>").attr("class","wmd-preview").attr("id",z.preview).insertAfter(this)}if(typeof z.output=="boolean"&&z.output){z.output="wmd-output-"+B;u("<div/>").attr("class","wmd-output").attr("id",
z.output).insertAfter(this)}this.id=this.id||"wmd-input-"+B;z.input=this.id;setup_wmd(z);B++})}})(jQuery);var Attacklab=Attacklab||{};Attacklab.showdown=Attacklab.showdown||{};
Attacklab.showdown.converter=function(){var u,B,E,z=0;this.makeHtml=function(b){u=[];B=[];E=[];b=b.replace(/~/g,"~T");b=b.replace(/\$/g,"~D");b=b.replace(/\r\n/g,"\n");b=b.replace(/\r/g,"\n");b=s("\n\n"+b+"\n\n");b=b.replace(/^[ \t]+$/mg,"");b=H(b);b=I(b);b=r(b);b=w(b);b=b.replace(/~D/g,"$$");b=b.replace(/~T/g,"~");b=b.replace(/https?\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!]/g,function(e){var h=RegExp.rightContext;if(RegExp.leftContext.match(/<[^>]+$/)&&h.match(/^[^>]*>/))return e;return"<a href='"+
e+"'>"+e+"</a>"});return b=b.replace(/[a-z0-9_\-+=.]+@[a-z0-9\-]+(\.[a-z0-9-]+)+/ig,function(e){return"<a href='mailto:"+e+"'>"+e+"</a>"})};var I=function(b){return b=b.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(e,h,n,l,v){h=h.toLowerCase();u[h]=m(n);if(l)return l+v;else if(v)B[h]=v.replace(/"/g,"&quot;");return""})},H=function(b){b=b.replace(/\n/g,"\n\n");b=b.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,
G);b=b.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,G);b=b.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,G);b=b.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,G);b=b.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,G);return b=b.replace(/\n\n/g,"\n")},G=function(b,e){var h;h=e.replace(/\n\n/g,"\n");h=h.replace(/^\n/,"");h=h.replace(/\n+$/g,"");return h="\n\n~K"+
(E.push(h)-1)+"K\n\n"},r=function(b){b=c(b);var e=a("<hr />");b=b.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,e);b=b.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,e);b=b.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,e);b=g(b);b=d(b);b=k(b);b=H(b);b=b.replace(/^\n+/g,"");b=b.replace(/\n+$/g,"");var h=b.split(/\n{2,}/g);b=[];e=h.length;for(var n=0;n<e;n++){var l=h[n];if(l.search(/~K(\d+)K/g)>=0)b.push(l);else if(l.search(/\S/)>=0){l=y(l);l=l.replace(/\n/g,"<br />");l=l.replace(/^([ \t]*)/g,"<p>");l+=
"</p>";b.push(l)}}e=b.length;for(n=0;n<e;n++)for(;b[n].search(/~K(\d+)K/)>=0;){h=E[RegExp.$1];h=h.replace(/\$/g,"$$$$");b[n]=b[n].replace(/~K\d+K/,h)}return b=b.join("\n\n")},y=function(b){b=f(b);b=F(b);b=b.replace(/\\(\\)/g,i);b=b.replace(/\\([`*_{}\[\]()>#+-.!])/g,i);b=b.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,J);b=b.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,J);b=b.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,C);b=
b.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,C);b=b.replace(/(\[([^\[\]]+)\])()()()()()/g,C);b=q(b);b=m(b);b=b.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");b=b.replace(/(\w)_(\w)/g,"$1~E95E$2");b=b.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");return b=b.replace(/  +\n/g," <br />\n")},F=function(b){return b=b.replace(/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi,function(e){e=e.replace(/(.)<\/?code>(?=.)/g,
"$1`");return e=t(e,"\\`*_")})},C=function(b,e,h,n,l,v,D,x){if(x==undefined)x="";b=n.toLowerCase();if(l==""){if(b=="")b=h.toLowerCase().replace(/ ?\n/g," ");if(u[b]!=undefined){l=u[b];if(B[b]!=undefined)x=B[b]}else if(e.search(/\(\s*\)$/m)>-1)l="";else return e}l=t(l,"*_");e='<a href="'+l+'"';if(x!=""){x=x.replace(/"/g,"&quot;");x=t(x,"*_");e+=' title="'+x+'"'}e+=">"+h+"</a>";return e},J=function(b,e,h,n,l,v,D,x){b=h;n=n.toLowerCase();x||(x="");if(l==""){if(n=="")n=b.toLowerCase().replace(/ ?\n/g,
" ");if(u[n]!=undefined){l=u[n];if(B[n]!=undefined)x=B[n]}else return e}b=b.replace(/"/g,"&quot;");l=t(l,"*_");e='<img src="'+l+'" alt="'+b+'"';x=x.replace(/"/g,"&quot;");x=t(x,"*_");e+=' title="'+x+'"';e+=" />";return e},c=function(b){b=b.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,h){return a("<h1>"+y(h)+"</h1>")});b=b.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,h){return a("<h2>"+y(h)+"</h2>")});return b=b.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,h,n){e=h.length;return a("<h"+
e+">"+y(n)+"</h"+e+">")})},j,g=function(b){b+="~0";var e=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(z)b=b.replace(e,function(h,n,l){h=n;l=l.search(/[*+-]/g)>-1?"ul":"ol";h=h.replace(/\n{2,}/g,"\n\n\n");h=j(h);h=h.replace(/\s+$/,"");return"<"+l+">"+h+"</"+l+">\n"});else{e=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;b=b.replace(e,function(h,n,l,v){h=l;v=v.search(/[*+-]/g)>-1?"ul":"ol";h=
h.replace(/\n{2,}/g,"\n\n\n");h=j(h);return n+"<"+v+">\n"+h+"</"+v+">\n"})}return b=b.replace(/~0/,"")};j=function(b){z++;b=b.replace(/\n{2,}$/,"\n");b+="~0";b=b.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(e,h,n,l,v){e=v;if(h||e.search(/\n{2,}/)>-1)e=r(A(e));else{e=g(A(e));e=e.replace(/\n$/,"");e=y(e)}return"<li>"+e+"</li>\n"});b=b.replace(/~0/g,"");z--;return b};var d=function(b){b+="~0";b=b.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
function(e,h,n){e=o(A(h));e=s(e);e=e.replace(/^\n+/g,"");e=e.replace(/\n+$/g,"");return a("<pre><code>"+e+"\n</code></pre>")+n});return b=b.replace(/~0/,"")},a=function(b){b=b.replace(/(^\n+|\n+$)/g,"");return"\n\n~K"+(E.push(b)-1)+"K\n\n"},f=function(b){return b=b.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,h,n,l){e=l.replace(/^([ \t]*)/g,"");e=e.replace(/[ \t]*$/g,"");e=o(e);return h+"<code>"+e+"</code>"})},o=function(b){b=b.replace(/&/g,"&amp;");b=b.replace(/</g,"&lt;");b=b.replace(/>/g,
"&gt;");return b=t(b,"*_{}[]\\",false)},k=function(b){return b=b.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,h){var n;n=h.replace(/^[ \t]*>[ \t]?/gm,"~0");n=n.replace(/~0/g,"");n=n.replace(/^[ \t]+$/gm,"");n=r(n);n=n.replace(/(^|\n)/g,"$1  ");n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(l,v){var D;D=v.replace(/^  /mg,"~0");return D=D.replace(/~0/g,"")});return a("<blockquote>\n"+n+"\n</blockquote>")})},m=function(b){b=b.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");return b=
b.replace(/<(?![a-z\/?\$!])/gi,"&lt;")},q=function(b){b=b.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>');return b=b.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,h){return p(w(h))})},p=function(b){var e=[function(h){return"&#"+h.charCodeAt(0)+";"},function(h){h=h.charCodeAt(0);return"&#x"+("0123456789ABCDEF".charAt(h>>4)+"0123456789ABCDEF".charAt(h&15))+";"},function(h){return h}];b=("mailto:"+b).replace(/./g,function(h){if(h=="@")h=e[Math.floor(Math.random()*
2)](h);else if(h!=":"){var n=Math.random();h=n>0.9?e[2](h):n>0.45?e[1](h):e[0](h)}return h});return b=('<a href="'+b+'">'+b+"</a>").replace(/">.+:/g,'">')},w=function(b){return b=b.replace(/~E(\d+)E/g,function(e,h){var n=parseInt(h);return String.fromCharCode(n)})},A=function(b){b=b.replace(/^(\t|[ ]{1,4})/gm,"~0");return b=b.replace(/~0/g,"")},s=function(b){b=b.replace(/\t(?=\t)/g,"    ");b=b.replace(/\t/g,"~A~B");b=b.replace(/~B(.+?)~A/g,function(e,h){for(var n=h,l=4-n.length%4,v=0;v<l;v++)n+=" ";
return n});b=b.replace(/~A/g,"    ");return b=b.replace(/~B/g,"")},t=function(b,e,h){e="(["+e.replace(/([\[\]\\])/g,"\\$1")+"])";if(h)e="\\\\"+e;return b=b.replace(RegExp(e,"g"),i)},i=function(b,e){return"~E"+e.charCodeAt(0)+"E"}};var Showdown=Attacklab.showdown;Attacklab.fileLoaded&&Attacklab.fileLoaded("showdown.js");(function(){WMDEditor=function(c){this.options=WMDEditor.util.extend({},WMDEditor.defaults,c||{});J(this,this.options);this.startEditor()};top.WMDEditor=WMDEditor;WMDEditor.defaults={version:2,output_format:"markdown",lineLength:40,button_bar:"wmd-button-bar",preview:"wmd-preview",output:"wmd-output",input:"wmd-input",imageDialogText:"<p style='margin-top: 0px'><b>Enter the image URL.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://wmd-editor.com/images/cloud1.jpg   \"Optional title\"</p>",
linkDialogText:"<p style='margin-top: 0px'><b>Enter the web address.</b></p><p>You can also add a title, which will be displayed as a tool tip.</p><p>Example:<br />http://wmd-editor.com/   \"Optional title\"</p>",imageDefaultText:"http://",linkDefaultText:"http://",imageDirectory:"images/",helpLink:"http://wmd-editor.com/",helpHoverTitle:"WMD website",helpTarget:"_blank",previewPollInterval:500,pastePollInterval:100,buttons:"bold italic link blockquote code image ol ul heading hr"};WMDEditor.prototype=
{getPanels:function(){return{buttonBar:r.getElementById(this.options.button_bar),preview:r.getElementById(this.options.preview),output:r.getElementById(this.options.output),input:r.getElementById(this.options.input)}},startEditor:function(){this.panels=this.getPanels();this.previewMgr=new H(this);edit=new this.editor(this.previewMgr.refresh);this.previewMgr.refresh(true)}};var u={isVisible:function(c){return c.offsetWidth>0||c.offsetHeight>0},addEvent:function(c,j,g){c.attachEvent?c.attachEvent("on"+
j,g):c.addEventListener(j,g,false)},removeEvent:function(c,j,g){c.detachEvent?c.detachEvent("on"+j,g):c.removeEventListener(j,g,false)},fixEolChars:function(c){c=c.replace(/\r\n/g,"\n");return c=c.replace(/\r/g,"\n")},extendRegExp:function(c,j,g){if(j===null||j===undefined)j="";if(g===null||g===undefined)g="";c=c.toString();var d="";d=c.match(/\/([gim]*)$/);d=d===null?d[0]:"";c=c.replace(/(^\/|\/[gim]*$)/g,"");return RegExp(j+c+g,d)},createImage:function(c){c=imageDirectory+c;var j=r.createElement("img");
j.className="wmd-button";j.src=c;return j},prompt:function(c,j,g){var d,a,f;if(j===undefined)j="";var o=function(q){(q.charCode||q.keyCode)===27&&k(true)},k=function(q){u.removeEvent(r.body,"keydown",o);var p=f.value;if(q)p=null;else{p=p.replace("http://http://","http://");p=p.replace("http://https://","https://");p=p.replace("http://ftp://","ftp://");if(p.indexOf("http://")===-1&&p.indexOf("ftp://")===-1&&p.indexOf("https://")===-1)p="http://"+p}d.parentNode.removeChild(d);a.parentNode.removeChild(a);
g(p);return false},m=function(){d=r.createElement("div");d.className="wmd-prompt-dialog";d.style.padding="10px;";d.style.position="fixed";d.style.width="400px";d.style.zIndex="1001";var q=r.createElement("div");q.innerHTML=c;q.style.padding="5px";d.appendChild(q);q=r.createElement("form");q.onsubmit=function(){return k(false)};style=q.style;style.padding="0";style.margin="0";style.cssFloat="left";style.width="100%";style.textAlign="center";style.position="relative";d.appendChild(q);f=r.createElement("input");
f.type="text";f.value=j;style=f.style;style.display="block";style.width="80%";style.marginLeft=style.marginRight="auto";q.appendChild(f);var p=r.createElement("input");p.type="button";p.onclick=function(){return k(false)};p.value="OK";style=p.style;style.margin="10px";style.display="inline";style.width="7em";var w=r.createElement("input");w.type="button";w.onclick=function(){return k(true)};w.value="Cancel";style=w.style;style.margin="10px";style.display="inline";style.width="7em";if(/mac/.test(F.platform.toLowerCase())){q.appendChild(w);
q.appendChild(p)}else{q.appendChild(p);q.appendChild(w)}u.addEvent(r.body,"keydown",o);d.style.top="50%";d.style.left="50%";d.style.display="block";if(C.isIE_5or6){d.style.position="absolute";d.style.top=r.documentElement.scrollTop+200+"px";d.style.left="50%"}r.body.appendChild(d);d.style.marginTop=-(B.getHeight(d)/2)+"px";d.style.marginLeft=-(B.getWidth(d)/2)+"px"};(function(){a=r.createElement("div");a.className="wmd-prompt-background";style=a.style;style.position="absolute";style.top="0";style.zIndex=
"1000";if(C.isKonqueror)style.backgroundColor="transparent";else if(C.isIE)style.filter="alpha(opacity=50)";else style.opacity="0.5";var q=B.getPageSize();style.height=q[1]+"px";if(C.isIE){style.left=r.documentElement.scrollLeft;style.width=r.documentElement.clientWidth}else{style.left="0";style.width="100%"}r.body.appendChild(a)})();top.setTimeout(function(){m();var q=j.length;if(f.selectionStart!==undefined){f.selectionStart=0;f.selectionEnd=q}else if(f.createTextRange){var p=f.createTextRange();
p.collapse(false);p.moveStart("character",-q);p.moveEnd("character",q);p.select()}f.focus()},0)},extend:function(){function c(d,a){for(var f in a)d[f]=a[f];return d}for(var j={},g=0;g<arguments.length;g++)c(j,arguments[g]);return j}},B={getTop:function(c,j){var g=c.offsetTop;if(!j)for(;c=c.offsetParent;)g+=c.offsetTop;return g},getHeight:function(c){return c.offsetHeight||c.scrollHeight},getWidth:function(c){return c.offsetWidth||c.scrollWidth},getPageSize:function(){var c,j,g,d;if(self.innerHeight&&
self.scrollMaxY){c=r.body.scrollWidth;j=self.innerHeight+self.scrollMaxY}else if(r.body.scrollHeight>r.body.offsetHeight){c=r.body.scrollWidth;j=r.body.scrollHeight}else{c=r.body.offsetWidth;j=r.body.offsetHeight}if(self.innerHeight){g=self.innerWidth;d=self.innerHeight}else if(r.documentElement&&r.documentElement.clientHeight){g=r.documentElement.clientWidth;d=r.documentElement.clientHeight}else if(r.body){g=r.body.clientWidth;d=r.body.clientHeight}return[Math.max(c,g),Math.max(j,d),g,d]}},E=function(c){var j=
this;this.init=function(){if(u.isVisible(c)){this.setInputAreaSelectionStartEnd();this.scrollTop=c.scrollTop;if(!this.text&&c.selectionStart||c.selectionStart===0)this.text=c.value}};this.setInputAreaSelection=function(){if(u.isVisible(c))if(c.selectionStart!==undefined&&!C.isOpera){c.focus();c.selectionStart=j.start;c.selectionEnd=j.end;c.scrollTop=j.scrollTop}else if(r.selection)if(!(r.activeElement&&r.activeElement!==c)){c.focus();var g=c.createTextRange();g.moveStart("character",-c.value.length);
g.moveEnd("character",-c.value.length);g.moveEnd("character",j.end);g.moveStart("character",j.start);g.select()}};this.setInputAreaSelectionStartEnd=function(){if(c.selectionStart||c.selectionStart===0){j.start=c.selectionStart;j.end=c.selectionEnd}else if(r.selection){j.text=u.fixEolChars(c.value);var g;if(wmd.ieRetardedClick&&wmd.ieCachedRange){g=wmd.ieCachedRange;wmd.ieRetardedClick=false}else g=r.selection.createRange();var d=u.fixEolChars(g.text),a="\u0007"+d+"\u0007";g.text=a;var f=u.fixEolChars(c.value);
g.moveStart("character",-a.length);g.text=d;j.start=f.indexOf("\u0007");j.end=f.lastIndexOf("\u0007")-1;if(a=j.text.length-u.fixEolChars(c.value).length){for(g.moveStart("character",-d.length);a--;){d+="\n";j.end+=1}g.text=d}this.setInputAreaSelection()}};this.restore=function(){if(j.text!=undefined&&j.text!=c.value)c.value=j.text;this.setInputAreaSelection();c.scrollTop=j.scrollTop};this.getChunks=function(){var g=new z;g.before=u.fixEolChars(j.text.substring(0,j.start));g.startTag="";g.selection=
u.fixEolChars(j.text.substring(j.start,j.end));g.endTag="";g.after=u.fixEolChars(j.text.substring(j.end));g.scrollTop=j.scrollTop;return g};this.setChunks=function(g){g.before+=g.startTag;g.after=g.endTag+g.after;if(C.isOpera){g.before=g.before.replace(/\n/g,"\r\n");g.selection=g.selection.replace(/\n/g,"\r\n");g.after=g.after.replace(/\n/g,"\r\n")}this.start=g.before.length;this.end=g.before.length+g.selection.length;this.text=g.before+g.selection+g.after;this.scrollTop=g.scrollTop};this.init()},
z=function(){};z.prototype.findTags=function(c,j){var g=this,d;if(c){d=u.extendRegExp(c,"","$");this.before=this.before.replace(d,function(a){g.startTag+=a;return""});d=u.extendRegExp(c,"^","");this.selection=this.selection.replace(d,function(a){g.startTag+=a;return""})}if(j){d=u.extendRegExp(j,"","$");this.selection=this.selection.replace(d,function(a){g.endTag=a+g.endTag;return""});d=u.extendRegExp(j,"^","");this.after=this.after.replace(d,function(a){g.endTag=a+g.endTag;return""})}};z.prototype.trimWhitespace=
function(c){this.selection=this.selection.replace(/^(\s*)/,"");c||(this.before+=y.$1);this.selection=this.selection.replace(/(\s*)$/,"");if(!c)this.after=y.$1+this.after};z.prototype.addBlankLines=function(c,j,g){if(c===undefined)c=1;if(j===undefined)j=1;c++;j++;var d,a;this.selection=this.selection.replace(/(^\n*)/,"");this.startTag+=y.$1;this.selection=this.selection.replace(/(\n*$)/,"");this.endTag+=y.$1;this.startTag=this.startTag.replace(/(^\n*)/,"");this.before+=y.$1;this.endTag=this.endTag.replace(/(\n*$)/,
"");this.after+=y.$1;if(this.before){for(d=a="";c--;){d+="\\n?";a+="\n"}if(g)d="\\n*";this.before=this.before.replace(new y(d+"$",""),a)}if(this.after){for(d=a="";j--;){d+="\\n?";a+="\n"}if(g)d="\\n*";this.after=this.after.replace(new y(d,""),a)}};var I=function(c,j,g){var d=this,a,f,o,k;this.tick=function(){if(u.isVisible(c)){if(c.selectionStart||c.selectionStart===0){var m=c.selectionStart,q=c.selectionEnd;if(m!=a||q!=f){a=m;f=q;if(o!=c.value){o=c.value;return true}}}return false}};this.destroy=
function(){top.clearInterval(k)};k=top.setInterval(function(){u.isVisible(c)&&d.tick()&&j()},g)},H=function(c){var j=this,g,d,a,f,o,k,m="delayed",q=function(){var i=0;if(top.innerHeight)i=top.pageYOffset;else if(r.documentElement&&r.documentElement.scrollTop)i=r.documentElement.scrollTop;else if(r.body)i=r.body.scrollTop;return i},p=function(){if(c.panels.preview||c.panels.output){var i=c.panels.input.value;if(!(i&&i==o)){o=i;var b=(new Date).getTime();if(!g&&c.showdown)g=new c.showdown.converter;
if(g)i=g.makeHtml(i);f=(new Date).getTime()-b;t(i);k=i}}},w=function(){if(a){top.clearTimeout(a);a=undefined}if(m!=="manual"){var i=0;if(m==="delayed")i=f;if(i>3E3)i=3E3;a=top.setTimeout(p,i)}},A=function(i){if(i.scrollHeight<=i.clientHeight)return 1;return i.scrollTop/(i.scrollHeight-i.clientHeight)};this.refresh=function(i){if(i){o="";p()}else w()};this.processingTime=function(){return f};this.output=function(){return k};this.setUpdateMode=function(i){m=i;j.refresh()};var s=true,t=function(i){var b=
B.getTop(c.panels.input)-q();if(c.panels.output)if(c.panels.output.value!==undefined){c.panels.output.value=i;c.panels.output.readOnly=true}else{var e=i.replace(/&/g,"&amp;");e=e.replace(/</g,"&lt;");c.panels.output.innerHTML="<pre><code>"+e+"</code></pre>"}if(c.panels.preview)c.panels.preview.innerHTML=i;if(c.panels.preview)c.panels.preview.scrollTop=(c.panels.preview.scrollHeight-c.panels.preview.clientHeight)*A(c.panels.preview);if(c.panels.output)c.panels.output.scrollTop=(c.panels.output.scrollHeight-
c.panels.output.clientHeight)*A(c.panels.output);if(s)s=false;else{var h=B.getTop(c.panels.input)-q();C.isIE?top.setTimeout(function(){top.scrollBy(0,h-b)},0):top.scrollBy(0,h-b)}};this.destroy=function(){d&&d.destroy()};(function(i,b){u.addEvent(i,"input",b);i.onpaste=b;i.ondrop=b;u.addEvent(i,"keypress",b);u.addEvent(i,"keydown",b);d=new I(c.panels.input,b,c.options.previewPollInterval)})(c.panels.input,w);p();if(c.panels.preview)c.panels.preview.scrollTop=0;if(c.panels.output)c.panels.output.scrollTop=
0},G=function(c,j,g){var d=this,a=[],f=0,o="none",k,m,q,p,w=function(b,e){if(o!=b){o=b;e||s()}if(!C.isIE||o!="moving")q=top.setTimeout(A,1);else p=null},A=function(){p=new E(c);m.tick();q=undefined};this.setCommandMode=function(){o="command";s();q=top.setTimeout(A,0)};this.canUndo=function(){return f>1};this.canRedo=function(){if(a[f+1])return true;return false};this.undo=function(){if(d.canUndo())if(k){k.restore();k=null}else{a[f]=new E(c);a[--f].restore();g&&g()}o="none";c.focus();A()};this.redo=
function(){if(d.canRedo()){a[++f].restore();g&&g()}o="none";c.focus();A()};var s=function(){var b=p||new E(c);if(!b)return false;if(o=="moving")k||(k=b);else{if(k){if(a[f-1].text!=k.text)a[f++]=k;k=null}a[f++]=b;a[f+1]=null;g&&g()}},t=function(b){var e=false;if(b.ctrlKey||b.metaKey)switch(String.fromCharCode(b.charCode||b.keyCode)){case "y":d.redo();e=true;break;case "z":b.shiftKey?d.redo():d.undo();e=true}if(e){b.preventDefault&&b.preventDefault();if(top.event)top.event.returnValue=false}},i=function(b){if(!b.ctrlKey&&
!b.metaKey){b=b.keyCode;if(b>=33&&b<=40||b>=63232&&b<=63235)w("moving");else if(b==8||b==46||b==127)w("deleting");else if(b==13)w("newlines");else if(b==27)w("escape");else if((b<16||b>20)&&b!=91)w("typing")}};this.destroy=function(){m&&m.destroy()};(function(){u.addEvent(c,"keypress",function(e){if((e.ctrlKey||e.metaKey)&&(e.keyCode==89||e.keyCode==90))e.preventDefault()});var b=function(){if(C.isIE||p&&p.text!=c.value)if(q==undefined){o="paste";s();A()}};m=new I(c,b,j);u.addEvent(c,"keydown",t);
u.addEvent(c,"keydown",i);u.addEvent(c,"mousedown",function(){w("moving")});c.onpaste=b;c.ondrop=b})();A();s()};WMDEditor.util=u;WMDEditor.position=B;WMDEditor.TextareaState=E;WMDEditor.InputPoller=I;WMDEditor.PreviewManager=H;WMDEditor.UndoManager=G;var r=top.document,y=top.RegExp,F=top.navigator,C=function(){var c={};c.isIE=/msie/.test(F.userAgent.toLowerCase());c.isIE_5or6=/msie 6/.test(F.userAgent.toLowerCase())||/msie 5/.test(F.userAgent.toLowerCase());c.isIE_7plus=c.isIE&&!c.isIE_5or6;c.isOpera=
/opera/.test(F.userAgent.toLowerCase());c.isKonqueror=/konqueror/.test(F.userAgent.toLowerCase());return c}(),J=function(c,j){c.Command={};c.Global={};c.buttons={};c.showdown=top.Attacklab&&top.Attacklab.showdown;var g=WMDEditor.util,d=c.Command;c.ieCachedRange=null;c.ieRetardedClick=false;c.editor=function(a){a||(a=function(){});var f=c.panels.input,o=this,k,m=function(s){f.focus();if(s.textOp){k&&k.setCommandMode();var t=new E(c.panels.input);if(!t)return;var i=t.getChunks(),b=function(){f.focus();
i&&t.setChunks(i);t.restore();a()};s.textOp(i,b,true)||b()}s.execute&&s.execute(o)},q=function(){if(k){p(c.buttons["wmd-undo-button"],k.canUndo());p(c.buttons["wmd-redo-button"],k.canRedo())}},p=function(s,t){if(t){s.style.backgroundPosition=s.XShift+" 0px";s.onmouseover=function(){this.style.backgroundPosition=this.XShift+" -40px"};s.onmouseout=function(){this.style.backgroundPosition=this.XShift+" 0px"};if(C.isIE)s.onmousedown=function(){c.ieRetardedClick=true;c.ieCachedRange=document.selection.createRange()};
if(!s.isHelp)s.onclick=function(){if(this.onmouseout)this.onmouseout();m(this);return false}}else{s.style.backgroundPosition=s.XShift+" -20px";s.onmouseover=s.onmouseout=s.onclick=function(){}}},w=function(){function s(l,v,D){var x=document.createElement("li");c.buttons[l]=x;x.className="wmd-button "+l;x.XShift=h+"px";h-=20;if(v)x.title=v;if(D)x.textOp=D;return x}function t(l,v,D){l=s(l,v,D);p(l,true);e.appendChild(l);return l}function i(l){var v=document.createElement("li");v.className="wmd-spacer wmd-spacer-"+
l;e.appendChild(v);return v}var b=document.getElementById(j.button_bar||"wmd-button-bar"),e=document.createElement("ul");e.className="wmd-button-row";e=b.appendChild(e);var h=0;t("wmd-bold-button","Strong <strong> Ctrl+B",d.doBold);t("wmd-italic-button","Emphasis <em> Ctrl+I",d.doItalic);i(1);t("wmd-link-button","Hyperlink <a> Ctrl+L",function(l,v){return d.doLinkOrImage(l,v,false)});t("wmd-quote-button","Blockquote <blockquote> Ctrl+Q",d.doBlockquote);t("wmd-code-button","Code Sample <pre><code> Ctrl+K",
d.doCode);t("wmd-image-button","Image <img> Ctrl+G",function(l,v){return d.doLinkOrImage(l,v,true)});i(2);t("wmd-olist-button","Numbered List <ol> Ctrl+O",function(l,v,D){d.doList(l,v,true,D)});t("wmd-ulist-button","Bulleted List <ul> Ctrl+U",function(l,v,D){d.doList(l,v,false,D)});t("wmd-heading-button","Heading <h1>/<h2> Ctrl+H",d.doHeading);t("wmd-hr-button","Horizontal Rule <hr> Ctrl+R",d.doHorizontalRule);i(3);t("wmd-undo-button","Undo - Ctrl+Z").execute=function(l){l.undo()};b=t("wmd-redo-button",
"Redo - Ctrl+Y");b.title=/win/.test(F.platform.toLowerCase())?"Redo - Ctrl+Y":"Redo - Ctrl+Shift+Z";b.execute=function(l){l.redo()};b=s("wmd-help-button");b.isHelp=true;p(b,true);e.appendChild(b);var n=document.createElement("a");n.href=j.helpLink;n.target=j.helpTarget;n.title=j.helpHoverTitle;b.appendChild(n);q()},A=function(){if(c.showdown)var s=new c.showdown.converter;var t=f.value,i=function(){f.value=t};if(!/markdown/.test(j.output_format.toLowerCase()))if(s){f.value=s.makeHtml(t);top.setTimeout(i,
0)}return true};this.undo=function(){k&&k.undo()};this.redo=function(){k&&k.redo()};this.destroy=function(){k&&k.destroy();(void 0).parentNode&&(void 0).parentNode.removeChild(void 0);if(f)f.style.marginTop="";top.clearInterval(void 0)};(function(){if(/\?noundo/.test(r.location.href))c.nativeUndo=true;c.nativeUndo||(k=new G(c.panels.input,c.options.pastePollInterval,function(){a();q()}));w();var s="keydown";if(C.isOpera)s="keypress";g.addEvent(f,s,function(i){if(i.ctrlKey||i.metaKey){switch(String.fromCharCode(i.charCode||
i.keyCode).toLowerCase()){case "b":m(c.buttons["wmd-bold-button"]);break;case "i":m(c.buttons["wmd-italic-button"]);break;case "l":m(c.buttons["wmd-link-button"]);break;case "q":m(c.buttons["wmd-quote-button"]);break;case "k":m(c.buttons["wmd-code-button"]);break;case "g":m(c.buttons["wmd-image-button"]);break;case "o":m(c.buttons["wmd-olist-button"]);break;case "u":m(c.buttons["wmd-ulist-button"]);break;case "h":m(c.buttons["wmd-heading-button"]);break;case "r":m(c.buttons["wmd-hr-button"]);break;
case "y":m(c.buttons["wmd-redo-button"]);break;case "z":i.shiftKey?m(c.buttons["wmd-redo-button"]):m(c.buttons["wmd-undo-button"]);break;default:return}i.preventDefault&&i.preventDefault();if(top.event)top.event.returnValue=false}});g.addEvent(f,"keyup",function(i){if(!i.shiftKey&&!i.ctrlKey&&!i.metaKey)if((i.charCode||i.keyCode)===13){fakeButton={};fakeButton.textOp=d.doAutoindent;m(fakeButton)}});C.isIE&&g.addEvent(f,"keydown",function(i){if(i.keyCode===27)return false});if(f.form){var t=f.form.onsubmit;
f.form.onsubmit=function(){A();if(t)return t.apply(this,arguments)}}})()};d.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)";d.unwrap=function(a){var f=new y("([^\\n])\\n(?!(\\n|"+d.prefixes+"))","g");a.selection=a.selection.replace(f,"$1 $2")};d.wrap=function(a,f){d.unwrap(a);var o=new y("(.{1,"+f+"})( +|$\\n?)","gm");a.selection=a.selection.replace(o,function(k,m){if((new y("^"+d.prefixes,"")).test(k))return k;return m+"\n"});a.selection=a.selection.replace(/\s+$/,
"")};d.doBold=function(a){return d.doBorI(a,2,"strong text")};d.doItalic=function(a){return d.doBorI(a,1,"emphasized text")};d.doBorI=function(a,f,o){a.trimWhitespace();a.selection=a.selection.replace(/\n{2,}/g,"\n");a.before.search(/(\**$)/);var k=y.$1;a.after.search(/(^\**)/);var m=y.$1;k=Math.min(k.length,m.length);if(k>=f&&(k!=2||f!=1)){a.before=a.before.replace(y("[*]{"+f+"}$",""),"");a.after=a.after.replace(y("^[*]{"+f+"}",""),"")}else if(!a.selection&&m){a.after=a.after.replace(/^([*_]*)/,
"");a.before=a.before.replace(/(\s?)$/,"");a.before=a.before+m+y.$1}else{if(!a.selection&&!m)a.selection=o;f=f<=1?"*":"**";a.before+=f;a.after=f+a.after}};d.stripLinkDefs=function(a,f){return a=a.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(o,k,m,q,p){f[k]=o.replace(/\s*$/,"");if(q){f[k]=o.replace(/["(](.+?)[")]$/,"");return q+p}return""})};d.addLinkDef=function(a,f){var o=0,k={};a.before=d.stripLinkDefs(a.before,k);a.selection=
d.stripLinkDefs(a.selection,k);a.after=d.stripLinkDefs(a.after,k);var m="",q=/(\[(?:\[[^\]]*\]|[^\[\]])*\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g,p=function(s){o++;s=s.replace(/^[ ]{0,3}\[(\d+)\]:/,"  ["+o+"]:");m+="\n"+s},w=function(s,t,i,b){if(k[i]){p(k[i]);return t+o+b}return s};a.before=a.before.replace(q,w);if(f)p(f);else a.selection=a.selection.replace(q,w);var A=o;a.after=a.after.replace(q,w);if(a.after)a.after=a.after.replace(/\n*$/,"");if(!a.after)a.selection=a.selection.replace(/\n*$/,"");a.after+=
"\n\n"+m;return A};d.doLinkOrImage=function(a,f,o){a.trimWhitespace();a.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);if(a.endTag.length>1){a.startTag=a.startTag.replace(/!?\[/,"");a.endTag="";d.addLinkDef(a,null)}else if(/\n\n/.test(a.selection))d.addLinkDef(a,null);else{var k=function(m){if(m!==null){a.startTag=a.endTag="";m=d.addLinkDef(a," [999]: "+m);a.startTag=o?"![":"[";a.endTag="]["+m+"]";if(!a.selection)a.selection=o?"alt text":"link text"}f()};o?g.prompt(j.imageDialogText,j.imageDefaultText,
k):g.prompt(j.linkDialogText,j.linkDefaultText,k);return true}};d.doAutoindent=function(a,f,o){a.before=a.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n");a.before=a.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n");a.before=a.before.replace(/(\n|^)[ \t]+\n$/,"\n\n");o=false;/(\n|^)[ ]{0,3}([*+-])[ \t]+.*\n$/.test(a.before)&&d.doList&&d.doList(a,f,false,true);/(\n|^)[ ]{0,3}(\d+[.])[ \t]+.*\n$/.test(a.before)&&d.doList&&d.doList(a,f,true,true);/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(a.before)&&
d.doBlockquote&&d.doBlockquote(a,f,o);/(\n|^)(\t|[ ]{4,}).*\n$/.test(a.before)&&d.doCode&&d.doCode(a,f,o)};d.doBlockquote=function(a,f,o){a.selection=a.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(k,m,q,p){a.before+=m;a.after=p+a.after;return q});a.before=a.before.replace(/(>[ \t]*)$/,function(k,m){a.selection=m+a.selection;return""});f=o?"Blockquote":"";a.selection=a.selection.replace(/^(\s|>)+$/,"");a.selection=a.selection||f;if(a.before)a.before=a.before.replace(/\n?$/,"\n");if(a.after)a.after=
a.after.replace(/^\n?/,"\n");a.before=a.before.replace(/(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*$)/,function(k){a.startTag=k;return""});a.after=a.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(k){a.endTag=k;return""});f=function(k){var m=k?"> ":"";if(a.startTag)a.startTag=a.startTag.replace(/\n((>|\s)*)\n$/,function(q,p){return"\n"+p.replace(/^[ ]{0,3}>?[ \t]*$/gm,m)+"\n"});if(a.endTag)a.endTag=a.endTag.replace(/^\n((>|\s)*)\n/,function(q,p){return"\n"+p.replace(/^[ ]{0,3}>?[ \t]*$/gm,
m)+"\n"})};if(/^(?![ ]{0,3}>)/m.test(a.selection)){d.wrap(a,j.lineLength-2);a.selection=a.selection.replace(/^/gm,"> ");f(true);a.addBlankLines()}else{a.selection=a.selection.replace(/^[ ]{0,3}> ?/gm,"");d.unwrap(a);f(false);if(!/^(\n|^)[ ]{0,3}>/.test(a.selection)&&a.startTag)a.startTag=a.startTag.replace(/\n{0,2}$/,"\n\n");if(!/(\n|^)[ ]{0,3}>.*$/.test(a.selection)&&a.endTag)a.endTag=a.endTag.replace(/^\n{0,2}/,"\n\n")}if(!/\n/.test(a.selection))a.selection=a.selection.replace(/^(> *)/,function(k,
m){a.startTag+=m;return""})};d.doCode=function(a,f,o){f=/\S[ ]*$/.test(a.before);if(!/^[ ]*\S/.test(a.after)&&!f||/\n/.test(a.selection)){a.before=a.before.replace(/[ ]{4}$/,function(m){a.selection=m+a.selection;return""});var k=f=1;if(/\n(\t|[ ]{4,}).*\n$/.test(a.before)||a.after==="")f=0;if(/^\n(\t|[ ]{4,})/.test(a.after))k=0;a.addBlankLines(f,k);if(a.selection)a.selection=/^[ ]{0,3}\S/m.test(a.selection)?a.selection.replace(/^/gm,"    "):a.selection.replace(/^[ ]{4}/gm,"");else{a.startTag="    ";
a.selection=o?"enter code here":""}}else{a.trimWhitespace();a.findTags(/`/,/`/);if(!a.startTag&&!a.endTag){a.startTag=a.endTag="`";if(!a.selection)a.selection=o?"enter code here":""}else if(a.endTag&&!a.startTag){a.before+=a.endTag;a.endTag=""}else a.startTag=a.endTag=""}};d.doList=function(a,f,o,k){f=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/;var m="-",q=1,p=function(){var i;if(o){i=" "+q+". ";q++}else i=" "+m+" ";return i},w=function(i){if(o===
undefined)o=/^\s*\d/.test(i);return i=i.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return p()})};a.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null);if(a.before&&!/\n$/.test(a.before)&&!/^\n/.test(a.startTag)){a.before+=a.startTag;a.startTag=""}if(a.startTag){var A=/\d+[.]/.test(a.startTag);a.startTag="";a.selection=a.selection.replace(/\n[ ]{4}/g,"\n");d.unwrap(a);a.addBlankLines();if(A)a.after=a.after.replace(f,w);if(o==A)return}var s=1;a.before=a.before.replace(/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,
function(i){if(/^\s*([*+-])/.test(i))m=y.$1;s=/[^\n]\n\n[^\n]/.test(i)?1:0;return w(i)});if(!a.selection)a.selection=k?"List item":" ";k=p();var t=1;a.after=a.after.replace(f,function(i){t=/[^\n]\n\n[^\n]/.test(i)?1:0;return w(i)});a.trimWhitespace(true);a.addBlankLines(s,t,true);a.startTag=k;k=k.replace(/./g," ");d.wrap(a,j.lineLength-k.length);a.selection=a.selection.replace(/\n/g,"\n"+k)};d.doHeading=function(a){a.selection=a.selection.replace(/\s+/g," ");a.selection=a.selection.replace(/(^\s+|\s+$)/g,
"");if(a.selection){var f=0;a.findTags(/#+[ ]*/,/[ ]*#+/);if(/#+/.test(a.startTag))f=y.lastMatch.length;a.startTag=a.endTag="";a.findTags(null,/\s?(-+|=+)/);if(/=+/.test(a.endTag))f=1;if(/-+/.test(a.endTag))f=2;a.startTag=a.endTag="";a.addBlankLines(1,1);f=f==0?2:f-1;if(f>0){f=f>=2?"-":"=";var o=a.selection.length;if(o>j.lineLength)o=j.lineLength;for(a.endTag="\n";o--;)a.endTag+=f}}else{a.startTag="## ";a.selection="Heading";a.endTag=" ##"}};d.doHorizontalRule=function(a){a.startTag="----------\n";
a.selection="";a.addBlankLines(2,1,true)}}})();function setup_wmd(u){return new WMDEditor(u)};

