function CheckDcValue()
{
	var bflag = false;
	
	with (document.frmCPIB)
	{
		if(_ctl2__ctl0_txtLName.value== "")
		{
			alert("Please enter your name");
			bflag = false;
		}
		else
			bflag =true;
		//if(bflag)
		//{
		//	if(_ctl2__ctl0_cboIDType.selectedIndex == 0)
		//	{
		//		alert("Please select ID Type");
		//		bflag = false;
		//	}
		//	else
		//		bflag =true;
		//}
		if(bflag)
		{
			if(_ctl2__ctl0_txtLNRIC.value == "" )
			{
				alert("Please enter your NRIC");
				bflag = false;
			}
			else
			{
				if(check_nric(_ctl2__ctl0_txtLNRIC))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtLDD.value != "" )
			{
				if(CheckDate(_ctl2__ctl0_txtLDD,"Lawyer's DOB","DD"))
				{
					if(CheckDate(_ctl2__ctl0_txtLMM,"Lawyer's DOB","MM"))
					{
						if(CheckDate(_ctl2__ctl0_txtLYY,"Lawyer's DOB","YY"))
						{
							bflag = true;
						}
						else
							bflag =false;
					}
					else
						bflag =false;
				}
				else
					bflag =false;
			}
		}			
		if(bflag)
		{
			if(_ctl2__ctl0_txtOffNo.value == "")
			{
				alert("Please enter your Office No");
				bflag = false;
			}
			else
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtOffNo,"Office No",1))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtFaxNo.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtFaxNo,"Fax No",1))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtMobNo.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtMobNo,"Mobile No",1))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtEmail.value != "")
			{
				if(IsEmailValid(_ctl2__ctl0_txtEmail.value))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtBlock.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtBlock,"Block No",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtFloor.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtFloor,"Unit No",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtUnit.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtUnit,"Unit No",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtZipCode.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtZipCode,"Postal Code",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtCName.value== "")
			{
				alert("Please enter Client Name");
				bflag = false;
			}
			else
				bflag =true;
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtIPNo.value== "")
			{
				alert("Please enter CPIB IP No");
				bflag = false;
			}
			else
				bflag =true;
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtCNRIC.value == "" )
			{
				alert("Please enter Client's NRIC/FIN/Passport");
				bflag = false;
			}
			else
			{
				if(_ctl2__ctl0_cboNRICType.selectedIndex == 0 || _ctl2__ctl0_cboNRICType.selectedIndex == 1)
				{
					if(check_nric(_ctl2__ctl0_txtCNRIC))
					{
						bflag = true;
					}
					else
						bflag =false;
				}
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtLNRIC.value != "" && _ctl2__ctl0_txtCNRIC.value == _ctl2__ctl0_txtLNRIC.value )
			{
				alert("Applicant's NRIC and Client's NRIC can not be same");
				bflag = false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtCDD.value != "" )
			{
				if(CheckDate(_ctl2__ctl0_txtCDD,"Client's DOB","DD"))
				{
					if(CheckDate(_ctl2__ctl0_txtCMM,"Client's DOB","MM"))
					{
						if(CheckDate(_ctl2__ctl0_txtCYY,"Client's DOB","YY"))
						{
							bflag = true;
						}
						else
							bflag =false;
					}
					else
						bflag =false;
				}
				else
					bflag =false;
			}
		}		
		if(bflag)
		{
			if(_ctl2__ctl0_txtContactNo.value == "")
			{
				alert("Please enter Client's Contact No");
				bflag = false;
			}
			else
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtContactNo,"Client's Contact No",1))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtDACCharge1.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtDACCharge1,"No of Charges(DAC)",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtMACCharge1.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtMACCharge1,"No of Charges(MAC)",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtPSCharge1.value != "")
			{
				if(CheckPhoneNumber(_ctl2__ctl0_txtPSCharge1,"No of Charges(PS)",2))
				{
					bflag = true;
				}
				else
					bflag =false;
			}
		}
		if(bflag)
		{
			if(_ctl2__ctl0_txtTotalCharges.value == "" || _ctl2__ctl0_txtTotalCharges.value == "0" )
			{
				alert("Please enter No of charges");
				bflag = false;
			}
			else
				bflag = true;
		}
		if(bflag)
			_ctl2__ctl0_hdnVal.value = 1;
		else
			_ctl2__ctl0_hdnVal.value = 0;
	}
	return bflag;
}

function Calculate()
{
	var intDACCharge,intMACCharge,intPSCharge;
	intDACCharge = 0;
	intMACCharge = 0;
	intPSCharge	= 0;
	
	with (document.frmCPIB)
	{
		if(_ctl2__ctl0_txtDACCharge1.value != "" )
		{
			intDACCharge = 	eval(_ctl2__ctl0_txtDACCharge1.value);
		}
		if(_ctl2__ctl0_txtMACCharge1.value != "" )
		{
			intMACCharge = 	eval(_ctl2__ctl0_txtMACCharge1.value);
		}
		if(_ctl2__ctl0_txtPSCharge1.value != "" )
		{
			intPSCharge = 	eval(_ctl2__ctl0_txtPSCharge1.value);
		}

		_ctl2__ctl0_txtTotalCharges.value	= intDACCharge + intMACCharge + intPSCharge ;
		//_ctl2__ctl0_txtCharge.value = _ctl2__ctl0_txtTotalCharges.value;
		_ctl2__ctl0_txtDocFee.value = "S$" + (eval(_ctl2__ctl0_txtTotalCharges.value ) * 16);
		_ctl2__ctl0_txtTotalFees.value ="S$" + (eval(_ctl2__ctl0_txtTotalCharges.value )*16 + 14);
	}
}

