var arrCommandHistory = new Array();var iCommandHistoryIndex = 0;var isContactMode = false;var contactPrompt = '';function handleKeyPress(keyCode, obj){switch(keyCode){case 13:handleReturn(obj);break;case 38:if(iCommandHistoryIndex > 0){iCommandHistoryIndex --;document.getElementById('commandContainer').innerHTML = arrCommandHistory[iCommandHistoryIndex];document.getElementById('entryBox').value = arrCommandHistory[iCommandHistoryIndex];}break;case 40:if(iCommandHistoryIndex < arrCommandHistory.length){if(iCommandHistoryIndex < arrCommandHistory.length-1){iCommandHistoryIndex ++;}document.getElementById('commandContainer').innerHTML = arrCommandHistory[iCommandHistoryIndex];document.getElementById('entryBox').value = arrCommandHistory[iCommandHistoryIndex];}break;default:document.getElementById('commandContainer').innerHTML = obj.value.replace(/ /g, '&nbsp;');}}function handleReturn(obj){ arrCommandHistory[arrCommandHistory.length] = obj.value; iCommandHistoryIndex = arrCommandHistory.length;  var head=document.getElementsByTagName('head').item(0); var old=document.getElementById('lastScript'); if(old)head.removeChild(old); script=document.createElement('script'); script.src='RPC-Executer.aspx?command='+obj.value+'&random='+(Math.round((Math.random()*1000)+1)); script.type='text/javascript'; script.defer=true; script.id='lastScript'; void(head.appendChild(script));}function RPCCallback(sHTML){sHTML = sHTML.replace(/&lt;/g, '<');var obj = document.getElementById('entryBox');var sOutput = '';if(!isContactMode){sOutput += '<div style="padding-bottom:15px;">C:\\> '+obj.value+'<br />';setPromptToNormal();}else{sOutput += '<div style="padding-bottom:15px;">'+document.getElementById('commandPrompt').innerHTML+'&nbsp;'+obj.value+'<br />';document.getElementById('commandPrompt').innerHTML = contactPrompt+': ';}sOutput += sHTML;sOutput += '</div>';document.getElementById('outputContainer').innerHTML += sOutput;obj.value = '';document.getElementById('commandContainer').innerHTML = '';window.scrollBy(0,10000); }function RPCCallbackClearScreen(){document.getElementById('entryBox').value = '';document.getElementById('outputContainer').innerHTML = '<br>';document.getElementById('commandContainer').innerHTML = '';window.scrollBy(0,-10000); }function setPromptToNormal(){document.getElementById('commandPrompt').innerHTML = 'C:\\>';}function popUp(sURL){var oWin = window.open(sURL, '', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');if (oWin==null || typeof(oWin)=="undefined"){alert("It seems that you have a popup blocker enabled.  Please disable it and try again.");}}function setFocusToEntryBox(){var o = document.getElementById('entryBox');o.focus();o.value = o.value;}