var CodeMirrorConfig=window.CodeMirrorConfig||{},CodeMirror=function(){function m(a,b){for(var c in b)a.hasOwnProperty(c)||(a[c]=b[c])}function s(a,b){for(var c=0;c<a.length;c++)b(a[c])}function z(a){var b=document.createElement("DIV"),c=document.createElement("DIV");b.style.position="absolute";b.style.height="100%";if(b.style.setExpression)try{b.style.setExpression("height","this.previousSibling.offsetHeight + 'px'")}catch(e){}b.style.top="0px";b.style.overflow="hidden";a.appendChild(b);c.className=
"CodeMirror-line-numbers";b.appendChild(c);return b}function k(a,b){if(b.dumbTabs)b.tabMode="spaces";else if(b.normalTab)b.tabMode="default";this.options=b=b||{};m(b,CodeMirrorConfig);var c=this.frame=document.createElement("IFRAME");if(b.iframeClass)c.className=b.iframeClass;c.frameBorder=0;c.src="javascript:false;";c.style.border="0";c.style.width="100%";c.style.height="100%";c.style.display="block";var e=this.wrapping=document.createElement("DIV");e.style.position="relative";e.className="CodeMirror-wrapping";
e.style.width=b.width;e.style.height=b.height;a.appendChild?a.appendChild(e):a(e);e.appendChild(c);if(b.lineNumbers)this.lineNumbers=z(e);c.CodeMirror=this;this.win=c.contentWindow;if(typeof b.parserfile=="string")b.parserfile=[b.parserfile];if(typeof b.stylesheet=="string")b.stylesheet=[b.stylesheet];var f=['<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>'];f.push('<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>');s(b.stylesheet,
function(d){f.push('<link rel="stylesheet" type="text/css" href="'+d+'"/>')});s(b.basefiles.concat(b.parserfile),function(d){f.push('<script type="text/javascript" src="'+b.path+d+'"><\/script>')});f.push('</head><body style="border-width: 0;" class="editbox" spellcheck="'+(b.disableSpellcheck?"false":"true")+'"></body></html>');a=this.win.document;a.open();a.write(f.join(""));a.close()}m(CodeMirrorConfig,{stylesheet:"",path:"",parserfile:[],basefiles:["util.js","stringstream.js","select.js","undo.js",
"editor.js","tokenize.js"],iframeClass:null,passDelay:200,passTime:50,lineNumberDelay:200,lineNumberTime:50,continuousScanning:false,saveFunction:null,onChange:null,undoDepth:50,undoDelay:800,disableSpellcheck:true,textWrapping:true,readOnly:false,width:"",height:"300px",autoMatchParens:false,parserConfig:null,tabMode:"indent",reindentOnLoad:false,activeTokens:null,cursorActivity:null,lineNumbers:false,indentUnit:2});k.prototype={init:function(){this.options.initCallback&&this.options.initCallback(this);
this.options.lineNumbers&&this.activateLineNumbers();this.options.reindentOnLoad&&this.reindent()},getCode:function(){return this.editor.getCode()},setCode:function(a){this.editor.importCode(a)},selection:function(){this.focusIfIE();return this.editor.selectedText()},reindent:function(){this.editor.reindent()},reindentSelection:function(){this.focusIfIE();this.editor.reindentSelection(null)},focusIfIE:function(){this.win.select.ie_selection&&this.focus()},focus:function(){this.win.focus();this.editor.selectionSnapshot&&
this.win.select.setBookmark(this.win.document.body,this.editor.selectionSnapshot)},replaceSelection:function(a){this.focus();this.editor.replaceSelection(a);return true},replaceChars:function(a,b,c){this.editor.replaceChars(a,b,c)},getSearchCursor:function(a,b,c){return this.editor.getSearchCursor(a,b,c)},undo:function(){this.editor.history.undo()},redo:function(){this.editor.history.redo()},historySize:function(){return this.editor.history.historySize()},clearHistory:function(){this.editor.history.clear()},
grabKeys:function(a,b){this.editor.grabKeys(a,b)},ungrabKeys:function(){this.editor.ungrabKeys()},setParser:function(a){this.editor.setParser(a)},setSpellcheck:function(a){this.win.document.body.spellcheck=a},setTextWrapping:function(a){if(a!=this.options.textWrapping){this.win.document.body.style.whiteSpace=a?"":"nowrap";this.options.textWrapping=a;if(this.lineNumbers){this.setLineNumbers(false);this.setLineNumbers(true)}}},setIndentUnit:function(a){this.win.indentUnit=a},setUndoDepth:function(a){this.editor.history.maxDepth=
a},setTabMode:function(a){this.options.tabMode=a},setLineNumbers:function(a){if(a&&!this.lineNumbers){this.lineNumbers=z(this.wrapping);this.activateLineNumbers()}else if(!a&&this.lineNumbers){this.wrapping.removeChild(this.lineNumbers);this.wrapping.style.marginLeft="";this.lineNumbers=null}},cursorPosition:function(a){this.focusIfIE();return this.editor.cursorPosition(a)},firstLine:function(){return this.editor.firstLine()},lastLine:function(){return this.editor.lastLine()},nextLine:function(a){return this.editor.nextLine(a)},
prevLine:function(a){return this.editor.prevLine(a)},lineContent:function(a){return this.editor.lineContent(a)},setLineContent:function(a,b){this.editor.setLineContent(a,b)},insertIntoLine:function(a,b,c){this.editor.insertIntoLine(a,b,c)},selectLines:function(a,b,c,e){this.win.focus();this.editor.selectLines(a,b,c,e)},nthLine:function(a){for(var b=this.firstLine();a>1&&b!==false;a--)b=this.nextLine(b);return b},lineNumber:function(a){for(var b=0;a!==false;){b++;a=this.prevLine(a)}return b},jumpToLine:function(a){this.selectLines(this.nthLine(a),
0);this.win.focus()},currentLine:function(){return this.lineNumber(this.cursorPosition().line)},activateLineNumbers:function(){function a(){for(var h=f;h.parentNode;h=h.parentNode);if(!n.parentNode||h!=document||!d.Editor){try{v()}catch(q){}clearInterval(sizeInterval)}else if(n.offsetWidth!=w){w=n.offsetWidth;n.style.left="-"+(f.parentNode.style.marginLeft=w+"px")}}function b(){n.scrollTop=t.scrollTop||A.documentElement.scrollTop||0}function c(){function h(){for(var g=50+Math.max(t.offsetHeight,f.offsetHeight);j.offsetHeight<
g;){j.appendChild(document.createElement("DIV"));j.lastChild.innerHTML=q++}b()}var q=1,u=d.addEventHandler(d,"scroll",h,true),o=d.addEventHandler(d,"resize",h,true);v=function(){u();o()}}function e(){function h(r){i||(i=j.appendChild(document.createElement("DIV")));i.innerHTML=r;x=i.offsetHeight+i.offsetTop;i=i.nextSibling}function q(){if(!(!j.parentNode||j.parentNode!=l.lineNumbers)){for(var r=(new Date).getTime()+l.options.lineNumberTime;g;){for(h(y++);g&&!d.isBR(g);g=g.nextSibling)for(var B=g.offsetTop+
g.offsetHeight;B-3>x;)h("&nbsp;");if(g)g=g.nextSibling;if((new Date).getTime()>r){p=setTimeout(q,l.options.lineNumberDelay);return}}for(r=50+Math.max(t.offsetHeight,f.offsetHeight);i||j.offsetHeight<r;)h(y++);b()}}function u(){b();g=t.firstChild;i=j.firstChild;x=0;y=1;q()}function o(){p&&clearTimeout(p);if(l.editor.allClean())u();else p=setTimeout(o,200)}var g,i,y,x;u();var p=null;l.updateNumbers=o;var C=d.addEventHandler(d,"scroll",b,true),D=d.addEventHandler(d,"resize",o,true);v=function(){p&&clearTimeout(p);
if(l.updateNumbers==o)l.updateNumbers=null;C();D()}}var f=this.frame,d=f.contentWindow,A=d.document,t=A.body,n=this.lineNumbers,j=n.firstChild,l=this,w=null,v=function(){};a();sizeInterval=setInterval(a,500);(this.options.textWrapping?e:c)()}};k.InvalidLineHandle={toString:function(){return"CodeMirror.InvalidLineHandle"}};k.replace=function(a){if(typeof a=="string")a=document.getElementById(a);return function(b){a.parentNode.replaceChild(b,a)}};k.fromTextArea=function(a,b){function c(d){a.nextSibling?
a.parentNode.insertBefore(d,a.nextSibling):a.parentNode.appendChild(d)}if(typeof a=="string")a=document.getElementById(a);b=b||{};if(a.style.width&&b.width==null)b.width=a.style.width;if(a.style.height&&b.height==null)b.height=a.style.height;if(b.content==null)b.content=a.value;if(a.form){function e(){a.value=f.getCode()}typeof a.form.addEventListener=="function"?a.form.addEventListener("submit",e,false):a.form.attachEvent("onsubmit",e)}a.style.display="none";var f=new k(c,b);return f};k.isProbablySupported=
function(){var a;return window.opera?Number(window.opera.version())>=9.52:/Apple Computers, Inc/.test(navigator.vendor)&&(a=navigator.userAgent.match(/Version\/(\d+(?:\.\d+)?)\./))?Number(a[1])>=3:document.selection&&window.ActiveXObject&&(a=navigator.userAgent.match(/MSIE (\d+(?:\.\d*)?)\b/))?Number(a[1])>=6:(a=navigator.userAgent.match(/gecko\/(\d{8})/i))?Number(a[1])>=20050901:(a=navigator.userAgent.match(/AppleWebKit\/(\d+)/))?Number(a[1])>=525:null};return k}();
function MirrorFrame(m,s){this.home=document.createElement("DIV");m.appendChild?m.appendChild(this.home):m(this.home);this.mirror=new CodeMirror(this.home,s)};

