function getDates() {  // This function does the AJAX request

document.getElementById('deliveryDateMsg').innerHTML = '<img src="/images/indicator_arrows.gif" />';

http2.open("GET", "/functions/f.date3.php", true);
  http2.onreadystatechange = getHttpRes2;
  http2.send(null);
}

function getHttpRes2() {
  if (http2.readyState == 4) { 
    res2 = http2.responseText;  // These following lines get the response and update the page
    document.getElementById('deliveryDateField').innerHTML = res2;	
	document.getElementById('deliveryDateMsg').innerHTML = '<img src="/images/tick.gif" style=\"margin-top:0px;\" />';
  }
}

function getXHTTP2() {
  var xhttp2;
   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
      xhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
 		 // This block handles Mozilla/Firefox browsers...
	    try {
	      xhttp2 = new XMLHttpRequest();
	    } catch (e3) {
	      xhttp2 = false;
	    }
      }
    }	
  return xhttp2; // Return the XMLHTTP object
}

var http2 = getXHTTP2(); // This executes when the page first loads.
