function ajax() {
  
  this.dashChange = 'ajaxChange';
  
  this.getHTTPObject = function() {
    // gets a HTTP object ---------------------------------------------------------------------------
    if (window.ActiveXObject) {
      return new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) {
      return new XMLHttpRequest();
    } else {
      return null;
    }
  } // end getHTTPObject --------------------------------------------------------------
  
  
  this.get_request_change = function(page, id) {
    // sends a GET request to the PHP page specified in the argument and sets the innerHTML of id to the response text
    
    httpObject = this.getHTTPObject();
    if (httpObject && (httpObject.readyState == 4 || httpObject.readyState == 0)) {
      httpObject.open("GET", page, true);
      httpObject.onreadystatechange = function() {
				if (httpObject.readyState==4) {
					$(id).innerHTML = httpObject.responseText;
					var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
					if (window.addthis){
							window.addthis = null;
					}
					jq.getScript( script );
				}
			};
      httpObject.send(null);
    }
    window.returnValue = false;
    return false;
    
  } // end request_get -----------------------------
  
  this.fetchNodeCode = function(imageIndex) {
    $pg = 'fetchNodeCode.ajax.php?img=' + imageIndex;
	this.get_request_change($pg, this.dashChange);
  }
  
}

var ajax = new ajax();
