var xmlHttp
function trim(str,chars){return ltrim(rtrim(str,chars),chars);}
function ltrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");}
function rtrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");}
function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
function refreshStatus(url)
{xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Browser does not support HTTP Request");return;}
xmlHttp.onreadystatechange=setStatus;xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function updateStatus(status)
{xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Browser does not support HTTP Request.  Please ensure JavaScript is enaled in your web browser.");return false;}
xmlHttp.open("POST","/statusUpdate.php",false);xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');var params="status="+status;xmlHttp.send(params);refreshStatus("/status.php");}
function setStatus()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{document.getElementById("statustext").innerHTML=xmlHttp.responseText;}}
function doActionDialog(url)
{clearActionDialog();xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Browser does not support HTTP Request");return;}
xmlHttp.onreadystatechange=actionDlgStateChanged;xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function actionDlgStateChanged()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
document.getElementById("actiondialogcontents").innerHTML=xmlHttp.responseText;}
function clearActionDialog()
{document.getElementById("actiondialogcontents").innerHTML="Loading, please wait...";}
function lightup(imgName)
{try{if(document.images)
{imgOn=eval(imgName+"on.src");document[imgName].src=imgOn;}}catch(e){}}
function lightupSelected(imgName)
{eval(imgName+"selected = true;");lightup(imgName);}
function turnoff(imgName)
{if(document.images)
{selected=eval(imgName+"selected");if(selected)
return;imgOff=eval(imgName+"off.src");document[imgName].src=imgOff;}}
function forceoff(imgName)
{if(document.images)
{eval(imgName+"selected = false;");imgOff=eval(imgName+"off.src");document[imgName].src=imgOff;}}
function turnoffSelected(imgName)
{try{if(document.images)
{eval(imgName+"selected = false;");imgOff=eval(imgName+"off.src");document[imgName].src=imgOff;}}catch(e){}}
function doStatusChange(){if(document.getElementById("statustext"))
document.getElementById("statustext").innerHTML="<form name=\"status\" method=\"post\" onsubmit=\"return false;\"><textarea rows=\"2\" cols=\"17\" name=\"inputstatus\">"+document.getElementById("actualstatustext").innerHTML+"</textarea><input type=\"submit\" value=\"OK\" onclick=\"document.getElementById('actualstatustext').innerHTML = document.status.inputstatus.value; updateStatus(document.status.inputstatus.value);\" /></form>";}