e=ace.edit('editor')
e.getSession().setUseWorker(false)
e.setTheme("ace/theme/monokai")
e.getSession().setMode("ace/mode/javascript")
e.setOptions({
	fontFamily:'dvsm',
	fontSize:'13px'
})

$('#run').click(function(){
	$.get(encodeURI('/eval/'+(e.getValue()||'undefined')),function(x){
		showDialog({
			title:'Result',
			text:'<pre id="res" style="font-family:dvsm">'+x.r+'</pre>',
			positive:{
				title:'Edit'
			}
		})
	})
});
e=ace.edit('editor')
e.getSession().setUseWorker(false)
e.setTheme("ace/theme/monokai")
e.getSession().setMode("ace/mode/javascript")
e.setOptions({
	fontFamily:'dvsm',
	fontSize:'13px'
})

$('#run').click(function(){
	showLoading()
	$.get(encodeURI('/eval/'+(e.getValue()||'undefined')),function(x){
		hideLoading()
		showDialog({
			title:'Result',
			text:'<div id="res" style="font-family:dvsm">'+x.r+'</div>',
			positive:{
				title:'Edit'
			},
			onLoaded:function(){
				re=ace.edit('editor')
				re.getSession().setUseWorker(false)
				re.setTheme("ace/theme/monokai")
				re.getSession().setMode("ace/mode/javascript")
				re.setOptions({
					fontFamily:'dvsm',
					fontSize:'13px'
				})
			}
		})
	})
});
add more dialog features