function validation()
{
var my_month=new Date()
	//******************************************************************************
	//validation for loan_type
	if(document.frm.Loan_Type.selectedIndex==0)
	{
		alert("Please select Type of Application");
		
		document.frm.Loan_Type.focus();
		return false;		
	}
	//end of valiation
	//******************************************************************************
	//validation for Loan Amount(check first 0)
	if(document.frm.Loan_Type.selectedIndex!=5)
	{
	if(!((document.frm.Loan_amt.value >0)&&(document.frm.Loan_amt.value<=100000)))
	{
		alert("Loan amount field should be between 1 and 100000");
		document.frm.Loan_amt.focus();
		return false;
	}
	if(document.frm.Loan_amt.value == "")
	{
		alert("Loan amount field cannot be blank");
		document.frm.Loan_amt.focus();
		return false;
	}
	if(document.frm.Loan_amt.value.indexOf("0") == 0)
	{
		alert("Amount cannot be zero");
		document.frm.Loan_amt.focus();
		return false;
	}
	//Validation for Loan Amount
	var chk = IsNumeric(document.frm.Loan_amt.value)
	if(chk == false)
	{
		alert("Please enter the loan amount as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
		document.frm.Loan_amt.focus();
		return false;
	}
	//end validation loan Amt
	//*********************************************************************************
	if(document.frm.Loan_term.selectedIndex==0)
	{
		alert("Please select the loan term");
		document.frm.Loan_term.focus();
		return false;
	}

	//validation for loan_Purpose
	if(document.frm.loan_Purpose.selectedIndex==0)
	{
		alert("Please select the purpose of loan");
		
		document.frm.loan_Purpose.focus();
		return false;
	}
	}
	//end of validation
	//*******************************************************************************
	
	//validation for app_type
	
	//end of valiation
	
	//Validation For First Name(Check for Blank Name)
	if(document.frm.First_name.value=="")
	{
		alert("Please enter the first name");
		
		document.frm.First_name.focus();
		return false;
	}
	//(Check for Blank Space)
	if(document.frm.First_name.value.indexOf(" ")==0)
	{
		alert("There should not be any space before the name")
		
		document.frm.First_name.focus();
		return false;
	}
	//(Check for Charectors only Name)
	var chk = Ischar(document.frm.First_name.value)
	if(chk == false)
	{
		alert("Please use characters only");
		document.frm.First_name.focus();
		return false;
	}
	//end of validation
	//****************************************************************************

	//Validation for Last Name(Check for Blank Name)
	if(document.frm.Last_name.value=="")
	{
		alert("Please enter the last name");
		
		document.frm.Last_name.focus();
		return false;
	}
	//(Check for Blank Space)
	if(document.frm.Last_name.value.indexOf(" ")==0)
	{
		alert("There should not be any space before the name")
		
		document.frm.Last_name.focus();
		return false;
	}
	//(Check for Charectors only)
	var chk = Ischar(document.frm.Last_name.value)
	if(chk == false)
	{
		alert("Please use characters only");
		
		document.frm.Last_name.focus();
		return false;
	}
	//end validation
//***************************************************************************************************************************************************
	//Date of birth
	var chk = IsNumeric(document.frm.DOBDD.value)
	if(chk == false)
	{
		alert("Please enter the Date of Birth, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
		document.frm.DOBDD.focus();
		return false;
	}
	if((document.frm.DOBDD.value >31) || ((document.frm.DOBDD.value ==0)))
	{
		alert("Invalid Date of Birth");
		document.frm.DOBDD.focus();
		return false;
	}
	
	
	var chk = IsNumeric(document.frm.DOBMM.value)
	if(chk == false)
	{
		alert("Please enter the Date of Birth, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
		document.frm.DOBMM.focus();
		return false;
	}
	if((document.frm.DOBMM.value >12) || ((document.frm.DOBMM.value ==0)))
	{
		alert("Invalid Date of Birth");
		document.frm.DOBMM.focus();
		return false;
	}
	
	var chk = IsNumeric(document.frm.DOBYYYY.value)
	if(chk == false)
	{
		alert("Please enter the Date of Birth, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
		document.frm.DOBYYYY.focus();
		return false;
	}
	if((document.frm.DOBYYYY.value <1910) || (document.frm.DOBYYYY.value >1991)) 
	{
		alert("Invalid Date of Birth Year(eg.. 1920)");
		document.frm.DOBYYYY.focus();
		return false;
	}
	
	
	
	if((document.frm.DOBDD.value !="") && (document.frm.DOBMM.value !="") && (document.frm.DOBYYYY.value !="")) 
	{
		var chk = isDate(document.frm.DOBMM.value+"/"+document.frm.DOBDD.value+"/"+document.frm.DOBYYYY.value)
		if(chk == false)
		{
			alert("Invalid Date of Birth.");
			document.frm.DOBDD.focus();
			return false;
		}
	}
	//end validation Dob
	//****************************************************************************
	//Validation of Marital Status
	if(document.frm.MaritalStatus.selectedIndex==0)
	{
		alert("Please select the Marital Status");
		
		document.frm.MaritalStatus.focus();
		return false;
	}
	//End of validation Status
	//Validation for Valid (Check for blank email)
	if(document.frm.email.value=="")
	{
		alert("Please enter the Email");
		
		document.frm.email.focus();
		return false;
	}
	if(!(document.frm.email.value == ""))
    {//(check for '@' symbol)
		if(document.frm.email.value.indexOf("@") == -1)
    	{
     		alert("Please enter valid email");
			
      		document.frm.email.focus();
      		return false;
   		}
    	//(check '.' symbol)
    	if(document.frm.email.value.indexOf(".") == -1)
    	{
			alert("Please enter valid email");
			
			document.frm.email.focus();
			return false;
   		 }
	}
	//end of validation
	//validation of credit grade
	if(document.frm.creditGrade.selectedIndex==0)
	{
		alert("Please select the Credit Grade");
		
		document.frm.creditGrade.focus();
		return false;		
	}
	//end of validata
	//validation for (door/house no/name)
	if(document.frm.house_No.value=="")
	{
		alert("Please enter the house no.");
		
		document.frm.house_No.focus();
		return false;
	}
	//(check for blank space)
	if(document.frm.house_No.value.indexOf(" ") == 0)
	{
		alert("There should not be any space before the house no.");

		
		document.frm.house_No.focus();
		return false;
	}
	//(check for first zero in house no.)
	if(document.frm.house_No.value.indexOf("0") == 0)
	{
		alert("Please enter the proper house no.");
		
		document.frm.house_No.focus();
		return false;
	}
	//end of validation
	//****************************************************************************
	
	//validation for address1
	if(document.frm.address1.value=="")
	{
		alert("Please enter the Street");
		
	    document.frm.address1.focus();
	    return false;
	}	
	//end of validation	
	//***************************************************************************
	if(document.frm.address2.value == "")
	{
		alert("Please enter the Town");
		
		document.frm.address2.focus();
		return false;
	}
	if(document.frm.Country.selectedIndex==0)
	{
		alert("Please select the County");
		
		document.frm.Country.focus();
		return false;		
	}
	//Validation for PostCode
	if(document.frm.postcode.value == "")
	{
		alert("Please enter the postcode");
		
		document.frm.postcode.focus();
		return false;
	}
	
	var chk = postit(document.frm.postcode.value)
	if(chk == false)
	{
		alert("Please enter valid postcode");
		document.frm.postcode.focus();
		return false;
	}
	//end of validation
	//Residential Status Validation
		if(document.frm.r_status.selectedIndex==0)
		{
			alert("Please select Residential status.");
			document.frm.r_status.focus();
			return false;
		}
		if((document.frm.Loan_Type.selectedIndex==1)||(document.frm.Loan_Type.selectedIndex==2))
		{
			//Residential Status Validation
			if(document.frm.r_status.selectedIndex!=1)
			{
				alert("Please select the residential status as Homeowner");
				document.frm.r_status.focus();
				return false;
			}
		}
		if(document.frm.Loan_Type.selectedIndex==3)
		{
			if(document.frm.r_status.selectedIndex==1)
			{
				alert("Residential status cannot be Homeowner");
				document.frm.r_status.focus();
				return false;s
			}
		}
	//End Residential Status Validation
		//Time at address
		if(document.frm.addtimeyear.selectedIndex==0)
	{
			alert("Please Select Address Year");
			document.frm.addtimeyear.focus();
			return false;s
	}
	if(document.frm.addtimemonth.selectedIndex==0)
	{
		alert("Please Select Address month");
		document.frm.addtimemonth.focus();
		return false;
	}
	if((document.frm.addtimeyear.value ==2010) && (document.frm.addtimemonth.value>my_month.getMonth()))
	{
		alert("Choosan Date Can't be Greater than Current Date");
		document.frm.addtimemonth.focus();
		return false;
	}
		
		
	//var chk = IsNumeric(document.frm.addtimeyear.value)
//	if(chk == false)
//	{
//		alert("Please enter the Time at address year, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
//		document.frm.addtimeyear.focus();
//		return false;
//	}
//	if((document.frm.addtimeyear.value <1900) || (document.frm.addtimeyear.value >2009))
//	{
//		alert("Invalid Time at address year(eg...1975)");
//		document.frm.addtimeyear.focus();
//		return false;
//	}
//	var chk = IsNumeric(document.frm.addtimemonth.value)
//	if(chk == false)
//	{
//		alert("Please enter the Time at address month, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
//		document.frm.addtimemonth.focus();
//		return false;
//	}
//	if(document.frm.addtimemonth.value >11) 
//	{
//		alert("Invalid time at address month ");
//		document.frm.addtimemonth.focus();
//		return false;
//	}
	/*if(document.frm.addtimeyear.selectedIndex==0)
	{
		alert("Please select the Time at address year");
		
		document.frm.addtimeyear.focus();
		return false;		
	}
	if(document.frm.addtimemonth.selectedIndex==0)
	{
		alert("Please select the Time at address month");
		
		document.frm.addtimemonth.focus();
		return false;		
	}*/
	//End vallidation of time at address
	//Validation for Home Telephone & Mobile Phone
	if((document.frm.mobile.value=="")&&(document.frm.H_telephone.value==""))
	{
		alert("Please enter at least one contact no");
		document.frm.mobile.focus();
		return false;
	}
	//validation for mobile Number
	if((!document.frm.mobile.value==""))
	{
		if ((!(document.frm.mobile.value.length==10)) && (!(document.frm.mobile.value.length==11))) 
    	{
    		alert("Please enter the valid mobile no.");
			document.frm.mobile.focus();
	  		return false;
    	} 
	
		//(check for Numeric value only)
		var chk = IsNumeric(document.frm.mobile.value)
		if(chk == false)
		{
			alert("Please enter valid mobile no.");
			document.frm.mobile.focus();
			return false;
		} 
		if(((!(document.frm.mobile.value.indexOf("0")==0 )) || (!(document.frm.mobile.value.indexOf("7")==1)))&&(!(document.frm.mobile.value.indexOf("7")==0)))
    	{
	   		alert("Please enter valid mobile no.");
			document.frm.mobile.focus();
	   		return false;
    	}	
		if((document.frm.mobile.value.indexOf("0")==0 ) && (document.frm.mobile.value.length<11))
    		{
	   			alert("Please enter valid mobile no.");
				document.frm.mobile.focus();
	   			return false;
    		}
			if(!(document.frm.mobile.value.indexOf("0")==0 ) && (document.frm.mobile.value.length==11))
    		{
	   			alert("Please enter valid mobile no.");
				document.frm.mobile.focus();
	   			return false;
    		}
			if((document.frm.mobile.value.indexOf("00")==0))
    		{
	   			alert("Please enter valid mobile no.");
				document.frm.mobile.focus();
	   			return false;
    		}
	}
	
	//End of Validation
	if(!(document.frm.H_telephone.value==""))
	{
		//Validation for Home Telephone
		if(document.frm.H_telephone.value=="")
		{
			alert("Please enter the home telephone no.")
			document.frm.H_telephone.focus();
			return false;
		}
			//(check for valid telephone no.)
		if ((!(document.frm.H_telephone.value.length==10)) && (!(document.frm.H_telephone.value.length==11))) 
    	{
    		alert("Length of home telephone no. should  be upto 10-11 digit");
			document.frm.H_telephone.focus();
			return false;
    	} 
		//(check for Numeric value only)
		var chk = IsNumeric(document.frm.H_telephone.value)
		if(chk == false)
		{
			alert("Home telephone no. should be in numeric");
			document.frm.H_telephone.focus();
			return false;
		} 
		if((document.frm.H_telephone.value.indexOf("0")==0 ) && (document.frm.H_telephone.value.indexOf("7")==1))
    	{
	   		alert("Please enter valid home telephone no.");
			document.frm.H_telephone.focus();
	   		return false;
    	}
		if((document.frm.H_telephone.value.indexOf("0")==0 ) && (document.frm.H_telephone.value.length<11))
    		{
	   			alert("Please enter valid home telephone no.");
				document.frm.H_telephone.focus();
	   			return false;
    		}
			if(!(document.frm.H_telephone.value.indexOf("0")==0 ) && (document.frm.H_telephone.value.length==11))
    		{
	   			alert("Please enter valid home telephone no.");
				document.frm.H_telephone.focus();
	   			return false;
    		}
			if((document.frm.H_telephone.value.indexOf("00")==0))
    		{
	   			alert("Please enter valid home telephone no.");
				document.frm.H_telephone.focus();
	   			return false;
    		}
			if((document.frm.H_telephone.value.indexOf("9")==0) || (document.frm.H_telephone.value.indexOf("9")==1))
    		{
	   			alert("Please enter valid home telephone no.");
				document.frm.H_telephone.focus();
	   			return false;
    		}
			//end of validation
	}
	//**************************************************************************
	
					

	//Validataion Best contact time
	if(document.frm.CallBackTime.selectedIndex==0)
	{
		alert("Please select the best contact time");
		
		document.frm.CallBackTime.focus();
		return false;		
	}
	//End validation Best contact time
	//Validation of Employment Details
	if(document.frm.OCC_STAT.selectedIndex==0)
	{
		alert("Please select the Employment Status");
		
		document.frm.OCC_STAT.focus();
		return false;		
	}
	//End Validation of Employment Stataus
	
	//Validatation of monthly income
	if(document.frm.m_income.value=="")
	{
		alert("Please Enter Monthly Income");
		document.frm.m_income.focus();
		return false;		
	}
	if(document.frm.m_income.value!="")
		{
			if(document.frm.m_income.value.indexOf("0") == 0)
			{
				alert("Monthly Income cannot be zero");
				document.frm.m_income.focus();
				return false;
			}
			var chk = IsNumeric(document.frm.m_income.value)
			if(chk == false)
			{
				alert("Please enter the Monthly Income as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
				document.frm.m_income.focus();
				return false;
			}
		}
	//End Validation of monthly income
	
	//Validation of Employment Details
	if((document.frm.Loan_Type.selectedIndex==1) || (document.frm.Loan_Type.selectedIndex==2) || (document.frm.Loan_Type.selectedIndex==3))
	{
	if(document.frm.occtype.value=="")
	{
		alert("Please enter Type of Occupation");
		document.frm.occtype.focus();
		return false;
	}
	if(document.frm.empname.value=="")
	{
		alert("Please enter Employeer Name.");
		document.frm.empname.focus();
		return false;
	}
//***************************************************************************************************************************************************	
//***************************************************************************************************************************************************	
if(document.frm.occtimeyear.selectedIndex==0)
	{
		alert("Please Select Job Year");
		document.frm.addtimemonth.focus();
		return false;
	}
	if(document.frm.occtimemonth.selectedIndex==0)
	{
		alert("Please Select Job month");
		document.frm.addtimemonth.focus();
		return false;
	}
	if((document.frm.occtimeyear.value ==2010) && (document.frm.occtimemonth.value>=my_month.getMonth()))
	{
		alert("Choosan Date Can't be Greater than Current Date");
		document.frm.occtimemonth.focus();
		return false;
	}


//	var chk = IsNumeric(document.frm.occtimeyear.value)
//	if(chk == false)
//	{
//		alert("Please enter the Time with current job year, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
//		document.frm.occtimeyear.focus();
//		return false;
//	}
//	if((document.frm.occtimeyear.value <1950) || (document.frm.occtimeyear.value >2009))
//	{
//		alert("Invalid Time with current job year eg ...1975");
//		document.frm.occtimeyear.focus();
//		return false;
//	}
//	var chk = IsNumeric(document.frm.occtimemonth.value)
//	if(chk == false)
//	{
//		alert("Please enter the Time with current job month, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
//		document.frm.occtimemonth.focus();
//		return false;
//	}
//	if(document.frm.occtimemonth.value >11) 
//	{
//		alert("Invalid time with current job month");
//		document.frm.occtimemonth.focus();
//		return false;
//	}

    /*if(document.frm.occtimeyear.selectedIndex==0)
	{
		alert("Please select the Time with Current Job year.");
		
		document.frm.occtimeyear.focus();
		return false;		
	}
	if(document.frm.occtimemonth.selectedIndex==0)
	{
		alert("Please select the Time with Current Job month.");
		
		document.frm.occtimemonth.focus();
		return false;		
	}*/
//***************************************************************************************************************************************************	
//***************************************************************************************************************************************************	
	if(document.frm.emphouseno.value=="")
	{
		alert("Please enter Employeer house no.");
		document.frm.emphouseno.focus();
		return false;
	}
	//if(document.frm.empstreet.value=="")
//	{
//		alert("Please enter Employeer street.");
//		document.frm.empstreet.focus();
//		return false;
//	}
//	if(document.frm.emptown.value=="")
//	{
//		alert("Please enter Employeer town.");
//		document.frm.emptown.focus();
//		return false;
//	}
//	if(document.frm.empcounty.selectedIndex==0)
//	{
//		alert("Please select the employeer county.");
//		
//		document.frm.empcounty.focus();
//		return false;		
//	}
	if(document.frm.emppostcode.value == "")
	{
		alert("Please enter the employer postcode");
		
		document.frm.emppostcode.focus();
		return false;
	}
	
	var chk = postit(document.frm.emppostcode.value)
	if(chk == false)
	{
		alert("Please enter valid employer postcode");
		document.frm.emppostcode.focus();
		return false;
	}
	}
	//End Validation of Employment Details
	//***************************************************************************
	













	//**************************************************************************
	if((document.frm.Loan_Type.selectedIndex!=4)&&(document.frm.Loan_Type.selectedIndex!=5))
	{
		if((document.frm.bankname.value==""))
		{
			alert("Please enter the Bank name");
			document.frm.bankname.focus();
			return false;
		}
		if(document.frm.bankyear.selectedIndex==0)
	{
		alert("Please Select Bank Year");
		document.frm.bankyear.focus();
		return false;
	}
	if(document.frm.bankmonth.selectedIndex==0)
	{
		alert("Please Select Bank month");
		document.frm.bankmonth.focus();
		return false;
	}
	if((document.frm.bankyear.value ==2010) && (document.frm.bankmonth.value>=my_month.getMonth()))
	{
		alert("Choosan Date Can't be Greater than Current Date");
		document.frm.bankmonth.focus();
		return false;
	}
		
		//var chk = IsNumeric(document.frm.bankyear.value)
//		if(chk == false)
//		{
//			alert("Please enter the Time with bank year, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
//			document.frm.bankyear.focus();
//			return false;
//		}
//		if((document.frm.bankyear.value <1900) || (document.frm.bankyear.value >2009))
//		{
//			alert("Invalid Time with bank year");
//			document.frm.bankyear.focus();
//			return false;
//		}
//		var chk = IsNumeric(document.frm.bankmonth.value)
//		if(chk == false)
//		{
//			alert("Please enter the Time with bank month, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
//			document.frm.bankmonth.focus();
//			return false;
//		}
//		if(document.frm.bankmonth.value >11) 
//		{
//			alert("Invalid time with bank month");
//			document.frm.bankmonth.focus();
//			return false;
//		}
		/*if(document.frm.bankyear.selectedIndex==0)
		{	
			alert("Please select the time with bank year.");
			document.frm.bankyear.focus();
			return false;		
		}
		if(document.frm.bankmonth.selectedIndex==0)
		{
			alert("Please select the time with bank month");
			document.frm.bankmonth.focus();
			return false;		
		}*/
	}
	
	if (document.frm.email.value == "")
	{
		if (confirm("Email-id field is blank,Do you wish to proceed anyway?"))
		{
		return true;
		}
		else
		{
		document.frm.email.focus();
		return false;
		}
	}
	//end of validation
	
	//*************************************************************************
	if(document.frm.Loan_Type.selectedIndex==1)
	{
				//Mortgage Outstanding Validation
		if(document.frm.m_out1.value == "")
		{
			alert("Mortgage Outstanding field cannot be blank");
			document.frm.m_out1.focus();
			return false;
		}
		if(document.frm.m_out1.value.indexOf("0") == 0)
		{
			alert("Mortgage Outstanding cannot be zero");
			document.frm.m_out1.focus();
			return false;
		}
		var chk = IsNumeric(document.frm.m_out1.value)
		if(chk == false)
		{
			alert("Please enter the Mortgage Outstanding as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
			document.frm.m_out1.focus();
			return false;
		}
		//End of Validation
		//purchase price validation
		if(document.frm.p_price1.value == "")
		{
			alert("Purchase Price field cannot be blank");
			document.frm.p_price1.focus();
			return false;
		}
		if(document.frm.p_price1.value!="")
		{
			if(document.frm.p_price1.value.indexOf("0") == 0)
			{
				alert("Purchase price cannot be zero");
				document.frm.p_price1.focus();
				return false;
			}
			var chk = IsNumeric(document.frm.p_price1.value)
			if(chk == false)
			{
				alert("Please enter the Purchase Price as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
				document.frm.p_price1.focus();
				return false;
			}
		}
		//End purchase price validation
		//Purchase Year
		if(document.frm.p_year1.selectedIndex==0)
		{
			alert('Please Select the Property purchase year field');
			document.frm.p_year1.focus();
			return false;
		}
		//End Purchase Year
		//Current property value validation
		if(document.frm.cpv1.value == "")
		{
			alert("Current property value cannot be blank");
			document.frm.cpv1.focus();
			return false;
		}
		if(document.frm.cpv1.value!="")
		{
			if(document.frm.cpv1.value.indexOf("0") == 0)
			{
				alert("Current property value cannot be zero");
				document.frm.cpv1.focus();
				return false;
			}
			var chk = IsNumeric(document.frm.cpv1.value)
			if(chk == false)
			{
				alert("Please enter the Current property value as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
				document.frm.cpv1.focus();
				return false;
			}
		}
		//End Current property value validation
		//Mortgage Repayment value validation
		if(document.frm.m_repayment1.value == "")
		{
			alert("Mortgage Repayment value cannot be blank");
			document.frm.m_repayment1.focus();
			return false;
		}
		if(document.frm.m_repayment1.value!="")
		{
			if(document.frm.m_repayment1.value.indexOf("0") == 0)
			{
				alert("Mortgage Repayment value cannot be zero");
				document.frm.m_repayment1.focus();
				return false;
			}
			var chk = IsNumeric(document.frm.m_repayment1.value)
			if(chk == false)
			{
				alert("Please enter the Mortgage Repayment value as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
				document.frm.m_repayment1.focus();
				return false;
			}
		}
		//Mortgage Repayment property value validation
		//Lender Name
		if(document.frm.l_name.value == "")
		{
			alert("Lender Name value cannot be blank");
			document.frm.l_name.focus();
			return false;
		}
		//End Lender Name
	}
	if((document.frm.Loan_Type.selectedIndex==2) || (document.frm.Loan_Type.selectedIndex==3))
	{
		if(document.frm.HaveGuarantor.selectedIndex==0)
		{
			alert('Please Select the Guarantor field');
			document.frm.HaveGuarantor.focus();
			return false;
		}
	}
	if(document.frm.Loan_Type.selectedIndex==4)
	{
		//Validation Make of car and model of car
		if(document.frm.carmake.value=="")
		{
			alert("Please enter the make of car");
			document.frm.carmake.focus();
			return false;
		}
		if(document.frm.carmodel.value=="")
		{
			alert("Please enter the car model");
			document.frm.carmodel.focus();
			return false;
		}
		//End Validation Make of car and model of car
		//validation of Car Registration year
		if(document.frm.yearreg.selectedIndex==0)
		{
			alert("Please Select the Registration year");
			document.frm.yearreg.focus();
			return false;
		}
		//End Car Registration Year  
		//Validation of Car Registration no
		if(document.frm.regno.value == "")
		{
			alert("Car Registration no field cannot be blank");
			document.frm.regno.focus();
			return false;
		}
		//End Validtaion of car registration no
		//Validation of how old is car 
		if(document.frm.caryear.selectedIndex == 0)
		{
			alert("Please select how old is your car");
			document.frm.caryear.focus();
			return false;
		}
		//End Validation of how old is car
		//Validation of car finance
		if(document.frm.carfinance.selectedIndex != 2)
		{
			alert("Car finance selection should be free of finance");
			document.frm.carfinance.focus();
			return false;
		}
		//End validation of car finance
	}
	if(document.frm.Loan_Type.selectedIndex==5)
	{		
		//Validation of Monthly Expenditure
		if(document.frm.m_expend4.value == "")
		{
			alert("Monthly Expenditure field cannot be blank");
			document.frm.m_expend4.focus();
			return false;
		}
		if(document.frm.m_expend4.value.indexOf("0") == 0)
		{
			alert("Monthly Expenditure cannot be zero");
			document.frm.m_expend4.focus();
			return false;
		}
		var chk = IsNumeric(document.frm.m_expend4.value)
		if(chk == false)
		{
			alert("Please enter the Monthly Expenditure as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
			document.frm.m_expend4.focus();
			return false;
		}
		//End validation of Monthly Expenditure
		//Validation of Debt amount
		if(document.frm.d_amount4.value == "")
		{
			alert("Debt Amount field cannot be blank");
			document.frm.d_amount4.focus();
			return false;
		}
		if(document.frm.d_amount4.value.indexOf("0") == 0)
		{
			alert("Debt Amount cannot be zero");
			document.frm.d_amount4.focus();
			return false;
		}
		var chk = IsNumeric(document.frm.d_amount4.value)
		if(chk == false)
		{
			alert("Please enter the Debt Amount as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
			document.frm.d_amount4.focus();
			return false;
		}
		//End validation of Debt amount
		//Creditors Validation
		if(document.frm.n_creditors4.selectedIndex==0)
		{
			alert("Please enter no of creditors");
			document.frm.n_creditors4.focus();
			return false;
		}
		//End Creditors Validation
		//Validation of Monthly Disposible Income
		if(document.frm.m_DispIncome.value == "")
		{
			alert("Monthly Disposable Income field cannot be blank");
			document.frm.m_DispIncome.focus();
			return false;
		}
		if(document.frm.m_DispIncome.value.indexOf("0") == 0)
		{
			alert("Monthly Disposable Income cannot be zero");
			document.frm.m_DispIncome.focus();
			return false;
		}
		var chk = IsNumeric(document.frm.m_DispIncome.value)
		if(chk == false)
		{
			alert("Please enter the Monthly Disposable Income as a number, with no decimal points and no characters like ‘£‘, ‘,’ etc.");
			document.frm.m_DispIncome.focus();
			return false;
		}
		//End Validataion of Monthly Disposible Income
	}
	
	//validation for check box
	if(document.frm.chkData.checked==false)
	{
		alert("Please confirm that you have read and agree \n with the Terms and Conditions");
		return false;
	}
	if((document.frm.chkdeb.checked==false)&&(document.frm.Loan_Type.selectedIndex==5))
	{
		alert("Please Select yes on Are you struggling with your unsecured debts? ");
		document.frm.chkdeb.focus();
		return false;
	}
	//validation for check box
return true;
}
function divhide()
{
	if(document.frm.Loan_Type.selectedIndex==0)
	{
		document.getElementById('divloan').style.display = 'none';
		//document.getElementById('divempdet').style.display = 'block';
		document.getElementById('divpropdet').style.display = 'none';
		document.getElementById('divcardet').style.display = 'none';
		document.getElementById('divfindet').style.display = 'none';
		document.getElementById('divtickarea').style.display = 'none';
		document.getElementById('divbnkdet').style.display = 'block';
		document.getElementById('divCreditor').style.display = 'none';
	}
	if(document.frm.Loan_Type.selectedIndex==1)
	{
		document.getElementById('divloan').style.display = 'block';
		//document.getElementById('divempdet').style.display = 'block';
		document.getElementById('divpropdet').style.display = 'block';
		document.getElementById('divcardet').style.display = 'none';
		document.getElementById('divfindet').style.display = 'none';
		document.getElementById('divtickarea').style.display = 'none';	
		document.getElementById('divbnkdet').style.display = 'block';
		document.getElementById('divCreditor').style.display = 'none';
	}
	if(document.frm.Loan_Type.selectedIndex==2)
	{
		document.getElementById('divloan').style.display = 'block';
		//document.getElementById('divempdet').style.display = 'block';
		document.getElementById('divpropdet').style.display = 'none';
		document.getElementById('divcardet').style.display = 'none';
		document.getElementById('divfindet').style.display = 'none';
		document.getElementById('divtickarea').style.display = 'none';	
		document.getElementById('divbnkdet').style.display = 'block';
		document.getElementById('divCreditor').style.display = 'block';
	}
	if(document.frm.Loan_Type.selectedIndex==3)
	{
		document.getElementById('divloan').style.display = 'block';
		//document.getElementById('divempdet').style.display = 'none';
		document.getElementById('divpropdet').style.display = 'none';
		document.getElementById('divcardet').style.display = 'none';
		document.getElementById('divfindet').style.display = 'none';
		document.getElementById('divtickarea').style.display = 'none';	
		document.getElementById('divbnkdet').style.display = 'block';
		document.getElementById('divCreditor').style.display = 'block';
	}
	if(document.frm.Loan_Type.selectedIndex==4)
	{
		document.getElementById('divloan').style.display = 'block';
		document.getElementById('divempdet').style.display = 'none';
		document.getElementById('divpropdet').style.display = 'none';
		document.getElementById('divcardet').style.display = 'block';
		document.getElementById('divfindet').style.display = 'none';
		document.getElementById('divtickarea').style.display = 'none';	
		document.getElementById('divbnkdet').style.display = 'none';
		document.getElementById('divCreditor').style.display = 'none';
	}
	if(document.frm.Loan_Type.selectedIndex==5)
	{
		document.getElementById('divloan').style.display = 'none';
		document.getElementById('divempdet').style.display = 'none';
		document.getElementById('divpropdet').style.display = 'none';
		document.getElementById('divcardet').style.display = 'none';
		document.getElementById('divfindet').style.display = 'block';
		document.getElementById('divtickarea').style.display = 'block';
		document.getElementById('divbnkdet').style.display = 'none';
		document.getElementById('divCreditor').style.display = 'none';
	}
	if(document.frm.OCC_STAT.selectedIndex==0)
	{
		document.getElementById('divempdet').style.display = 'none';
	}
	if((document.frm.OCC_STAT.selectedIndex!=0) && (document.frm.Loan_Type.selectedIndex==1))
	{
		document.getElementById('divempdet').style.display = 'block';
	}
	if((document.frm.OCC_STAT.selectedIndex!=0) && (document.frm.Loan_Type.selectedIndex==2))
	{
		document.getElementById('divempdet').style.display = 'block';
	}
	if((document.frm.OCC_STAT.selectedIndex!=0) && (document.frm.Loan_Type.selectedIndex==3))
	{
		document.getElementById('divempdet').style.display = 'block';
	}
}
//check for valid numerical strings
function IsNumeric(strString)
{
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   //  test strString consists of valid characters listed above
   for (j = 0; j < strString.length && blnResult == true; j++)
   {
     strChar = strString.charAt(j);
     if (strValidChars.indexOf(strChar) == -1)
     {
        blnResult = false;
     }
   }
   return blnResult;
}	
	
//check for valid charector strings
function Ischar(strString)
{
  var strValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
  var strChar;
  var blnResult = true;

  if (strString.length == 0) return false;
 //  test strString consists of valid characters listed above
  for (j = 0; j < strString.length && blnResult == true; j++)
  {
     strChar = strString.charAt(j);
     if (strValidChars.indexOf(strChar) == -1)
     {
        blnResult = false;
     }
  }
  return blnResult;
}
//function for postcode
function postit(strString)
{//check postcode format is valid
 	test = strString; size = test.length
 	test = test.toUpperCase(); //Change to uppercase
 	while (test.slice(0,1) == " ") //Strip leading spaces
  	{
		test = test.substr(1,size-1);size = test.length
  	}
 	while(test.slice(size-1,size)== " ") //Strip trailing spaces
  	{	
		test = test.substr(0,size-1);size = test.length
  	}
 	//document.details.pcode.value = test; //write back to form field
 	if (size < 6 || size > 8)
	{ //Code length rule
    		return false;
  	}
 	if (!(isNaN(test.charAt(0))))
	{ //leftmost character must be alpha character rule
      		return false;
  	}
 	if(isNaN(test.charAt(size-3)))
	{ //first character of inward code must be numeric rule
     		return false;
  	}
 	if (!(isNaN(test.charAt(size-2))))
	{ //second character of inward code must be alpha rule
     		return false;
  	}
 	if (!(isNaN(test.charAt(size-1))))
	{ //third character of inward code must be alpha rule
      		return false;
  	}
 	//if(!(test.charAt(size-4) == " "))
	//{//space in position length-3 rule
     // 		return false;
   //	}
 	//count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
 	//if (count1 != count2)
	//{//only one space rule
    // 		return false;
  	//}
	return true;
}
//***************************************************************************************************************************************************
var dtCh= "/";
var minYear=1910;
var maxYear=1991;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}
//***************************************************************************************************************************************************
function dateCheck(m, d, y) 
{
	if(m != '')
	{//alert(m)
		if(m == "Apr" || m == "Jun" || m == "Sep" || m == "Nov")
		{//alert("hello")
			if(d == "31")
			{ 
				return false; 
			} 
		} 
		if(m == "Feb")
		{ 
			if(parseInt(y)%4 != 0 && d == "29")
			{	 
				return false; 
			} 
			else if(d == 30 || d== 31)
			{ 
				return false; 
			} 
		} 
	return true; 
	} 
} 