// Simple functions to update the page
function makeActive(o) { o.innerHTML = "Active"; o.style.backgroundColor = "#00ff00"; }
function makeInactive(o) { o.innerHTML = "Inactive"; o.style.backgroundColor = "#ff0000"; }
// Functions called by global begin/end
function AjaxRequestBegin() { makeActive(document.getElementById('ajaxActivity')); }
function AjaxRequestEnd() { makeInactive(document.getElementById('ajaxActivity')); }
// Functions called by group begin/end
function AjaxRequestGroupBegin(groupName) { makeActive(document.getElementById(groupName+"Activity")); }
function AjaxRequestGroupEnd(groupName) { makeInactive(document.getElementById(groupName+"Activity")); }
function getResponse2(target,groupName) {
AjaxRequest.get(
{
'url':'sleep.pl'
,'onSuccess':function(req){ target.value=req.responseText; }
,'groupName':groupName // Assigns this request to the group passed in
,'onGroupBegin':AjaxRequestGroupBegin // Map to the function called when this group starts
,'onGroupEnd':AjaxRequestGroupEnd // Map to the function called when this group ends
}
);
}