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

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

http1.open("GET", "/functions/f.getPrice.php?quantity="+document.getElementById('quantity').value+"&fuelType="+document.getElementById('fuelType').value+"&business="+document.getElementById('business').value+"&date1="+document.getElementById('delivery').value+"&postcode="+document.getElementById('postcode').value+"&promo="+document.getElementById('promo').value, true);
  http1.onreadystatechange = getHttpRes1;
  http1.send(null);
}

function getHttpRes1() {
  if (http1.readyState == 4) { 
    res1 = http1.responseText;  // These following lines get the response and update the page
		if(res1 == "error1") {
			document.getElementById('errorMsg').innerHTML = '<p>No price data available. Please call us on 01262 673346.</p>';
		} else {
			document.getElementById('priceBox').innerHTML = res1;	
		}
  }
}

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

var http1 = getXHTTP1(); // This executes when the page first loads.
