   var http_request = false;
   var divToUpdate  = '';
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      
      if(http_request.readyState !=4) {
   	  	var statusDIV = document.getElementById('statusUpdate');
		if(statusDIV.firstChild) {
			statusDIV.removeChild(statusDIV.firstChild);
			statusDIV.innerHTML = "Searching for Matching FoilSeals . . .";
		} else {
			statusDIV.appendChild(document.createTextNode('Processing . . . ' + http_request.readyState));
		}
	  }
      if (http_request.readyState == 4) {
		var statusDIV = document.getElementById('statusUpdate');	  
		if(statusDIV.firstChild) {
			statusDIV.removeChild(statusDIV.firstChild);
			statusDIV.innerHTML = "Complete";
		} else {
			statusDIV.innerHTML = "Complete";
		}	  
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById(divToUpdate).innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   	}

	function update(obj) {
		var poststr = '';
		divToUpdate = 'update';
		for(i=0; i < document.getElementsByName("pt").length; i++)	{
			newObj = document.getElementsByName("pt")[i];
			if(newObj.checked) {
				if(poststr=='') {
					poststr = newObj.name + "=" + newObj.value;
				} else {
					poststr += "&" + newObj.name + "=" + newObj.value;
				}	
			} 
		}
		for(i=0; i < document.getElementsByName("pc").length; i++)	{
			newObj = document.getElementsByName("pc")[i];
			if(newObj.checked) {
				if(poststr =='') {
					poststr = newObj.name + "=" + newObj.value;
				} else {
					poststr += "&" + newObj.name + "=" + newObj.value;
				}	
			} 
		}
		for(i=0; i < document.getElementsByName("ct").length; i++)	{
			newObj = document.getElementsByName("ct")[i];
			if(newObj.checked) {
				if(poststr =='') {
					poststr = newObj.name + "=" + newObj.value;
				} else {
					poststr += "&" + newObj.name + "=" + newObj.value;
				}	
			} 
		}
		for(i=0; i < document.getElementsByName("ab").length; i++)	{
			newObj = document.getElementsByName("ab")[i];
			if(newObj.checked) {
				if(poststr =='') {
					poststr = newObj.name + "=" + newObj.value;
				} else {
					poststr += "&" + newObj.name + "=" + newObj.value;
				}	
			} 
		} 

		var backing = document.getElementById("backing");
		//alert(backing.options[backing.selectedIndex].value);
		if(backing.options[backing.selectedIndex].value != "0") {
			if(poststr == '') {
				poststr = backing.name + "=" + backing.value;
			} else {
				poststr += "&" + backing.name + "=" + backing.value;	
			}
		}
		
		var foilseal = document.getElementById("foilseal");
		//alert(backing.options[backing.selectedIndex].value);
		if(foilseal.options[foilseal.selectedIndex].value != "0") {
			if(poststr == '') {
				poststr = foilseal.name + "=" + foilseal.value;
			} else {
				poststr += "&" + foilseal.name + "=" + foilseal.value;	
			}
		}		
		var ft = document.getElementById("thickness");
		//alert(ft.options[ft.selectedIndex].value);
		if(ft.options[ft.selectedIndex].value != "0") {
			if(poststr == '') {
				poststr = ft.name + "=" + ft.value;
			} else {
				poststr += "&" + ft.name + "=" + ft.value;	
			}
		}
		var b_type = document.getElementById("b_type");
		//alert(b_type.options[b_type.selectedIndex].value);
		if(b_type.options[b_type.selectedIndex].value != "0") {
			if(poststr == '') {
				poststr = b_type.name + "=" + b_type.value;
			} else {
				poststr += "&" + b_type.name + "=" + b_type.value;	
			}
		}		

		
		if(poststr=='') {
			document.getElementById('update').innerHTML = "Please select criteria above to display results";			
		} else {

			poststr +="&type=detailProd";
			
			makePOSTRequest('new_process.php?' + Date(), poststr);		
		}
	}
	
	function changeIndFood(indID) {
		divToUpdate = 'changeIndFood';
		poststr = "selectIndID=" + indID + "&type=getIndProd";
		makePOSTRequest('new_process.php', poststr);				  
	}
function clear(id) {
	//var radio = document.getElementsByName(id);
	alert(radio.checked);
	//radio.checked = false;
}	
