var xmlReq;
function XML_Request() {
  this.construct();
}

XML_Request.prototype.construct = function() {
  this.req = this.getReq();
}

XML_Request.prototype.getReq = function() {
  var iReq = false;

  if (window.XMLHttpRequest) {
    iReq = new XMLHttpRequest();
  } else if (typeof ActiveXObject != "undefined") {
    iReq = new ActiveXObject("Microsoft.XMLHTTP");
  }

  return iReq;
}


XML_Request.prototype.sendRequest = function(requestXML, callBackFunc, sendToUrl) {
  if (this.req.overrideMimeType) {
    this.req.overrideMimeType('text/xml');
  }

  var self = this;
  function doCallBack () {
    if (self.req.readyState == '4') {
      if (self.req.status == 200) {
        callBackFunc(self.req.responseXML);
      } else {
        alert('Request came back with status = "' + self.req.status + '"');
      }
    }
  }

  var collector = sendToUrl || 'rpc2.php';
  this.req.onreadystatechange = doCallBack;
  this.req.open('POST', collector, true);
  this.req.send(requestXML);
}