/* This initiates the xmlhttprequest call and also initiates the XSLTProcessor for Gecko type  browsers. The variables in the init call convey required values from the event call on the web page to the asynchronous function which makes the xmlhttprequest */

  var xmlDocument, xslStylesheet;
  var xsltProcessor = new XSLTProcessor();

function initiate(callType,xmlDoc,xslDoc,divId){
  asynchronous.call(callType,xmlDoc,divId);
  asynchronous2.call(callType,xslDoc);
  }

  var asynchronous = new Asynchronous();
  asynchronous.complete = AsyncUpdateEvent;
  
  var asynchronous2 = new Asynchronous();
  asynchronous2.complete = AsyncUpdateEvent2;
  
function AsyncUpdateEvent(status, statusText, responseText, responseXML, divId) {
    var timeout = 4000;
    xmlDocument = responseXML;
    setTimeout(function(){doTransform(divId)},timeout); // A closure is used so parameter can still be passed
}
  
function AsyncUpdateEvent2(status, statusText, responseText, responseXML) {
    xslStylesheet = responseXML;
    xsltProcessor.importStylesheet(xslStylesheet);
}

