var statusIndicator=document.createElement('div');
statusIndicator.id="statusIndicator";

function encodeHTML(html) {
   encodedHtml=escape(html);
   return encodedHtml;
}
function getXmlHttpRequestObject() {
   if(window.XMLHttpRequest) {
      return new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      return new ActiveXObject("Microsoft.XMLHTTP")
   } else {
      alert("can't make xmlhttprequest");
   }
}
function httpRequest(xmlData,destinationURL,statusIndicatorParent,statusText,callbackFunc,usePost) {
   if(SID!=false) {
      statusIndicator.innerHTML=statusText;
      if(statusIndicatorParent)
         statusIndicatorParent.insertBefore(statusIndicator,statusIndicatorParent.firstChild);
      var req = getXmlHttpRequestObject();
      if(callbackFunc!=false)
         req.onreadystatechange = function() { httpRequestCallback(req,callbackFunc);}
      req.open("POST",destinationURL,callbackFunc!=false);
      if(usePost) {req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');}
      req.send(xmlData);
   } else {
      alert("There was a problem reading your user ID. Please go to our contact page and notify technical support.");
   }
}
function checkSaveBlank() {}
function httpRequestCallback(req,callbackFunc) {
   if(req && req.readyState==4) {
      if(req && req.status==200) {
         callbackFunc(req,statusIndicator,true);
      } else {
         callbackFunc(req,statusIndicator,false);
      }
   }
}

function str2XML(str) {
   var xml;
   if(window.ActiveXObject) {
      xml = new ActiveXObject("MSXML2.DOMDocument");
      xml.loadXML(str);
      xml.setProperty("SelectionLanguage","XPath");
   } else {
      xml = (new DOMParser).parseFromString(str, "text/xml");
   }
   return xml;
}
