http_request = false;

/**
 * Takes an order type and returns an ajax response
 * @param string type : [0: none|1: heating|2: gasoline|3: diesel]
 * @return string : html for dynamic part of form
 */
function makeRequest(type) {
	var textType = '';
	if (type == 1)
		textType = 'heating';
	else if (type == 2)
		textType = 'gasoline';
  else if (type == 3)
    textType = 'diesel';
		  
 // browser checking to create ajax object
  if (window.XMLHttpRequest)
    http_request = new XMLHttpRequest();
  else if (window.ActiveXObject)
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
  
  // format request
  url = 'proc.ajax.php?type=' + textType;
    
  // send and procss resonse
  http_request.onreadystatechange = updateForm;
  http_request.open('GET', url, true);
  http_request.send(null);
}

function updateForm() {
  if (http_request.readyState == 4) {
    if (http_request.status == 200)
      document.getElementById('dynamicForm').innerHTML = http_request.responseText;
    else
      alert('Error');
  }
}