﻿var xmlHttp

function testButton()
{
alert("This is a test");
}

function sendApp()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 } 
var url="../labform.php";
var params="name="+document.getElementById('name').value+"&";
params=params+"email="+document.getElementById('email').value+"&";
params=params+"dob="+document.getElementById('DOB').value+"&";
params=params+"average="+document.getElementById('average').value+"&";
params=params+"why="+document.getElementById('why').value+"&";
params=params+"legal="+document.getElementById('legal').checked+"&";
params=params+"unitedstates="+document.getElementById('unitedstates').checked+"&";
params=params+"smoker="+document.getElementById('smoker').checked;

//alert(params);

xmlHttp.open("POST",url,true);

//Send the proper header information along with the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");

xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
	     document.getElementById("labsignup").innerHTML=xmlHttp.responseText;
	}
}
xmlHttp.send(params);

} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
 {
 objXMLHttp=new XMLHttpRequest()
 }
else if (window.ActiveXObject)
 {
 objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
 }
return objXMLHttp
}