
// Global variables
var enabledFieldColor = "#ffffff";
var disabledFieldColor = "lightgrey";


// Employer : Positions Available
// -----------------------------------

function isPAClick() {
	//var frmPAListing = document.formPAListing;
	var frmPAListing = document.forms(0);

	if (frmPAListing.radioPAForm[0].checked) {
		// enabled fields (New Employer)

		frmPAListing.existing.value = "0";

		frmPAListing.FirstName.disabled = false;
		frmPAListing.LastName.disabled = false;
		frmPAListing.JobTitle.disabled = false;
		frmPAListing.PracticeName.disabled = false;
		frmPAListing.Address.disabled = false;
		frmPAListing.Suburb.disabled = false;
		frmPAListing.State.disabled = false;
		frmPAListing.Postcode.disabled = false;
		frmPAListing.Country.disabled = false;
		frmPAListing.Email.disabled = false;
		frmPAListing.DirectPhone.disabled = false;
		frmPAListing.DirectPhone2.disabled = false;
		frmPAListing.Mobile.disabled = false;
		frmPAListing.Fax.disabled = false;

		frmPAListing.State.value = "PleaseSelect";

		// disabled fields (Registered Employer)
		frmPAListing.AssignmentNumber.disabled = true;

		frmPAListing.AssignmentNumber.value = "";
		fieldPAColor();
	}

	else if (frmPAListing.radioPAForm[1].checked) {
		// enabled fields (Registered Employer)
		frmPAListing.AssignmentNumber.disabled = false;

		frmPAListing.existing.value = "1";

		// disabled fields (New Employer)
		frmPAListing.FirstName.disabled = true;
		frmPAListing.LastName.disabled = true;
		frmPAListing.JobTitle.disabled = true;
		frmPAListing.PracticeName.disabled = true;
		frmPAListing.Address.disabled = true;
		frmPAListing.Suburb.disabled = true;
		frmPAListing.State.disabled = true;
		frmPAListing.Postcode.disabled = true;
		frmPAListing.Country.disabled = true;
		frmPAListing.Email.disabled = true;
		frmPAListing.DirectPhone.disabled = true;
		frmPAListing.DirectPhone2.disabled = true;
		frmPAListing.Mobile.disabled = true;
		frmPAListing.Fax.disabled = true;

		// set disabled fields blank
		frmPAListing.FirstName.value = "";
		frmPAListing.LastName.value = "";
		frmPAListing.JobTitle.value = "";
		frmPAListing.PracticeName.value = "";
		frmPAListing.Address.value = "";
		frmPAListing.Suburb.value = "";
		frmPAListing.State.value = "";
		frmPAListing.Postcode.value = "";
		frmPAListing.Country.value = "";
		frmPAListing.Email.value = "";
		frmPAListing.DirectPhone.value = "";
		frmPAListing.DirectPhone2.value = "";
		frmPAListing.Mobile.value = "";
		frmPAListing.Fax.value = "";
		fieldPAColor();
	}
}


// Applicant : Work Wanted
// ------------------------------

function isWWClick() {
	//var frmPAListing = document.formPAListing;
	var frmWWListing = document.forms(0);

	if (frmWWListing.radioWWForm[0].checked) {
		// enabled fields (New Applicant)

		frmWWListing.existing.value = "0";

		frmWWListing.FirstName.disabled = false;
		frmWWListing.LastName.disabled = false;
		frmWWListing.Address.disabled = false;
		frmWWListing.Suburb.disabled = false;
		frmWWListing.State.disabled = false;
		frmWWListing.Postcode.disabled = false;
		frmWWListing.Country.disabled = false;
		frmWWListing.Email.disabled = false;
		frmWWListing.DirectPhone.disabled = false;
		frmWWListing.Mobile.disabled = false;
		frmWWListing.Fax.disabled = false;

		frmWWListing.State.value = "PleaseSelect";

		// disabled fields (Registered Applicant)
		frmWWListing.AssignmentNumber.disabled = true;

		frmWWListing.AssignmentNumber.value = "";
		fieldWWColor();
	}

	else if (frmWWListing.radioWWForm[1].checked) {
		// enabled fields (New Applicant)
		frmWWListing.AssignmentNumber.disabled = false;

		frmWWListing.existing.value = "1";

		// disabled fields (Registered Applicant)
		frmWWListing.FirstName.disabled = true;
		frmWWListing.LastName.disabled = true;
		frmWWListing.Address.disabled = true;
		frmWWListing.Suburb.disabled = true;
		frmWWListing.State.disabled = true;
		frmWWListing.Postcode.disabled = true;
		frmWWListing.Country.disabled = true;
		frmWWListing.Email.disabled = true;
		frmWWListing.DirectPhone.disabled = true;
		frmWWListing.Mobile.disabled = true;
		frmWWListing.Fax.disabled = true;

		// set disabled fields blank
		frmWWListing.FirstName.value = "";
		frmWWListing.LastName.value = "";
		frmWWListing.Address.value = "";
		frmWWListing.Suburb.value = "";
		frmWWListing.State.value = "";
		frmWWListing.Postcode.value = "";
		frmWWListing.Country.value = "";
		frmWWListing.Email.value = "";
		frmWWListing.DirectPhone.value = "";
		frmWWListing.Mobile.value = "";
		frmWWListing.Fax.value = "";
		fieldWWColor();
	}
}


// Employer : Field Color
// --------------------------

