//window.onerror = function(msg,url,line){ alert('\nError details' + '\nText:' + msg + '\nurl:' + url + '\nline:' + line); }

var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject() {
  var xmlHttp;
  try { xmlHttp = new XMLHttpRequest(); }
  catch(e){
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP");
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) {
      try { xmlHttp = new ActiveXObject(XmlHttpVersions[i]); }
      catch (e) {}
    }
  }
  if (!xmlHttp) alert("Error creating the XMLHttpRequest object.");
  else return xmlHttp;
}

function process() {
  var param = "rubr.php?";

  obj = document.getElementById('pid');
  if (obj) { param += 'pid='+obj.value; }

  obj = document.getElementById('cid');
  if (obj) { param += '&cid='+obj.value; }

  obj = document.getElementById('ccid');
  if (obj) { param += '&ccid='+obj.value; }

  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
    xmlHttp.open("GET", param, true);
    xmlHttp.onreadystatechange = handleServerResponse;
    xmlHttp.send(null);
  }
  // else setTimeout('process()', 1000);
}

function handleServerResponse() {
  if (xmlHttp.readyState == 4)
  {
    if (xmlHttp.status == 200)
    {
      xmlResponse = xmlHttp.responseXML;
      xmlDocumentElement = xmlResponse.documentElement;

      for (a=0; a < xmlDocumentElement.childNodes.length; a++ ) {
           currentNode = xmlDocumentElement.childNodes.item(a);
           value = currentNode.childNodes[0].nodeValue;
           target = currentNode.attributes[0].nodeValue;
           document.getElementById(target).innerHTML = value;
      }
      // setTimeout('process()', 1000);
    }
    else { alert("There was a problem accessing the server: " + xmlHttp.statusText); }
  }
}