HTMLHttp.Request.prototype.iframeSetup = function()
{
 // In browsers with no XMLHttpRequest support: fallback to IFRAME buffers.
 // I'm using IFRAMEs in MSIE due to XMLHTTP not parsing text/html to a DOM.
 // Also used in IE5/Mac, Opera 7.x, Safari <1.2, some Konqueror versions, etc.

 // ADDED GLOBAL PROPERTIES:
 // 'iframe' is our reference to a dynamically created IFRAME buffer.
 this.iframe = null;
 // Track allocated IDs.
 HTMLHttp.Request._ifr_buf_count |= 0;
 this.iframeID = 'iframebuffer' + HTMLHttp.Request._ifr_buf_count++;

 // Create/setup the IFRAME.
 if (document.createElement && document.documentElement &&
  (window.opera || navigator.userAgent.indexOf('MSIE 5.0') == -1))
 {
  var ifr = document.createElement('iframe');
  ifr.setAttribute('id', this.iframeID);
  ifr.setAttribute('name', this.iframeID);
  // Hide with visibility instead of display to fix Safari bug.
  ifr.style.visibility = 'hidden';
  ifr.style.position = 'absolute';
  ifr.style.width = ifr.style.height = ifr.borderWidth = '0px';
  this.iframe = document.getElementsByTagName('body')[0].appendChild(ifr);
 }
 else if (document.body && document.body.insertAdjacentHTML)
 {
  // IE5.0 doesn't like createElement'd frames (won't script them) and IE4 just plain
  // doesn't support it. Luckily, this will fix them both:
  document.body.insertAdjacentHTML('beforeEnd', '<iframe name="' + this.iframeID +
   '" id="' + this.iframeID + '" style="display: none"></iframe>');
 }
 // This helps most IE versions regardless of the creation method:
 if (window.frames && window.frames[this.iframeID])
  this.iframe = window.frames[this.iframeID];
 this.iframe.name = this.iframeID;
};


HTMLHttp.Request.prototype.iframeSend = function(uri, formRef)
{
 // Routes a request through our hidden IFRAME. Pass a URI, and optionally a
 // reference to a submitting form. Requires proprietary 'readyState' property.

 if (!document.readyState) return false;

 // Opera fix: force the frame to render before setting it as a target.
 if (document.getElementById) var o = document.getElementById(this.iframeID).offsetWidth;

 // Either route the form submission to the IFRAME (easy!)...
 if (formRef) formRef.setAttribute('target', this.iframeID);
 else
 {
  // ...or load the provided URI in the IFRAME, checking for browser bugs:
  // 1) Safari only works well using 'document.location'.
  // 2) Opera needs the 'src' explicitly set!
  // 3) Konqueror 3.1 seems to think ifrDoc's location = window.location, so watch that too.
  var ifrDoc = this.iframe.contentDocument || this.iframe.document;

  if (!window.opera && ifrDoc.location &&
   ifrDoc.location.href != location.href) ifrDoc.location.replace(uri);
  else this.iframe.src = uri;
 }

 // Either way, set the loading flag and start the readyState checking loop.
 // Opera likes a longer initial timeout with multiple frames running...
 this.loadingURI = uri;
 setTimeout(this.myName + '.iframeCheck()', (window.opera ? 250 : 100));
 return formRef ? false : true;
};


HTMLHttp.Request.prototype.iframeCheck = function()
{
 // Called after a timeout, periodically calls itself until the load is complete.
 // Get a reference to the loaded document, using either W3 contentDocument or IE's DOM.

 doc = this.iframe.contentDocument || this.iframe.document;
 // Check the IFRAME's .readyState property and callback() if load complete.
 // IE4 only seems to advance to 'interactive' so let it proceed from there.
 var il = this.iframe.location, dr = doc.readyState;
 if ((il && il.href ? il.href.match(this.loadingURI.replace("\?", "\\?")) : 1) &&
     (dr == 'complete' || (!document.getElementById && dr == 'interactive')))
 {
  var cbDoc = doc.documentElement || doc;
  if (this.callback) this.callback(cbDoc,
   (cbDoc.innerHTML || (cbDoc.body ? cbDoc.body.innerHTML : '')));
  this.loadingURI = '';
 }
 else setTimeout(this.myName + '.iframeCheck()', 50);
};
