function ajax(strURL,qstr,nid) { 
  var xmlHttpReq = false;
  var self = this;
  if (window.XMLHttpRequest) self.xmlHttpReq = new XMLHttpRequest();
  else if (window.ActiveXObject) self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  self.xmlHttpReq.open('POST', strURL, false);
  self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  self.xmlHttpReq.send(qstr);
  if(nid) document.getElementById(nid).innerHTML = self.xmlHttpReq.responseText;
  else return self.xmlHttpReq.responseText
}