function checkForm()
{
	var objForm = document.applicationForm;

	//check if products is selected
	$count=0;
	for (i=0; i<applicationForm.finet.length; i++)
	{	
		if (applicationForm.finet[i].checked)
		{
			$count++	
		}
	}
	if ($count==0)
	{
		alert('Please select service');
		applicationForm.finet[0].focus();
		return false;
		
	}
	//check if name is filled
	if (document.applicationForm.name.disabled==false)
	{
		if ( !ContainsSomething(objForm.name) )
		{
			alert('Please enter your Name');
			objForm.name.focus();
			return false;
		}

		if (!textChecking(document.applicationForm.name.value, "name", "English","NODIGIT"))
		{
			return false;	
		}
	}
	
	//check if gender is selected
	if (document.applicationForm.gender[0].disabled ==false || document.applicationForm.gender[1].disabled==false)
	{
		if ( !CheckSelection(objForm.gender) )
		{
			alert('Please select your Gender');
			objForm.gender[0].focus();
			return false;
		}
	}
	
//	if (document.applicationForm.day.disabled==false)
//	{
//		if(document.applicationForm.day.selectedIndex==0 || document.applicationForm.month.selectedIndex==0 || document.applicationForm.year.selectedIndex==0)
//		{
//			alert('Please select Date of Birth');
//			if (document.applicationForm.day.selectedIndex==0)
//			{
//				document.applicationForm.day.focus()	;
//				return false;
//
//			}
//			if (document.applicationForm.month.selectedIndex==0)
//			{
//				document.applicationForm.month.focus()
//				return false;	
//			}
		if(document.applicationForm.year.selectedIndex==0) {
			if (document.applicationForm.year.selectedIndex==0)
			{
				alert('Please select Year of Birth');
				document.applicationForm.year.focus()
				return false;
			} 
		}
//		}	
//	}
	
	if (document.applicationForm.telephone.disabled==false)
	{
   		if (CheckLength3(objForm.telephone, 8) || CheckLength3(objForm.telephone, 13))
		{
   			if (!checkTel(document.applicationForm.telephone.value,"English","telephone"))
   			{
   				return false;	
   			}
   		}
   	}
	
/*	if (CheckLength3(objForm.telephone21, 8))
	{
	   if (!checkTel(document.applicationForm.telephone21.value,"English","telephone21"))
	   {
		   return false;	
		}
	}*/
	
	//check if telephone contains only numbers
	if (document.applicationForm.telephone.disabled==false)
	{
		if ( !IsNum(objForm.telephone) )
		{
			alert('Mobile phone number should contain only numbers');
			objForm.telephone.focus();
			return false;
		}
	}
	if (document.applicationForm.telephone.disabled==false)
	{
		if (document.applicationForm.telephone.value.length!=8 && document.applicationForm.telephone.value.length!=13)
		{
			alert("Please enter HK(8 digits) or China(13 digits) mobile phone number");
			document.applicationForm.telephone.focus()
			return false;	
		}
   		if (!checkTel(document.applicationForm.telephone.value,"English","telephone"))
   		{
	   		return false;	
		}
	}
	
	if ( !CheckLength3(objForm.telephone, 8) && !CheckLength3(objForm.telephone, 13))
	{
		alert('Please enter HK(8 digits) or China(13 digits) mobile phone number');
		objForm.telephone.focus();
		return false;
	}
	
	if (document.applicationForm.email.disabled==false)
	{
		if (trim(document.applicationForm.email.value)=="")
		{
			alert("Please enter your Email Address");
			document.applicationForm.email.focus();
			return false;
		}
	
		//check if the email is valid
		if ( !IsValidEmail(objForm.email) )
		{
			alert('Please enter your valid Email Address');
			objForm.email.focus();
			return false;
		}
	}

	//check if the address is filled (Only if FME Series product is chosen)
	if (document.applicationForm.finet[2].checked || document.applicationForm.finet[3].checked ||
		document.applicationForm.finet[4].checked || document.applicationForm.finet[5].checked ||
		document.applicationForm.finet[6].checked || document.applicationForm.finet[7].checked) {
		if (document.applicationForm.address.disabled==false)
		{
			if ( !ContainsSomething(objForm.address) )
			{
				alert('Please enter your Address');
				objForm.address.focus();
				return false;
			}
		}
	}

	if (document.applicationForm.username.disabled==false)
	{
		if (trim(document.applicationForm.username.value)=="")
		{
			alert('Please enter your Username');
			objForm.username.focus();
			return false;
		}	
	
		if (!checkUsername(document.applicationForm.username.value,"username","English"))
		{
			return false;
		}
	}

/*	if (document.applicationForm.username.value != document.applicationForm.username.value.toLowerCase())
	{
		alert("Username should have 4 - 16 letters or numbers.")
		document.applicationForm.username.focus();
		return false;
	} */
		
	//check if the username contains special chars
	if (document.applicationForm.username.disabled==false)
	{
		if( CheckSpecialChar(objForm.username) )
		{
			alert('Please use 4-16 letters or numbers, no space and underline in your Username');
			objForm.username.focus();
			return false;
		}
		if( !CheckLength2(objForm.username, 4, 16) )
		{
			alert('Please use 4-16 letters or numbers, no space and underline in your Username');
			objForm.username.focus();
			return false;
		}	
	}
	if (document.applicationForm.password.disabled==false)
	{
		if (trim(document.applicationForm.password.value)=="")
		{
			alert('Please enter Password');
			objForm.password.focus();
			return false;
		}	

		if (document.applicationForm.password.value!=document.applicationForm.password2.value)
		{	
			alert("Please retype password again");
			document.applicationForm.password2.focus()
			return false;
		}

		//check if the password contains special chars
		if( CheckSpecialChar(objForm.password) )
		{
			alert('Please use 4-16 letters or numbers, no space and underline in Password.');
			objForm.password.focus();
			return false;
		}
		if( !CheckLength2(objForm.password, 4, 16) )
		{
			alert('Please use 4-16 letters or numbers, no space and underline in Password.');
			objForm.password.focus();
			return false;
		}
	}
	//check if the language is selected
	if ( !CheckSelection(objForm.language) )
	{
		alert('Please selct Language');
		objForm.language[0].focus();
		return false;
	}
	
	
	if (!document.applicationForm.finet[1].checked) { 
		if (eval(document.applicationForm.total_amount.value)>0)	    
		{
			if (document.applicationForm.cardholder.disabled==false)
			{
				if (trim(document.applicationForm.cardholder.value)=="")
				{
					alert('Please enter Cardholder\'s name');
					objForm.cardholder.focus();
					return false;				
				}
				if ((trim(document.applicationForm.cardno1.value)=="") ||(trim(document.applicationForm.cardno2.value)=="")||(trim(document.applicationForm.cardno3.value)=="")||(trim(document.applicationForm.cardno4.value)==""))
				{
					alert('Please enter Card Number');
					document.applicationForm.cardno1.focus();
					return false;				
				}

				if (!CheckLength3(document.applicationForm.cardno1, 4)) {
					alert('Please enter Card Number(16 digits)');
					document.applicationForm.cardno1.focus();
					return false;
				}

				if (!CheckLength3(document.applicationForm.cardno2, 4)) {
					alert('Please enter Card Number(16 digits)');
					document.applicationForm.cardno2.focus();
					return false;
				}

				if (!CheckLength3(document.applicationForm.cardno3, 4)) {
					alert('Please enter Card Number(16 digits)');
					document.applicationForm.cardno3.focus();
					return false;
				}

				if (!CheckLength3(document.applicationForm.cardno4, 4)) {
					alert('Please enter Card Number(16 digits)');
					document.applicationForm.cardno4.focus();
					return false;
				}	

				tempNo = document.applicationForm.cardno1.value
				if (tempNo.search(/[^0-9]/)>-1)
				{
					alert("Card Number accepts numbers only");
					document.applicationForm.cardno1.focus()
					return false;
				}

				tempNo = document.applicationForm.cardno2.value
				if (tempNo.search(/[^0-9]/)>-1)
				{
					alert("Card Number accepts numbers only.");
					document.applicationForm.cardno2.focus()
					return false;
				}

				tempNo = document.applicationForm.cardno3.value
				if (tempNo.search(/[^0-9]/)>-1)
				{
					alert("Card Number accepts numbers only.");
					document.applicationForm.cardno3.focus()
					return false;
				}

				tempNo = document.applicationForm.cardno4.value
				if (tempNo.search(/[^0-9]/)>-1)
				{
					alert("Card Number accepts numbers only.");
					document.applicationForm.cardno4.focus()
					return false;
				}

				if (document.applicationForm.expm.selectedIndex==0 ||document.applicationForm.expy.selectedIndex==0)
				{
					alert('Please select the expiry date of your credit card');
					document.applicationForm.expm.focus();
					return false;
				}
				tempDateObject = new Date();
				if (document.applicationForm.expm.options[document.applicationForm.expm.selectedIndex].value <= tempDateObject.getMonth() && document.applicationForm.expy.selectedIndex==1)
				{
					alert("Sorry, your card is expired. Please use your another valid credit card.");
					document.applicationForm.expm.focus();
					return false;
				}	
			}		

		}
	}
//	// check if education is selected
//	if (document.applicationForm.education.disabled==false)
//	{
//		if (objForm.education.selectedIndex==0)
//		{
//			alert('Please select Education');
//			objForm.education.focus();
//			return false;
//		}
//	}

//	// check if industry is selected
//	if (document.applicationForm.industry.disabled==false)	
//	{
//		if (objForm.industry.selectedIndex==0)
//		{
//			alert('Please select Industry');
//			objForm.industry.focus();
//			return false;
//		}
//	}

//	// check if position is selected
//	if (document.applicationForm.position.disabled==false)
//	{
//		if (objForm.position.selectedIndex==0)
//		{
//			alert('Please select Occupation');
//			objForm.position.focus();
//			return false;
//		}
//	}

//	// check if salary is selected
//	if (document.applicationForm.salary.disabled==false)
//	{
//		if (objForm.salary.selectedIndex==0)
//		{
//			alert('Please select Salary');
//			objForm.salary.focus();
//			return false;
//		}
//	}
	
	if (document.applicationForm.disclaimer1.disabled==false)
	{
		if ( ! IsChecked(objForm.disclaimer1) )
		{
			alert('please check our disclaimer');
			objForm.disclaimer1.focus();
			return false;
		}
	}
if (eval(document.applicationForm.total_amount.value)>0){//updated by joe 20100329
	if (document.applicationForm.disclaimer2.disabled==false)
	{
		if ( ! IsChecked(objForm.disclaimer2) )
		{
			alert('please check our disclaimer');
			objForm.disclaimer2.focus();
			return false;
		}
	}
	
	if (document.applicationForm.disclaimer3.disabled==false)
	{
		if ( ! IsChecked(objForm.disclaimer3) )
		{
			alert('please check our disclaimer');
			objForm.disclaimer3.focus();
			return false;
		}
	}
	if (document.applicationForm.disclaimer4.disabled==false)
	{
		if ( ! IsChecked(objForm.disclaimer4) )
		{
			alert('please check our disclaimer');
			objForm.disclaimer4.focus();
			return false;
		}
	}
}//updated by joe 20100329
}
