// Form Validation

function validateContact(){
	
	var theform = document.getElementById("theform");
	
	var bFirstName, bLastName, bAddress, bCity, bZip, bEmail = true;
	var msg = "The following fields are required and must be completed:\n";
	
	if (theform.tbFirstName.value == "") {
		bFirstName = false;
		msg += "+ First Name\n";
	} else {
		bFirstName = true;
	}
	
	if (theform.tbLastName.value == "") {
		bLastName = false;
		msg += "+ Last Name\n";
	} else {
		bLastName = true;
	}
	
	if (theform.tbAddress.value == "") {
		bAddress = false;
		msg += "+ Address\n";
	} else {
		bAddress = true;
	}
	
	if (theform.tbCity.value == "") {
		bCity = false;
		msg += "+ City\n";
	} else {
		bCity = true;
	}
	
	if (theform.tbZip.value == "") {
		bZip = false;
		msg += "+ Zip\n";
	} else {
		bZip = true;
	}
	
	if (theform.tbEmail.value == "") {
		bEmail = false;
		msg += "+ Email Address\n";
	} else {
		bEmail = true;
	}
	
	if (bFirstName && bLastName && bAddress && bCity && bZip && bEmail) {
		theform.submit();
	} else {
		alert(msg);
		return;
	}
	
}


function validateLogin() {
	
	var theform = document.getElementById("theform");
	
	var bUsername, bPassword = true;
	var msg = "The following fields are required and must be completed:\n";
	
	if (theform.tbUsername.value == "") {
		bUsername = false;
		msg += "+ Username\n";
	} else {
		bUsername = true;
	}
	
	if (theform.tbPassword.value == "") {
		bPassword = false;
		msg += "+ Password\n";
	} else {
		bPassword = true;
	}
	
	if (bUsername && bPassword) {
		theform.submit();
	} else {
		alert(msg);
		return;
	}
	

}