//Code by Paul James
//http://www.peej.co.uk/articles/rich-user-experience.html

function getHTTPObject() {
  if (typeof XMLHttpRequest != 'undefined') {
    return new XMLHttpRequest();
  }
  try {
    return new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      return new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
	  alert("");
    }
  }
  return false;
}

//Code by Matt Denninghoff
//http://www.budsgunshop.com/
//

//Fill an element whose id is in the 1st parameter with
// the html returned from the URL in the 2nd parameter.
  function loadBoxContent(BoxID, urlToGet){
      var boxElement = document.getElementById(BoxID);
      var boxhttp=getHTTPObject();
      boxhttp.onreadystatechange=function(){
         if( boxhttp.readyState==4 ){
            boxElement.innerHTML=boxhttp.responseText;
         }else if( boxhttp.readyState==1){
            /*boxElement.innerHTML = "Loading...";*/
            boxElement.innerHTML = '<img src="/catalog/images/ajax-loader_clock.gif" border="0" alt="Loading..." title="Loading...">';
         }
      }
      boxhttp.open("GET",urlToGet,true);
      boxhttp.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
      boxhttp.setRequestHeader("Cookie",document.cookie);
      boxhttp.send(null);
  }

 var undefined;	//for compatibility with older js browsers.

/*  Code from http://www.w3schools.com
	function to take some text and return an xml document element.
*/
function xmlParse(text){
  if (window.ActiveXObject) //code for IE
  {
    var doc=new ActiveXObject("Microsoft.XMLDOM");
    doc.async="false";
    doc.loadXML(text);
  }
  else //code for Mozilla, Firefox, Opera, etc.
  {
    var parser=new DOMParser();
    var doc=parser.parseFromString(text,"text/xml");
  }
  return(doc.documentElement);
}
