function checkService(x) {
eval("t=xmlhttp"+x);
if (t==null)
{
alert ("Your browser does not support XMLHTTP!");
return;
}
t.onreadystatechange=function() {
eval("t2=xmlhttp"+x);
if(t2.readyState==4) {
tmp=t2.responseText.split(" ",2);
idName=tmp[1]+"-status";
idAction=tmp[1]+"-action";
td=document.getElementById(idName);
td2=document.getElementById(idAction);
if(tmp[0]=="started") {
td.innerHTML="Responding";
td2.innerHTML="<a href='#' >+tmp[1]+",\"stop\")'><img alt='stop' src='stopped.png' width='20' height='20'/></a>";
td2.innerHTML+="<a href='#' >+tmp[1]+",\"restart\")'><img alt='restart' src='restart.png' width='20' height='20'/></a>";
td.style.backgroundColor="lime";
td.style.color="blue";
}
else {
td.innerHTML="Not Responding";
td2.innerHTML="<a href='#' >+tmp[1]+",\"start\")' ><img alt='start' src='start.png' width='20' height='20'/></a>";
td.style.backgroundColor="red";
td.style.color="yellow";
}
}
};
t.open('GET','check_service.php?service='+x,true);
t.send(null);
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
function doAction(id,action,sleep) {
var answer = confirm("Are You Sure ?");
if ( ! answer ){
return;
}
eval("t=xmlhttp_a"+id);
if (t==null)
{
alert ("Your browser does not support XMLHTTP!");
return;
}
td=document.getElementById(id+"-status");
td.innerHTML="<img alt='proccessing' src='processing.gif' width='100' height='30'/>";
td.style.backgroundColor="white";
td2=document.getElementById(id+"-action");
td2.innerHTML="";
url='action.php?service='+id+"&action="+action;
url+="&manuall";
t.open('GET',url,false);
t.send(null);
checkService(id);
}