function createXMLHttpRequest() {
  try { return new ActiveXObject("Msxml2.XMLHTTP");    } catch(e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
  try { return new XMLHttpRequest();                   } catch(e) {}
  return null;
}

function changedata(responseText) {
  alert(responseText);
  return null;
}

function savedata(inputData) {
  var httpRequest = createXMLHttpRequest();
  var data = inputData;
  httpRequest.onreadystatechange = function() {
    if (httpRequest.readyState == 4) {
      if (httpRequest.status == 200) {
        changedata(httpRequest.responseText);
      }
    }
  }
  httpRequest.open('POST', 'test.php', true);
  httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  httpRequest.send(data);
  return null;
}

function getEvents(thisID, thisTagName, thisSubTagName) {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById(thisID)) return false;
  var thisIDTags = document.getElementById(thisID).getElementsByTagName(thisTagName);
for (var i=0; i<thisIDTags.length; i++) thisIDTags[i].onclick = function () {
  var thisIDSubTags = this.getElementsByTagName(thisSubTagName);
	for (var j=0; j<thisIDSubTags.length; j++) {
    if (thisIDSubTags[j].attributes.getNamedItem("class") != null) {
      var IDValue = this.attributes.getNamedItem("id").value;
      var FieldName = thisIDSubTags[j].attributes.getNamedItem("class").value;
      var FieldValue = thisIDSubTags[j].innerHTML;
      var inputData="type="+thisID+"&id="+IDValue+"&column="+FieldName+"&value="+FieldValue;
      savedata(inputData);
    }    
  }
}
  return null;
}
