

function openWindow(myURL, myWidth, myHeight) {
	myLeft = (screen.width - myWidth) / 2;
	myTop = (screen.height - myHeight - 15) / 2;
	myFeatures = 'width=' + myWidth + ',height=' + myHeight + ',left=' + myLeft +',top='+ myTop +',directories=no,toolbar=no,location=no,status=no,menubar=yes,scrollbars=yes,resizable=no';
	var TheNewWindow = window.open(myURL,'_blank',myFeatures);
}

function checkform(formName) {
missinginfo = "";
lackingDetails = "";
if (!formName.certify.checked) {
	missinginfo += "\nYou must check the certification first.";
} 
if (missinginfo != "") {
	alert(missinginfo);
	return false;
}
else { 
	if(formName.custLName.value == ""){
		lackingDetails += "\n - Last Name";}
	if(formName.custName.value == ""){
		lackingDetails += "\n - First Name";}
	if(formName.custMName.value == ""){
		lackingDetails += "\n - Middle Name";}
	if(formName.age.value == "" || isNaN(formName.age.value)){
		lackingDetails += "\n - Age";}
	if(formName.sex.value == ""){
		lackingDetails += "\n - Sex";}	
	if(formName.permanentAdd.value == ""){
		lackingDetails += "\n - Permanent Address";}
	if(formName.custName.value == ""){
		lackingDetails += "\n - First Name";}
	if(formName.phoneNum.value == ""){
		lackingDetails += "\n - Phone Number";}
	if(formName.mobileNum.value == ""){
		lackingDetails += "\n - Mobile Number";}
	if(formName.emailAdd.value == ""){
		lackingDetails += "\n - Email Address";}
	if(formName.citizenship.value == ""){
		lackingDetails += "\n - Citizenship";}
	if(!formName.status[0].checked && !formName.status[1].checked && !formName.status[2].checked){
		lackingDetails += "\n - Status";
	}
	else{
		if(formName.status[2].checked && formName.status1.value == ""){
			lackingDetails += "\n - Status";}
	}
	if(formName.religion.value == ""){
		lackingDetails += "\n - Religion";}
	if(formName.secondary.value == "" && formName.secondary.value.toUpperCase() != "NA"){
		lackingDetails += "\n - Secondary School";}
	else{
		if(formName.secondary1.value == "" || formName.secondary2.value == ""){
			lackingDetails += "\n - Secondary School Years";}
		else{
			if(isNaN(formName.secondary1.value) || isNaN(formName.secondary2.value)){
				lackingDetails += "\n - Secondary School Years";}
		}
	}
	if(formName.tertiary.value == "" && formName.tertiary.value.toUpperCase() != "NA"){
		lackingDetails += "\n - Tertiary School";}
	else{
		if(formName.tertiary1.value == "" || formName.tertiary2.value == ""){
			lackingDetails += "\n - Tertiary School Years";}
		else{
			if(isNaN(formName.tertiary1.value) || isNaN(formName.tertiary2.value)){
				lackingDetails += "\n - Tertiary School Years";}
		}
	}
	if(formName.vocational.value != "" && formName.vocational.value.toUpperCase() != "NA"){
		if(formName.vocational1.value == "" || formName.vocational2.value == ""){
			lackingDetails += "\n - Vocational School Years";}
		else{
			if(isNaN(formName.vocational1.value) || isNaN(formName.vocational2.value)){
				lackingDetails += "\n - Vocational School Years";}
		}
	}
	if(formName.others.value != "" && formName.others.value.toUpperCase() != "NA"){
		if(formName.others1.value == "" || formName.others2.value == ""){
			lackingDetails += "\n - Other School Years";}
		else{
			if(isNaN(formName.others1.value) || isNaN(formName.others2.value)){
				lackingDetails += "\n - Other School Years";}
		}
	}
	if(formName.company.value == ""){
		lackingDetails += "\n - Company";}
	else
	{ 
		if(formName.company.value.toUpperCase() != "NA"){
			if(formName.department.value == "" && formName.department.value.toUpperCase() != "NA"){
				lackingDetails += "\n - Department";}
			if(formName.position.value == ""&& formName.position.value.toUpperCase() != "NA"){
				lackingDetails += "\n - Position";}
			if(formName.compPhone.value == ""&& formName.compPhone.value.toUpperCase() != "NA"){
				lackingDetails += "\n - Company Phone Number";}
			if(formName.years.value == "" || isNaN(formName.years.value)){
				lackingDetails += "\n - Years";}	
		}
	}
	if(lackingDetails == ""){
		return true;}
	else{
		lackingDetails = "Please fill in the following field/s:\n" + lackingDetails
		alert(lackingDetails);
		return false;}
	}
}

 
