var correctField = "#ffffff";
var incorrectField = "#FFCC99";

/*
function submitForm() {
	if ( isFilled() ) {
		if (confirm("Thankyou.\nYour submission is now being sent.") ) {
			return true;
		}
	}
	
	else
		return false;   
}
*/

function isFilled() {
	var frm = document.forms[0];

	// if New Employer radio is selected
	if (frm.radioPAForm[0].checked) {

		if (frm.FirstName.value == "") {
			alert("Please enter your First Name.");
			frm.FirstName.style.backgroundColor = incorrectField;
			frm.FirstName.focus();
			return false;
		}

		else if (frm.LastName.value == "") {
			alert("Please enter your Last Name.");
			frm.LastName.style.backgroundColor = incorrectField;
			frm.LastName.focus();
			return false;
		}

		else if (frm.JobTitle.value == "") {
			alert("Please enter your Job Title.");
			frm.JobTitle.style.backgroundColor = incorrectField;
			frm.JobTitle.focus();
			return false;
		}

		else if (frm.PracticeName.value == "") {
			alert("Please enter your Practice Name.");
			frm.PracticeName.style.backgroundColor = incorrectField;
			frm.PracticeName.focus();
			return false;
		}

		else if (frm.Address.value == "") {
			alert("Please enter your Address.");
			frm.Address.style.backgroundColor = incorrectField;
			frm.Address.focus();
			return false;
		}

		else if (frm.Suburb.value == "") {
			alert("Please enter your Suburb.");
			frm.Suburb.style.backgroundColor = incorrectField;
			frm.Suburb.focus();
			return false;
		}

		else if (frm.State.value == "PleaseSelect") {
			alert("Please select a state.");
			frm.State.style.backgroundColor = incorrectField;
			frm.State.focus();
			return false;
		}

		else if (frm.Postcode.value == "") {
			alert("Please enter your Postcode.");
			frm.Postcode.style.backgroundColor = incorrectField;
			frm.Postcode.focus();
			return false;
		}
	 
		else if (frm.Country.value == "") {
			alert("Please select your Country.");
			frm.Country.style.backgroundColor = incorrectField;
			frm.Country.focus();
			return false;
		}
	 
		else if (frm.Email.value == "") {
			alert("Please enter your Email Address.");
			frm.Email.style.backgroundColor = incorrectField;
			frm.Email.focus();
			return false;
		}
	 
		else if (frm.DirectPhone.value == "") {
			alert("Please enter your Phone Number.");
			frm.DirectPhone.style.backgroundColor = incorrectField;
			frm.DirectPhone.focus();
			return false;
		}
	 
		else if (frm.Position.value == "") {
			alert("Please enter the Position.");
			frm.Position.style.backgroundColor = incorrectField;
			frm.Position.focus();
			return false;
		}
	 
		else if (frm.JobDescription.value == "") {
			alert("Please enter your advertisement.");
			frm.JobDescription.style.backgroundColor = incorrectField;
			frm.JobDescription.focus();
			return false;
		}
	}

	else if (frm.radioPAForm[1].checked) {
		if (frm.AssignmentNumber.value == "") {
			alert("Please enter your E-mail address.");
			frm.AssignmentNumber.style.backgroundColor = incorrectField;
			frm.AssignmentNumber.focus();
			return false;
		}
	 
		else if (frm.Position.value == "") {
			alert("Please enter the Position.");
			frm.Position.style.backgroundColor = incorrectField;
			frm.Position.focus();
			return false;
		}
	 
		else if (frm.JobDescription.value == "") {
			alert("Please fill in your advertisement details.");
			frm.JobDescription.style.backgroundColor = incorrectField;
			frm.JobDescription.focus();
			return false;
		}
	}

	return true;
}

function isCorrect() {
	var frm = document.forms[0];

	if (frm.radioPAForm[0].checked) {
		frm.FirstName.style.backgroundColor = correctField;
		frm.LastName.style.backgroundColor = correctField;
		frm.JobTitle.style.backgroundColor = correctField;
		frm.PracticeName.style.backgroundColor = correctField;
		frm.Address.style.backgroundColor = correctField;
		frm.Suburb.style.backgroundColor = correctField;
		frm.State.style.backgroundColor = correctField;
		frm.Postcode.style.backgroundColor = correctField;
		frm.Country.style.backgroundColor = correctField;
		frm.Email.style.backgroundColor = correctField;
		frm.DirectPhone.style.backgroundColor = correctField;
		frm.Position.style.backgroundColor = correctField;
		frm.JobDescription.style.backgroundColor = correctField;
		frm.AssignmentNumber.style.backgroundColor = "lightgrey";
	}

	else if (frm.radioPAForm[1].checked) {
		frm.AssignmentNumber.style.backgroundColor = correctField;
	}
}