window.onload=cmInit;function cmInit(){var cb,pm,i,e,a;a=document.getElementsByTagName('pre');for(i=0;i<a.length;++i){cb=a[i].parentNode;while(cb&&cb.className!='codebox'){cb=cb.parentNode;}pm=cb;while(pm&&pm.className!='postmsg'){pm=pm.parentNode;}if(cb&&!inQuote(cb)){e=document.createElement('div');e=cb.appendChild(e);e.className='codeMenuButton';e.onmouseover=cmbOnMouseover;e.cmData={pre:a[i],pm:pm};pm.cmExpanded=false;}}a=xGetElementById('codeMenu').getElementsByTagName('a');for(i=0;i<a.length;++i){a[i].onclick=cmaOnClick;}}function inQuote(e){while(e){if(e.nodeName&&e.nodeName.toLowerCase()=='blockquote'){return true;}e=e.parentNode;}return false;}function cmbOnMouseover(){var e,s,h,m=xGetElementById('codeMenu');if(m){if(this.cmData.pm.cmExpanded){h='cmaExpand';s='cmaRestore';}else{h='cmaRestore';s='cmaExpand';}e=xGetElementById(h);if(e)e.style.display='none';e=xGetElementById(s);if(e)e.style.display='block';m.cmData=this.cmData;m.style.left=(xPageX(this)-1)+'px';m.style.top=(xPageY(this)-1)+'px';setTimeout(addDOMM,500);}}function addDOMM(){document.onmousemove=docOnMousemove;}function docOnMousemove(e){e=e||window.event;var t=e.target||e.srcElement;while(t&&t.id!='codeMenu'){t=t.parentNode;}if(!t){cmClose();}}function cmClose(){document.onmousemove=null;xGetElementById('codeMenu').style.left='-1000px';}function cmaOnClick(e){cmClose();var data=this.offsetParent.cmData;try{window[this.id](data);}catch(e){alert('Please post the following error message in the Miscellanea forum.\n\nAction: '+this.id+'\n\n'+e.name+': '+e.message);}xStopPropagation(e);return false;}function cmaExpand(data){cmaExpRes(data,'none','0',true);}function cmaRestore(data){cmaExpRes(data,'block','18em',false);}function cmaExpRes(data,d,w,ex){var e,pr=data.pre;while(pr&&pr.className!='postright'){pr=pr.parentNode;}if(pr){var pl=pr;do{pl=pl.previousSibling;}while(pl&&pl.className!='postleft');var pfl=pr;do{pfl=pfl.nextSibling;}while(pfl&&pfl.className!='postfootleft');var pfr=pfl;do{pfr=pfr.nextSibling;}while(pfr&&pfr.className!='postfootright');if(pfr)pfr.style.display=d;if(pfl)pfl.style.display=d;if(pl)pl.style.display=d;pr.style.borderLeftWidth=w;data.pm.cmExpanded=ex;}}function cmaSelect(data){if(document.createRange&&window.getSelection){var r=document.createRange();if(r.selectNode){r.selectNode(data.pre);var s=window.getSelection();if(s.addRange){s.addRange(r);}}}else if(document.body&&document.body.createTextRange){var r=document.body.createTextRange();if(r.moveToElementText){r.moveToElementText(data.pre);r.select();}}}function cmaFormat(data){var pre=data.pre;if(pre.firstChild&&pre.firstChild.data){var t=pre.firstChild.data;var re=/\<html|\<head|\<body|\<script/im;if(re.test(t)){alert('The code contains HTML. Only Javascript can be formatted.');}else{var jsd=new JsDecoder();jsd.s=t;pre.firstChild.data=jsd.decode();/*@cc_on @if(@_jscript_version<=5.6)pre.parentNode.style.height='35em';@end @*/}}}function cmaEval(data){var pre=data.pre;if(pre.firstChild&&pre.firstChild.data){var t=pre.firstChild.data;var re=/\<html|\<head|\<body|\<script/im;if(re.test(t)){alert('The code contains HTML. Only Javascript can be evaluated. Use "Load".');}else{setTimeout(t,1);}}}function cmaLoad(data){var pre=data.pre;if(pre.firstChild&&pre.firstChild.data){var i=xGetElementById('cmIframe');if(!i){i=document.createElement('iframe');i.id='cmIframe';i=xGetElementById('punwrap').appendChild(i);}if(i.contentWindow&&i.contentWindow.document){if(window.scrollTo){window.scrollTo(0,xPageY('cmIframe'));}i.contentWindow.document.open();i.contentWindow.document.write(pre.firstChild.data);i.contentWindow.document.close();}}}function JsDecoder(){this.s="";this.i=0;this.len=0;this.code=[""];this.row=0;this.lvl=0;this.lastWord="";this.nextChar="";this.prevChar="";this.switches=[];this.indentNum=2;this.indentStr="  ";this.newline="\n";/*@cc_on this.newline="\r\n";@*/this.decode=function(){this.s=this.s.replace(/(\r\n|\r|\n)/g,"\n");this.len=this.s.length;while(this.i<this.len){var c=this.s.charAt(this.i);if(this.len-1==this.i){this.nextChar="";}else{this.nextChar=this.s.charAt(this.i+1);}switch(c){case"\n":this.linefeed();break;case" ":case"\t":this.space();break;case"{":this.blockBracketOn();break;case"}":this.blockBracketOff();break;case":":this.colon();break;case";":this.semicolon();break;case"(":this.bracketOn();break;case")":this.bracketOff();break;case"[":this.squareBracketOn();break;case"]":this.squareBracketOff();break;case'"':case"'":this.quotation(c);break;case"/":if("/"==this.nextChar){this.lineComment();}else if("*"==this.nextChar){this.comment();}else{this.slash();}break;case",":this.comma();break;case".":this.dot();break;case"~":case"^":this.symbol1(c);break;case"-":case"+":case"*":case"%":case"<":case"=":case">":case"?":case":":case"&":case"|":case"/":this.symbol2(c);break;case"!":if("="==this.nextChar){this.symbol2(c);}else{this.symbol1(c);}break;default:if(/\w/.test(c)){this.alphanumeric(c);}else{this.unknown(c);}break;}if(!/\w/.test(c)){if(c!=" "&&c!="\t"){this.lastWord="";}}this.prevChar=c;this.i++;}return this.code.join(this.newline);};this.write=function(s){if(0==this.code[this.row].length){var lvl=("}"==s?this.lvl-1:this.lvl);for(var i=0;i<lvl;i++){this.code[this.row]+=this.indentStr;}this.code[this.row]+=s;}else{this.code[this.row]+=s;}};this.removePrevChar=function(){if(this.code[this.row].length){this.code[this.row].length=this.code[this.row].length-1;}};this.writeLine=function(){this.code.push("");this.row++;};this.writeTab=function(){this.write(this.indentStr);};this.getCurrentLine=function(){return this.code[this.row];};this.isKeyword=function(){return this.lastWord&&this.keywords.indexOf(this.lastWord)!=-1;};this.linefeed=function(){};this.space=function(){if(this.isKeyword()){this.write(" ");this.lastWord="";}else{var multi=["in","new"];for(var i=0;i<multi.length;i++){var isKeywordNext=true;for(var j=0;j<multi[i].length;j++){if(multi[i][j]!=this.s.charAt(this.i+1+j)){isKeywordNext=false;break;}}if(isKeywordNext){this.write(" ");this.lastWord="";break;}}}};this.blockBracketOn=function(){if(/^\s*switch\s/.test(this.getCurrentLine())){this.switches.push(this.lvl);}var currentLine=this.getCurrentLine();if(currentLine.length){var lastChar=currentLine[currentLine.length-1];if(lastChar!=" "&&lastChar!="\t"){this.write(" {");}else{this.write("{");}}else{this.write("{");}this.writeLine();this.lvl++;};this.lastChar=function(){var line=this.getCurrentLine();if(line.length)return line[line-1];else return"notfound";};this.blockBracketOff=function(){if(this.getCurrentLine().length&&this.lastChar!=';'){this.semicolon();}this.write("}");this.writeLine();this.lvl--;if(this.switches.length&&this.switches[this.switches.length-1]==this.lvl){var row=this.row-1;var spaces=(this.lvl+1)*this.indentNum;var caseRegexp=new RegExp("^\\s{"+spaces+"}case\\s");while(row>0){row--;if(/^\s*switch\s/.test(this.code[row])){break;}if(!caseRegexp.test(this.code[row])){this.code[row]=this.indentStr+this.code[row];}}this.switches.pop();}};this.colon=function(){if(/^\s*case\s/.test(this.getCurrentLine())){this.write(":");this.writeLine();}else{this.symbol2(":");}};this.isStart=function(){return this.getCurrentLine().length==0;};this.backLine=function(){if(!this.isStart){throw"backLine() may be called only at the start of the line";return;}this.code.length=this.code.length-1;this.row--;};this.semicolon=function(){if(this.isStart()){this.backLine();}this.write(";");if(/^\s*for\s/.test(this.getCurrentLine())){this.write(" ");}else{this.writeLine();}};this.bracketOn=function(){if(this.isKeyword()&&this.prevChar!=" "&&this.prevChar!="\t"){this.write(" (");}else{this.write("(");}};this.bracketOff=function(){this.write(")");};this.squareBracketOn=function(){this.write("[");};this.squareBracketOff=function(){this.write("]");};this.quotation=function(quotation){var escaped=false;this.write(quotation);while(this.i<this.len-1){this.i++;var c=this.s.charAt(this.i);if("\\"==c){escaped=(escaped?false:true);}this.write(c);if(c==quotation){if(!escaped){break;}}if("\\"!=c){escaped=false;}}};this.lineComment=function(){this.write("//");this.i++;while(this.i<this.len-1){this.i++;var c=this.s.charAt(this.i);if("\n"==c){this.writeLine();break;}this.write(c);}};this.comment=function(){this.write("/*");this.i++;var c="";var prevC="";while(this.i<this.len-1){this.i++;prevC=c;c=this.s.charAt(this.i);if(" "==c||"\t"==c||"\n"==c){if(" "==c){if(this.getCurrentLine()){this.write(" ");}}else if("\t"==c){if(this.getCurrentLine()){this.writeTab();}}else if("\n"==c){this.writeLine();}}else{this.write(c);}if("/"==c&&"*"==prevC){break;}}this.writeLine();};this.slash=function(){var a=(this.lastWord);var b=("*"==this.prevChar);if(a||b){if(a){if("="==this.nextChar){this.write(" /");}else{this.write(" / ");}}else if(b){this.write("/ ");}}else if(')'==this.prevChar){this.write(' / ');}else{if("="==this.prevChar){this.write(" /");}else{this.write("/");}var escaped=false;while(this.i<this.len-1){this.i++;var c=this.s.charAt(this.i);if("\\"==c){escaped=(escaped?false:true);}this.write(c);if("/"==c){if(!escaped){break;}}if("\\"!=c){escaped=false;}}}};this.comma=function(){this.write(", ");};this.dot=function(){this.write(".");};this.symbol1=function(c){this.write(c);};this.symbol2=function(c){if("+"==c||"-"==c){if(c==this.nextChar||c==this.prevChar){this.write(c);return;}}if(this.symbols2.indexOf(this.prevChar)!=-1){if(this.symbols2.indexOf(this.nextChar)!=-1){this.write(c);}else{this.write(c+" ");}}else{if(this.symbols2.indexOf(this.nextChar)!=-1){this.write(" "+c);}else{this.write(" "+c+" ");}}};this.alphanumeric=function(c){if(this.lastWord){this.lastWord+=c;}else{this.lastWord=c;}this.write(c);};this.unknown=function(c){this.write(c);};this.symbols1="~!^";this.symbols2="-+*%<=>?:&|/!";this.keywords=["abstract","boolean","break","byte","case","catch","char","class","const","continue","default","delete","do","double","else","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","while","with"];}if(typeof Array.prototype.indexOf=="undefined"){Array.prototype.indexOf=function(item){for(var i=0;i<this.length;i++){if((typeof this[i]==typeof item)&&(this[i]==item)){return i;}}return-1;}}
/* Compiled from X 4.16 by XC 1.05 on 05Jun07 */
xLibrary={version:'4.16',license:'GNU LGPL',url:'http://cross-browser.com/'};function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;}return true;}function xGetElementById(e){if(typeof(e)=='string'){if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;}return e;}function xPageX(e){var x=0;e=xGetElementById(e);while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)?e.offsetParent:null;}return x;}function xPageY(e){var y=0;e=xGetElementById(e);while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)?e.offsetParent:null;}return y;}function xStopPropagation(evt){if(evt&&evt.stopPropagation)evt.stopPropagation();else if(window.event)window.event.cancelBubble=true;}
