function checkService(formElement)
{
	with (document.frmApp) {
		for (i = 0; i < formElement.length; i++) {
			if(formElement[i].checked == true) {
				if(formElement[i].value == 'EPF') {
					if (!TextNoEmpty(epfNo, 'Please enter EPF number.')) 
						return false;
				}		
				if(formElement[i].value == 'Socso') {
					if (!TextNoEmpty(socsoNo, 'Please enter SOCSO number.')) 
						return false;
				
				}
				if(formElement[i].value == 'Tax') {
					if (!TextNoEmpty(irbNo, 'Please enter IRB number.')) 
						return false;
				
				}
			}	
		}
 	}
  	return true;  
}

function validation() {

	with (document.frmApp) {
		if (!TextNoEmpty(compName, 'Please enter Company Name.')) 
			return false;
		if (!TextNoEmpty(contName1, 'Please enter name of contact person.')) 
			return false;
		
		if (!TextNoEmpty(compTel_a, 'Please enter your company telephone no.')) 
			return false;
		if (!isNumeric(compTel_a, 'Telephone no. must be numeric.')) 
			return false;	
		if (!TextNoEmpty(compTel_b, 'Please enter your company telephone no.')) 
			return false;	
		if (!isNumeric(compTel_b, 'Telephone no. must be numeric.')) 
			return false;	
		
		if (!TextNoEmpty(contEmail1, 'Please enter e-mail address of company.')) 
			return false;
		else if (!isEmail(contEmail1, 'Invalid e-mail address.')) 
			return false;	
				
		if (!isMinimumCheck(hrServices, 1) && !isMinimumCheck(payServices, 1)) {
			if (!TextNoEmpty(otherService, 'Please select the additional service(s) you require.')) 
				return false; 			
		}
		
		if (!checkService(hrServices))
			return false;
				
		if (payroll[1].checked)
			if (!TextNoEmpty(otherPayroll, 'Please enter a payroll service.')) 
				return false;
	}	
	return true;
}	

function NSValidation() {
	if (validation() == true) {
		document.frmApp.submit();
	}	
	else {
		return false;
	}	
}