function validate() {	
	var rtrStatus = true;
	var ErrMsg = 'You left out the following fields:                           ';
	var ErrPosition = 'Position Applied For';
	var ErrFName = 'Full Name (MR / MS / MDM)';
	var ErrHAddress = 'Home Address';
	var ErrAge = 'Age';
	var ErrSex = 'Sex';
	var ErrNric = 'New NRIC';
	var ErrDob = 'Date of Birth';
	var ErrReligion = 'Religion';
	var ErrHp = 'H/P';
	var ErrEAddress = 'Email Address';
	var ErrEName = 'Name of School / College / University';
	var ErrEFrom = 'From';
	var ErrETo = 'To';
	var ErrEState = 'State / Country';
	var ErrGrade = 'Grade Achieved';
	var ErrLanguages = 'Languages Written / Spoken';
	var ErrSkills = 'Other Training or skills / Factory or Office';
	var ErrRName = 'Name';
	var ErrROccupation = 'Occupation';
	var ErrRContact = 'Contact No';
	var ErrRYears = 'Years Known';
	var ErrDeclaration = 'Declaration';
	var strEmptyFields = '';
	var thisDoc = document.form1;	
	if (thisDoc.position.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrPosition + '\n'};
	if (thisDoc.full_name.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrFName + '\n'};
	if (thisDoc.home_address.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrHAddress + '\n'};
	if (thisDoc.age.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrAge + '\n'};
	if (thisDoc.sex.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrSex + '\n'};
	if (thisDoc.nric.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrNric + '\n'};
	if (thisDoc.dob.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrDob + '\n'};
	if (thisDoc.religion.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrReligion + '\n'};
	if (thisDoc.hp.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrHp + '\n'};
	if (thisDoc.email.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrEAddress + '\n'};
	if (thisDoc.educational_name.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrEName + '\n'};
	if (thisDoc.educational_from.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrEFrom + '\n'};
	if (thisDoc.educational_to.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrETo + '\n'};
	if (thisDoc.educational_state.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrEState + '\n'};
	if (thisDoc.educational_grade.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrGrade + '\n'};
	if (thisDoc.languages.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrLanguages + '\n'};
	if (thisDoc.skills.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrSkills + '\n'};
	if (thisDoc.references_name.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrRName + '\n'};
	if (thisDoc.references_occupation.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrROccupation + '\n'};
	if (thisDoc.references_contact.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrRContact + '\n'};
	if (thisDoc.references_years.value.length == 0) {strEmptyFields = strEmptyFields + ' ' + ErrRYears + '\n'};
	if (thisDoc.declaration.checked == false) {strEmptyFields = strEmptyFields + ' ' + ErrDeclaration + '\n'};

	if (strEmptyFields.length > 0){
		window.alert(ErrMsg + '\n\n' + strEmptyFields)
		rtrStatus = false;
	}else{
		setField(thisDoc);
		rtrStatus = true;
	}

	return rtrStatus;
}

function setField(object){
	var thisDoc = object;
	// Selections
	if (thisDoc.hse.value.length == 0) {thisDoc.hse.value="-"};
	if (thisDoc.educational_name_b.value.length == 0) {thisDoc.educational_name_b.value="-"};
	if (thisDoc.educational_from_b.value.length == 0) {thisDoc.educational_from_b.value="-"};
	if (thisDoc.educational_to_b.value.length == 0) {thisDoc.educational_to_b.value="-"};
	if (thisDoc.educational_state_b.value.length == 0) {thisDoc.educational_state_b.value="-"};
	if (thisDoc.educational_grade_b.value.length == 0) {thisDoc.educational_grade_b.value="-"};
	if (thisDoc.educational_name_c.value.length == 0) {thisDoc.educational_name_c.value="-"};
	if (thisDoc.educational_from_c.value.length == 0) {thisDoc.educational_from_c.value="-"};
	if (thisDoc.educational_to_c.value.length == 0) {thisDoc.educational_to_c.value="-"};
	if (thisDoc.educational_state_c.value.length == 0) {thisDoc.educational_state_c.value="-"};
	if (thisDoc.educational_grade_c.value.length == 0) {thisDoc.educational_grade_c.value="-"};
	if (thisDoc.employment_name_b.value.length == 0) {thisDoc.employment_name_b.value="-"};
	if (thisDoc.employment_position_b.value.length == 0) {thisDoc.employment_position_b.value="-"};
	if (thisDoc.employment_from_b.value.length == 0) {thisDoc.employment_from_b.value="-"};
	if (thisDoc.employment_to_b.value.length == 0) {thisDoc.employment_to_b.value="-"};
	if (thisDoc.employment_reason_b.value.length == 0) {thisDoc.employment_reason_b.value="-"};
	if (thisDoc.employment_name_c.value.length == 0) {thisDoc.employment_name_c.value="-"};
	if (thisDoc.employment_position_c.value.length == 0) {thisDoc.employment_position_c.value="-"};
	if (thisDoc.employment_from_c.value.length == 0) {thisDoc.employment_from_c.value="-"};
	if (thisDoc.employment_to_c.value.length == 0) {thisDoc.employment_to_c.value="-"};
	if (thisDoc.employment_reason_c.value.length == 0) {thisDoc.employment_reason_c.value="-"};
	if (thisDoc.employment_name_d.value.length == 0) {thisDoc.employment_name_d.value="-"};
	if (thisDoc.employment_position_d.value.length == 0) {thisDoc.employment_position_d.value="-"};
	if (thisDoc.employment_from_d.value.length == 0) {thisDoc.employment_from_d.value="-"};
	if (thisDoc.employment_to_d.value.length == 0) {thisDoc.employment_to_d.value="-"};
	if (thisDoc.employment_reason_d.value.length == 0) {thisDoc.employment_reason_d.value="-"};
	if (thisDoc.employment_name.value.length == 0) {thisDoc.employment_name.value="-"};
	if (thisDoc.employment_position.value.length == 0) {thisDoc.employment_position.value="-"};
	if (thisDoc.employment_from.value.length == 0) {thisDoc.employment_from.value="-"};
	if (thisDoc.employment_to.value.length == 0) {thisDoc.employment_to.value="-"};
	if (thisDoc.employment_reason.value.length == 0) {thisDoc.employment_reason.value="-"};
	if (thisDoc.references_name_b.value.length == 0) {thisDoc.references_name_b.value="-"};
	if (thisDoc.references_occupation_b.value.length == 0) {thisDoc.references_occupation_b.value="-"};
	if (thisDoc.references_contact_b.value.length == 0) {thisDoc.references_contact_b.value="-"};
	if (thisDoc.references_years_b.value.length == 0) {thisDoc.references_years_b.value="-"};

	//set hidden field
	thisDoc.email_hidden.value=thisDoc.email.value;
	thisDoc.realname.value=thisDoc.full_name.value;
	thisDoc.recipients.value="yekwei.lee@fagor.com.my";
}