function fieldPAColor() {
	//var frmPAListing = document.formPAListing;
	var frmPAListing = document.forms(0);

	if (frmPAListing.radioPAForm[0].checked) {
		// enabled field color (New Employer)
		frmPAListing.FirstName.style.backgroundColor = enabledFieldColor;
		frmPAListing.LastName.style.backgroundColor = enabledFieldColor;
		frmPAListing.JobTitle.style.backgroundColor = enabledFieldColor;
		frmPAListing.PracticeName.style.backgroundColor = enabledFieldColor;
		frmPAListing.Address.style.backgroundColor = enabledFieldColor;
		frmPAListing.Suburb.style.backgroundColor = enabledFieldColor;
		frmPAListing.State.style.backgroundColor = enabledFieldColor;
		frmPAListing.Postcode.style.backgroundColor = enabledFieldColor;
		frmPAListing.Country.style.backgroundColor = enabledFieldColor;
		frmPAListing.Email.style.backgroundColor = enabledFieldColor;
		frmPAListing.DirectPhone.style.backgroundColor = enabledFieldColor;
		frmPAListing.DirectPhone2.style.backgroundColor = enabledFieldColor;
		frmPAListing.Mobile.style.backgroundColor = enabledFieldColor;
		frmPAListing.Fax.style.backgroundColor = enabledFieldColor;
	
		// disabled field color (Registered Employer)
		frmPAListing.AssignmentNumber.style.backgroundColor = disabledFieldColor;
	}

	else if (frmPAListing.radioPAForm[1].checked) {
		// enabled field color (Registered Employer)
		frmPAListing.AssignmentNumber.style.backgroundColor = enabledFieldColor;

		// disabled field color (New Employer)
		frmPAListing.FirstName.style.backgroundColor = disabledFieldColor;
		frmPAListing.LastName.style.backgroundColor = disabledFieldColor;
		frmPAListing.JobTitle.style.backgroundColor = disabledFieldColor;
		frmPAListing.PracticeName.style.backgroundColor = disabledFieldColor;
		frmPAListing.Address.style.backgroundColor = disabledFieldColor;
		frmPAListing.Suburb.style.backgroundColor = disabledFieldColor;
		frmPAListing.State.style.backgroundColor = disabledFieldColor;
		frmPAListing.Postcode.style.backgroundColor = disabledFieldColor;
		frmPAListing.Country.style.backgroundColor = disabledFieldColor;
		frmPAListing.Email.style.backgroundColor = disabledFieldColor;
		frmPAListing.DirectPhone.style.backgroundColor = disabledFieldColor;
		frmPAListing.DirectPhone2.style.backgroundColor = disabledFieldColor;
		frmPAListing.Mobile.style.backgroundColor = disabledFieldColor;
		frmPAListing.Fax.style.backgroundColor = disabledFieldColor;
	}
}


// Applicant : Field Color
// --------------------------

function fieldWWColor() {
	//var frmPAListing = document.formPAListing;
	var frmWWListing = document.forms(0);

	if (frmWWListing.radioWWForm[0].checked) {
		// enabled field color (New Employer)
		frmWWListing.FirstName.style.backgroundColor = enabledFieldColor;
		frmWWListing.LastName.style.backgroundColor = enabledFieldColor;
		frmWWListing.Address.style.backgroundColor = enabledFieldColor;
		frmWWListing.Suburb.style.backgroundColor = enabledFieldColor;
		frmWWListing.State.style.backgroundColor = enabledFieldColor;
		frmWWListing.Postcode.style.backgroundColor = enabledFieldColor;
		frmWWListing.Country.style.backgroundColor = enabledFieldColor;
		frmWWListing.Email.style.backgroundColor = enabledFieldColor;
		frmWWListing.DirectPhone.style.backgroundColor = enabledFieldColor;
		frmWWListing.Mobile.style.backgroundColor = enabledFieldColor;
		frmWWListing.Fax.style.backgroundColor = enabledFieldColor;
	
		// disabled field color (Registered Employer)
		frmWWListing.AssignmentNumber.style.backgroundColor = disabledFieldColor;
	}

	else if (frmWWListing.radioWWForm[1].checked) {
		// enabled field color (Registered Employer)
		frmWWListing.AssignmentNumber.style.backgroundColor = enabledFieldColor;

		// disabled field color (New Employer)
		frmWWListing.FirstName.style.backgroundColor = disabledFieldColor;
		frmWWListing.LastName.style.backgroundColor = disabledFieldColor;
		frmWWListing.Address.style.backgroundColor = disabledFieldColor;
		frmWWListing.Suburb.style.backgroundColor = disabledFieldColor;
		frmWWListing.State.style.backgroundColor = disabledFieldColor;
		frmWWListing.Postcode.style.backgroundColor = disabledFieldColor;
		frmWWListing.Country.style.backgroundColor = disabledFieldColor;
		frmWWListing.Email.style.backgroundColor = disabledFieldColor;
		frmWWListing.DirectPhone.style.backgroundColor = disabledFieldColor;
		frmWWListing.Mobile.style.backgroundColor = disabledFieldColor;
		frmWWListing.Fax.style.backgroundColor = disabledFieldColor;
	}
}


// Employer : onLoad disableField
// ------------------------------------

function disabledPAField() {
	//var frmPAListing = document.formPAListing;
	var frmPAListing = document.forms(0);

	frmPAListing.AssignmentNumber.disabled = true;
	frmPAListing.AssignmentNumber.style.backgroundColor = disabledFieldColor;
	frmPAListing.AssignmentNumber.value = "";
}

// Applicant : onLoad disableField
// ------------------------------------

function disabledWWField() {
	//var frmPAListing = document.formPAListing;
	var frmWWListing = document.forms(0);

	frmWWListing.AssignmentNumber.disabled = true;
	frmWWListing.AssignmentNumber.style.backgroundColor = disabledFieldColor;
	frmWWListing.AssignmentNumber.value = "";
}

