
var Cookies={};Cookies.set=function(name,value){var argv=arguments;var argc=arguments.length;var expires=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:'/';var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;document.cookie=name+"="+escape(value)+
((expires==null)?"":("; expires="+expires.toGMTString()))+
((path==null)?"":("; path="+path))+
((domain==null)?"":("; domain="+domain))+
((secure==true)?"; secure":"");};Cookies.get=function(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;var j=0;while(i<clen){j=i+alen;if(document.cookie.substring(i,j)==arg)
return Cookies.getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)
break;}
return null;};Cookies.clear=function(name){if(Cookies.get(name)){document.cookie=name+"="+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}};Cookies.getCookieVal=function(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1){endstr=document.cookie.length;}
return unescape(document.cookie.substring(offset,endstr));};var geezmo={'roundNumber':function(num,dec){var snum=parseFloat(num).toString()+".0000001";if(snum=="0")return"0.00";var sep=snum.indexOf(".");var beg=snum.substring(0,sep);snum=snum.substring(eval(snum.indexOf(".")+1),snum.length);var dig=snum.substring(0,eval(dec-1));snum=snum.substring(eval(dec-1),dec);snum=parseInt(snum);gohigher=false;if(snum>4){gohigher=true;}
if(gohigher){snum=parseFloat(snum);snum++;}
snum=snum.toString();if(typeof num!='integer')snum="0";num=beg+"."+dig+""+snum;return num;},'ObjectToGetVars':function(object){var ret;for(var n in object)
ret+="&"+n+"="+object[n];return ret;},'getVar':function(name){get_string=document.location.search;return_value='';do{name_index=get_string.indexOf(name+'=');if(name_index!=-1)
{get_string=get_string.substr(name_index+name.length+1,get_string.length-name_index);end_of_value=get_string.indexOf('&');if(end_of_value!=-1)
value=get_string.substr(0,end_of_value);else
value=get_string;if(return_value==''||value=='')
return_value+=value;else
return_value+=', '+value;}}while(name_index!=-1)
space=return_value.indexOf('+');while(space!=-1)
{return_value=return_value.substr(0,space)+' '+
return_value.substr(space+1,return_value.length);space=return_value.indexOf('+');}
return(return_value);},'strlen':function(string){var str=string+'';var i=0,chr='',lgth=0;var getWholeChar=function(str,i){var code=str.charCodeAt(i);var next='',prev='';if(0xD800<=code&&code<=0xDBFF){if(str.length<=(i+1)){throw'High surrogate without following low surrogate';}
next=str.charCodeAt(i+1);if(0xDC00>next||next>0xDFFF){throw'High surrogate without following low surrogate';}
return str[i]+str[i+1];}else if(0xDC00<=code&&code<=0xDFFF){if(i===0){throw'Low surrogate without preceding high surrogate';}
prev=str.charCodeAt(i-1);if(0xD800>prev||prev>0xDBFF){throw'Low surrogate without preceding high surrogate';}
return false;}
return str[i];};for(i=0,lgth=0;i<str.length;i++){if((chr=getWholeChar(str,i))===false){continue;}
lgth++;}
return lgth;}};var shell={}
shell.history=[''];shell.historyCursor=0;shell.DONE_STATE=4;shell.getXmlHttpRequest=function(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e){return new ActiveXObject('Microsoft.XMLHTTP');}}
return null;};shell.onPromptKeyPress=function(event){var statement=document.getElementById('statement');if(this.historyCursor==this.history.length-1){this.history[this.historyCursor]=statement.value;}
if(event.ctrlKey&&event.keyCode==38){if(this.historyCursor>0){statement.value=this.history[--this.historyCursor];}
return false;}else if(event.ctrlKey&&event.keyCode==40){if(this.historyCursor<this.history.length-1){statement.value=this.history[++this.historyCursor];}
return false;}else if(!event.altKey){this.historyCursor=this.history.length-1;this.history[this.historyCursor]=statement.value;}
var ctrlEnter=(document.getElementById('submit_key').value=='ctrl-enter');if(event.keyCode==13&&!event.altKey&&!event.shiftKey&&event.ctrlKey==ctrlEnter){return this.runStatement();}};shell.done=function(req){if(req.readyState==this.DONE_STATE){var statement=document.getElementById('statement')
statement.className='prompt';var output=document.getElementById('output');output.value+='\n>>> '+statement.value;statement.value='';this.history.push('');this.historyCursor=this.history.length-1;var result=req.responseText.replace(/^\s*|\s*$/g,'');if(result!='')
output.value+='\n'+result;output.scrollTop=output.scrollHeight;if(output.createTextRange){var range=output.createTextRange();range.collapse(false);range.select();}}};shell.runStatement=function(){var form=document.getElementById('form');var req=this.getXmlHttpRequest();if(!req){document.getElementById('ajax-status').innerHTML="<span class='error'>Your browser doesn't support AJAX. :(</span>";return false;}
req.onreadystatechange=function(){shell.done(req);};var params='';for(i=0;i<form.elements.length;i++){var elem=form.elements[i];if(elem.type!='submit'&&elem.type!='button'&&elem.id!='caret'){var value=escape(elem.value).replace(/\+/g,'%2B');params+='&'+elem.name+'='+value;}}
document.getElementById('statement').className='prompt processing';req.open(form.method,form.action+'?'+params,true);req.setRequestHeader('Content-type','application/x-www-form-urlencoded;charset=UTF-8');req.send(null);return false;};
