startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function PostHTTPRequest(script, call, onreadystatechange) {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		try {
			req.onreadystatechange = onreadystatechange;
			req.open("POST", script, true);
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			req.send(call);
		} catch (e) {
   	  		alert(e);
   		}
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = onreadystatechange;
			req.open("POST", script, true);
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			req.send(call);
		}
	}
}
function ShowBlock( Obj ){
	document.getElementById(Obj).style.display = "block";
}
function ShowInline( Obj ){
	document.getElementById(Obj).style.display = "inline";
}
function Hide( Obj ){
	document.getElementById(Obj).style.display = "none";
}
function Disable( Obj ) {
	document.getElementById(Obj).disabled = true;
}
function Enable( Obj ) {
	document.getElementById(Obj).disabled = false;
}
// Get element by ID
function GEBI( Obj ){
	return document.getElementById(Obj);
}

function CheckPostForm()
{
	/*
	if (document.registration.firstName.value == "")
  {
    alert("Please enter your first name in the field.");
    document.registration.name.focus();
    return (false);
  }
  
  if (document.registration.lastName.value == "")
  {
    alert("Please enter your last name in the field.");
    document.registration.name.focus();
    return (false);
  }
  
	if (document.registration.email.value == "")
  {
    alert("Please enter your email in the field.");
    document.registration.email.focus();
    return (false);
  }
  */
  
  	var call;
  	var i;
  	var regclasses = '';
  	for ( i = 0; i < document.registration.elements.length; i++ ) {
		if (document.registration.elements[i].type == 'checkbox' ) {
			if (document.registration.elements[i].checked == true) {
				regclasses = regclasses + document.registration.elements[i].name + '~';
			}
		}
	}
	
	call = "mb_class_complete.php";
	querystring = "Action=Submit&company=" + GEBI("company3").value + "&firstName=" + GEBI("firstName").value + "&lastName=" + GEBI("lastName").value + "&address=" + GEBI("address").value + "&city=" + GEBI("city").value + "&state=" + GEBI("state").value + "&zip=" + GEBI("zip").value + "&email=" + GEBI("email").value + "&phone=" + GEBI("phone").value + "&regclasses=" + regclasses;
	PostHTTPRequest(call, querystring, CheckPostForm_ProcessStateChange);

}

function CheckPostForm_ProcessStateChange(){
	if (req.readyState == 4) {
		if (req.status == 200) {
			alert("200");
			alert(req.responseText);
			//window.href.location('registration_thanks.php?' + req.responseText);
		} else {
			//alert("noway");
			//window.href.location('registration_thanks.php?' + req.responseText);
			window.location.href('registration_thanks.php');
		}
	} 
}

function deleteRecord(id)
{

	Hide("content");
	ShowBlock("processing");
  	call = "delete_enrollment.php";
	querystring = "Action=Submit&id=" + id;
	PostHTTPRequest(call, querystring, deleteRecord_ProcessStateChange);

}

function deleteRecord_ProcessStateChange(){
	if (req.readyState == 4) {
		if (req.status == 200) {
			//alert(req.responseText);
			Hide("processing");
			window.location.href = 'registered_user_list.php?';
		} else {
			//alert(req.responseText);
			alert("Error Trying to Delete Record");
		}
	} 
}


