function cleanInfix(a){selectionValue=a+" = ";document.getElementById("workspace:query").value=a.replace(/([^a-zA-Z0-9\,\s\.])/g," $1 ").replace(/(\d)(\.)(\D|$)/g,"$1 $3").replace(/(^|\D)(\.)(\d)/,"$1 0$2$3").replace(/(^\s)|(\s$)/g,"").replace(/(\e)(\s)(\^)/g,"$1$3").replace(/\s+/g," ")}function displaySolution(a){if(startSelect!="0"&&a.length>0&&selectionValue!="Null"){if(/\d+(\.\d+)?/.test(a)||a.length==1){document.getElementById("workspace:consoleTextArea").value=selectionValue+a+"\n"+document.getElementById("workspace:consoleTextArea").value;document.getElementById(startSelect).childNodes[0].innerHTML=stripHTML(a)}else{document.getElementById("workspace:consoleTextArea").innerHTML=selectionValue+a+"\n"+document.getElementById("workspace:consoleTextArea").value}}selectionValue="Null"}function handleChange(b){if(document.getElementById(b).value.indexOf(",")>-1){document.getElementById(b).value=document.getElementById(b).value.replace(/,/,"")}if(document.getElementById(b).value.indexOf("|")>-1){document.getElementById(b).value=document.getElementById(b).value.replace(/\|/,"")}var c=b.split("-");var a=parseInt(c[0]);var d=parseInt(c[1]);setLastUsedElem(a,d)}function setLastUsedElem(b,a){if(b>lastUsedElem[0]){lastUsedElem[0]=b}if(a>lastUsedElem[1]){lastUsedElem[1]=a}}function calcUpPos(c){var b=parseInt(c[1])-1;var a=c[0]+"_"+b;moveCursor(a)}function calcDownPos(c){var b=parseInt(c[1])+1;var a=c[0]+"_"+b;moveCursor(a)}function calcRightPos(c){var b=parseInt(c[0])+1;var a=b+"_"+c[1];moveCursor(a)}function calcLeftPos(c){var b=parseInt(c[0])-1;var a=b+"_"+c[1];moveCursor(a)}function moveCursor(b){if(elementExist(b)){var a=startSelect;document.getElementById(b).childNodes[0].focus();clearSelection();startSelect=b;if(!isMSIE){enableTextSelect(a,false);enableTextSelect(startSelect,true)}}}function elementExist(a){if(document.getElementById(a)==null){return false}else{return true}}function checkArrowPress(c,a){var d=c.split("_");if(a.keyCode==13){a.cancelBubble=true;a.returnValue=false;var b=stripHTML(document.getElementById(c).childNodes[0].innerHTML);if(b.length>0){cleanInfix(b);sendVal()}}if(a.ctrlKey==1){startSelect=c;if(a.keyCode==37){calcLeftPos(d)}else{if(a.keyCode==38){calcUpPos(d)}else{if(a.keyCode==39){calcRightPos(d)}else{if(a.keyCode==40){calcDownPos(d)}}}}}};