var xhrObj = false;

// Choose object type based on browser support
if (window.XMLHttpRequest) { // firefox/safari/mozilla/ie7
  xhrObj = new XMLHttpRequest();
} else if (window.ActiveXObject) { // ie6 or older
  try {
    xhrObj = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e1) {
    try {
      xhrObj = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e2) {}
  } // end catch (e1)
} // end else if

// Alert if object not created
if (!xhrObj) {
  alert('Failed creating Ajax object. Some page functionality will not be available.');
}

