var httpRequest;

// Mozilla, Safari
if (window.XMLHttpRequest)
    httpRequest = new XMLHttpRequest();
else if (window.ActiveXObject)
    // IE
    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");