
function AjaxRequestBegin(req) {
  //alert(AjaxRequest.numAjaxRequests + ':' + AjaxRequest.numActiveAjaxRequests);
  
  var infoText = req.infoText;
  var id = req.requestIndex;  
  var theCell = document.getElementById('ajax_activity');  
  var newdiv = document.createElement('div');

  newdiv.setAttribute('id','ajax'+id);
  newdiv.setAttribute('onclick','alert(\'' + infoText + '\')');
  newdiv.className = 'AjaxOn';
  newdiv.innerHTML = '&nbsp;';  
  theCell.appendChild(newdiv);
  
  if (AjaxRequest.numActiveAjaxRequests == 1 && gblnAJAXShowLoading == true)
    {theCell.style.visibility='visible';}
  
  if (gDebugMode) addDebug('Client', '100', infoText + '(' + id + ')');
}


function AjaxRequestEnd(req) {
  //alert(AjaxRequest.numAjaxRequests + ':' + AjaxRequest.numActiveAjaxRequests);
  
  var infoText = req.infoText;
  var id = req.requestIndex;
  var theCell = document.getElementById('ajax_activity');     
  var olddiv = document.getElementById('ajax'+id);

  if (isObject2(olddiv) == true)  //3.23.0.0 asr added
    {theCell.removeChild(olddiv);}
  
  
  if (AjaxRequest.numActiveAjaxRequests == 0)
    {theCell.style.visibility='hidden';}
  
  if (gDebugMode) addDebug('Client', '200', infoText + '(' + id + ')');
}

function AjaxRequestTimeout(req) {  
  var infoText = req.infoText;
  var id = req.requestIndex;
  var theCell = document.getElementById('ajax_activity');     
  var olddiv = document.getElementById('ajax'+id);

  theCell.removeChild(olddiv);
  
  if (gDebugMode) addDebug('Client', '300', infoText + '(' + id + ') Timeout');
}


function addDebug(source, id, text) {
  var cellClass = 'debug_' + id.charAt(0);
  var table = document.getElementById('debug');
  var row = table.insertRow(0);
  var sourceCell = row.insertCell(0);
  var idCell = row.insertCell(1);
  var textCell = row.insertCell(2);
  sourceCell.style.width = '77px';
  idCell.style.width = '77px';
  sourceCell.className = cellClass;
  idCell.className = cellClass;
  textCell.className = cellClass;
  sourceCell.innerHTML = source;
  idCell.innerHTML = id;
  textCell.innerHTML = text;
}