

function initialise()
{
	if (!document.getElementById)
		return;

	var objPartner = document.getElementById('jointdetails');
	var objCheck = document.getElementById('jointyes');
	var objUnCheck = document.getElementById('jointno');
	
	if (objPartner && objCheck)
	{
		if (!objCheck.checked)
			objPartner.style.display = 'none';

		objCheck.onclick = function(event){return displayPartner(this, event);};
		objCheck.onkeypress = function(event){return displayPartner(this, event);};
		objUnCheck.onclick = function(event){return displayPartner(this, event);};
		objUnCheck.onkeypress = function(event){return displayPartner(this, event);};
	}
}

function displayPartner(objCheck, objEvent)
{
	var iKeyCode;

	if (objEvent && objEvent.type == 'keypress')
	{
		if (objEvent.keyCode)
			iKeyCode = objEvent.keyCode;
		else if (objEvent.which)
			iKeyCode = objEvent.which;

		if (iKeyCode != 13 && iKeyCode != 32)
			return true;
	}

	if (objCheck.id == 'jointyes')
		document.getElementById('jointdetails').style.display = 'block';
	else
		document.getElementById('jointdetails').style.display = 'none';
	
	return true;
}


// The functions "hidepartner" and "showpartner" allow the switchin of the 
// red required field blobs for the partner details if the first applicant
// indicates that they have a partner.
function hidepartner() {
		var eElem, aDivs = document.all.tags("DIV");
		var iDivsLength = aDivs.length;
		for(i=0; i<iDivsLength; i++) {
			eElem = aDivs[i];
			if (eElem.id.indexOf('on') != -1) eElem.style.display = "none";
			if (eElem.id.indexOf('off') != -1) eElem.style.display = "";
		}
}

function showpartner() {
		var eElem, aDivs = document.all.tags("DIV");
		var iDivsLength = aDivs.length;
		for(i=0; i<iDivsLength; i++) {
			eDiv = aDivs[i];
			if (eDiv.id.indexOf('off') != -1) eDiv.style.display = "none";
			if (eDiv.id.indexOf('on') != -1) eDiv.style.display = "";
		}
}











function CheckStepOne() {
	var theForm = document.StepOne;
	var msg = "Please enter the following required information\n\n";
	var blnValid = true;
	
	if(theForm.DobDay.selectedIndex<1 || theForm.DobMonth.selectedIndex<1){
		blnValid = false;
		msg += "\tDate of application\n";
	}
	
	if(isBlank(theForm.AppFirstname.value)){
		blnValid = false;
		msg += "\tApplication first name(s)\n";
	}
	
	if(isBlank(theForm.AppSurname.value)){
		blnValid = false;
		msg += "\tApplication surname\n";
	}
	
	if(!isBlank(theForm.BrokerEmail.value)){
		
		
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		
		if (!filter.test(theForm.BrokerEmail.value)){
			blnValid = false;
			msg += "\tA valid e-mail address\n";
		}
		
	}
	
	
	if (blnValid) {
		theForm.action='loan_application.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
}

function CheckStepTwo() {
	var theForm = document.StepTwo;
	var msg = "Please enter the following required information\n\n";
	var blnValid = true;
	
	if(isBlank(theForm.AppFirstnameApp1.value)){
		blnValid = false;
		msg += "\tFirst name of applicant 1\n";
	}
	
	if(isBlank(theForm.AppSurnamenameApp1.value)){
		blnValid = false;
		msg += "\tSurname of applicant 1\n";
	}
	
	if(isBlank(theForm.AppAddress1App1.value) || isBlank(theForm.AppAddress2App1.value)){
		blnValid = false;
		msg += "\tAddress of applicant 1\n";
	}
	
	if (!isUKPostCode(theForm.AppPostcodeApp1.value))
	{
		blnValid = false;
		msg += "\tValid postcode of applicant 1\n";
	}
	
	
	if(isBlank(theForm.AppTelApp1.value)){
		blnValid = false;
		msg += "\tTelephone of applicant 1\n";
	}	
	
	if (!isInteger(theForm.AppTelApp1.value)){
			blnValid = false;
			msg += "\tValid telephone of applicant 1\n";
	}
	
	if (!isInteger(theForm.AppMobApp1.value)){
			blnValid = false;
			msg += "\tValid mobile of applicant 1\n";
	}
	
	if (!isInteger(theForm.AppFaxNoApp1.value)){
			blnValid = false;
			msg += "\tValid fax of applicant 1\n";
	}
	
	if(!isBlank(theForm.AppEmailApp1.value)){
		
		
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		
		if (!filter.test(theForm.AppEmailApp1.value)){
			blnValid = false;
			msg += "\tA valid e-mail address\n";
		}
		
	}
	
	
	if(theForm.IsJointApp[0].checked){
		if(isBlank(theForm.AppFirstnameApp2.value)){
			blnValid = false;
			msg += "\tFirst name of applicant 2\n";
		}
	
		if(isBlank(theForm.AppSurnamenameApp2.value)){
			blnValid = false;
			msg += "\tSurname of applicant 2\n";
		}
	
		if(isBlank(theForm.AppAddress1App2.value) || isBlank(theForm.AppAddress2App1.value)){
			blnValid = false;
			msg += "\tAddress of applicant 2\n";
		}
	
		if (!isUKPostCode(theForm.AppPostcodeApp2.value)){
			blnValid = false;
			msg += "\tValid postcode of applicant 2\n";
		}
		
		if(isBlank(theForm.AppTelApp2.value)){
			blnValid = false;
			msg += "\tTelephone of applicant 2\n";
		}	
	
		if (!isInteger(theForm.AppTelApp2.value)){
			blnValid = false;
			msg += "\tValid telephone of applicant 2\n";
		}
		
		if (!isInteger(theForm.AppMobApp2.value)){
			blnValid = false;
			msg += "\tValid mobile of applicant 2\n";
		}
		
		if (!isInteger(theForm.AppFaxNoApp2.value)){
			blnValid = false;
			msg += "\tA valid fax of applicant 2\n";
		}
		
		if(!isBlank(theForm.AppEmailApp2.value)){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (!filter.test(theForm.AppEmailApp2.value)){
			blnValid = false;
			msg += "\tA valid e-mail address\n";
		}
		
	}
		
		
	}
	
	if(theForm.AppMoreThanThreeYears1[1].checked){
	
		if(isBlank(theForm.AppPreviousAddress1App1.value) || isBlank(theForm.AppPreviousAddress2App1.value)){
			blnValid = false;
			msg += "\tPrevious Address of Applicant 1\n";
		}
	
		if (!isUKPostCode(theForm.AppPrevPostcodeApp1.value)){
			blnValid = false;
			msg += "\tA valid Previous Postcode of Applicant 1\n";
		}
	}
	
	if(theForm.AppMoreThanThreeYears2[1].checked){
	
		if(isBlank(theForm.AppPreviousAddress1App2.value) || isBlank(theForm.AppPreviousAddress2App2.value)){
			blnValid = false;
			msg += "\tPrevious Address of Applicant 2\n";
		}
	
		if (!isUKPostCode(theForm.AppPrevPostcodeApp2.value)){
			blnValid = false;
			msg += "\tA valid Previous Postcode of Applicant 2\n";
		}
	}
	
	if(!isBlank(theForm.AppPractiseEmail.value)){
		
		
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		
		if (!filter.test(theForm.AppPractiseEmail.value)){
			blnValid = false;
			msg += "\tA valid solicitor e-mail address\n";
		}
		
	}
	
	
	if(!isBlank(theForm.AppPractisePostcode.value)){
		if (!isUKPostCode(theForm.AppPractisePostcode.value)){
			blnValid = false;
			msg += "\tA valid postcode of solicitor\n";
		}
	}
	
	
	if (!isInteger(theForm.AppPractiseTel.value)){
			blnValid = false;
			msg += "\tA valid telephone number of solicitor\n";
	}
	
	if (!isInteger(theForm.AppPractiseMob.value)){
			blnValid = false;
			msg += "\tA valid mobile of solicitor\n";
	}
	
	if (!isInteger(theForm.AppPractiseFaxNo.value)){
			blnValid = false;
			msg += "\tA valid fax of solicitor\n";
	}
	
	
	if(!isBlank(theForm.AppCompanyPostcode.value)){
		if (!isUKPostCode(theForm.AppCompanyPostcode.value)){
			blnValid = false;
			msg += "\tA valid postcode of company\n";
		}
	}
	
	if(!isBlank(theForm.AppCompanyDirector1Postcode.value)){
		if (!isUKPostCode(theForm.AppCompanyDirector1Postcode.value)){
			blnValid = false;
			msg += "\tA valid postcode of director 1\n";
		}
	}
	
	if(!isBlank(theForm.AppCompanyDirector2Postcode.value)){
		if (!isUKPostCode(theForm.AppCompanyDirector2Postcode.value)){
			blnValid = false;
			msg += "\tA valid postcode of director 2\n";
		}
	}
	
	if(!isBlank(theForm.AppCompanyDirector3Postcode.value)){
		if (!isUKPostCode(theForm.AppCompanyDirector3Postcode.value)){
			blnValid = false;
			msg += "\tA valid postcode of director 3\n";
		}
	}
	
	if(isBlank(theForm.AppLoanRequired.value)){
		blnValid = false;
		msg += "\tAmount of loan\n";
	}
	
	if(isBlank(theForm.TermOfLoan.value)){
		blnValid = false;
		msg += "\tTerm of loan\n";
	}
	
	
	
	if (blnValid) {
		theForm.action='loan_application_2.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
}
	

function CheckStepThree() {
	var theForm = document.StepThree;
	var msg = "Please enter the following required information\n\n";
	var blnValid = true;
	
	
	if(isBlank(theForm.AppSecuredPropAddress1.value) || isBlank(theForm.AppSecuredPropAddress2.value)){
		blnValid = false;
		msg += "\tSecured Property Address\n";
	}
	
	if (!isUKPostCode(theForm.AppSecuredPropPostcode.value))
	{
		blnValid = false;
		msg += "\tValid Secured Property Postcode\n";
	}
	
	if (isBlank(theForm.AppSecuredPropValue.value)){
			blnValid = false;
			msg += "\tSecured Property Value\n";
	}
	
	if(isBlank(theForm.AppSecuredPropDescription.value)){
			blnValid = false;
			msg += "\tSecured Property Description\n";
	}
	
	
	if(!isBlank(theForm.AppAdditionalProperty2Address1.value)){
	
	
		if(isBlank(theForm.AppAdditionalProperty2Address1.value) || isBlank(theForm.AppAdditionalProperty2Address2.value)){
			blnValid = false;
			msg += "\tSecured property 2 address\n";
		}
	
		if (!isUKPostCode(theForm.AppAdditionalProperty2Postcode.value))
		{
			blnValid = false;
			msg += "\tValid secured property 2 postcode\n";
		}
	
		if (isBlank(theForm.AppAdditionalProperty2Value.value)){
			blnValid = false;
			msg += "\tSecured property 2 value\n";
		}
	
		if(isBlank(theForm.AppAdditionalProperty2Description.value)){
			blnValid = false;
			msg += "\tSecured property 2 description\n";
		}
	
	}
	
	if(!isBlank(theForm.AppAdditionalProperty3Address1.value)){
	
	
		if(isBlank(theForm.AppAdditionalProperty3Address1.value) || isBlank(theForm.AppAdditionalProperty3Address2.value)){
			blnValid = false;
			msg += "\tSecured property 3 address\n";
		}
	
		if (!isUKPostCode(theForm.AppAdditionalProperty3Postcode.value))
		{
			blnValid = false;
			msg += "\tValid secured property 3 postcode\n";
		}
	
		if (isBlank(theForm.AppAdditionalProperty3Value.value)){
			blnValid = false;
			msg += "\tSecured property 3 value\n";
		}
	
		if(isBlank(theForm.AppAdditionalProperty3Description.value)){
			blnValid = false;
			msg += "\tSecured property 3 description\n";
		}
	
	}
	
	
	/*if(isBlank(theForm.Appproperty1NameOfLender.value) && isBlank(theForm.Appproperty2NameOfLender.value) && isBlank(theForm.Appproperty3NameOfLender.value)){
		blnValid = false;
		msg += "\tDetails of Exisitng Changes\n";
	}*/
	
	if(!isBlank(theForm.Appproperty1NameOfLender.value)){
		if(isBlank(theForm.property1Amount.value)){
			blnValid = false;
			msg += "\tDetails of Property 1's Exisitng Changes Ammount of Loan Outstanding\n";
		}		
	}
	
	if(!isBlank(theForm.Appproperty2NameOfLender.value)){
		if(isBlank(theForm.property2Amount.value)){
			blnValid = false;
			msg += "\tDetails of Property 2's Exisitng Changes Ammount of Loan Outstanding\n";
		}		
	}
	
	if(!isBlank(theForm.Appproperty3NameOfLender.value)){
		if(isBlank(theForm.property3Amount.value)){
			blnValid = false;
			msg += "\tDetails of Property 3's Exisitng Changes Ammount of Loan Outstanding\n";
		}		
	}
	
	
	
	/*
	if(theForm.purposeofLoan[6].checked){
		if(isBlank(theForm.AppPurposeOtherDetail.value)){
			blnValid = false;
			msg += "\tPlease give details of Purpose of loan\n";
		}		
	}
	
	
	if(theForm.repaymentProposals[2].checked){
		if(isBlank(theForm.AppRepaymentPropOtherDetail.value)){
			blnValid = false;
			msg += "\tPlease give details of Repayment proposals\n";
		}		
	}
	*/

	if (blnValid) {
		theForm.action='loan_application_3.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
}
	


function CheckStepFour() {
	var theForm = document.StepFour;
	var msg = "Please enter the following required information\n\n";
	var blnValid = true;
	
	if(theForm.LoanAppCCJ[0].checked){
		
		if(isBlank(theForm.AppAdverseCreditAmount1.value) && isBlank(theForm.AppAdverseCreditAmount2.value) && isBlank(theForm.AppAdverseCreditAmount3.value) 
		&& isBlank(theForm.AppAdverseCreditAmountDateDay1.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateDay2.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateDay3.selectedIndex<1)
		&& isBlank(theForm.AppAdverseCreditAmountDateMonth1.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateMonth2.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateMonth3.selectedIndex<1)
		&& isBlank(theForm.AppAdverseCreditAmountDateYear1.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateYear2.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateYear3.selectedIndex<1)
		&& isBlank(theForm.AppAdverseCreditAmountExplanation1.value) && isBlank(theForm.AppAdverseCreditAmountExplanation2.value) && isBlank(theForm.AppAdverseCreditAmountExplanation3.value)){
			blnValid = false;
			msg += "\tDetails of adverse credit\n";
		}	
	}
	
	if(theForm.AppAdverseCreditBankcrupt[0].checked){
		
		if(isBlank(theForm.AppAdverseCreditBankcruptDetails.value)){
			blnValid = false;
			msg += "\tDetails of Bankcruptcy\n";
		}
	}
	
	if(!isBlank(theForm.AppAdverseCreditAmount1.value)){
		
		if(isBlank(theForm.AppAdverseCreditAmountDateDay1.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateMonth1.selectedIndex<1)
		&& isBlank(theForm.AppAdverseCreditAmountExplanation1.value)){
			blnValid = false;
			msg += "\tDetails of Adverse Credit 1\n";
		}
	}
	
	if(!isBlank(theForm.AppAdverseCreditAmount2.value)){
		
		if(isBlank(theForm.AppAdverseCreditAmountDateDay2.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateMonth2.selectedIndex<1)
		&& isBlank(theForm.AppAdverseCreditAmountExplanation2.value)){
			blnValid = false;
			msg += "\tDetails of Adverse Credit 2\n";
		}
	}
	
	if(!isBlank(theForm.AppAdverseCreditAmount3.value)){
		
		if(isBlank(theForm.AppAdverseCreditAmountDateDay3.selectedIndex<1) && isBlank(theForm.AppAdverseCreditAmountDateMonth3.selectedIndex<1)
		&& isBlank(theForm.AppAdverseCreditAmountExplanation3.value)){
			blnValid = false;
			msg += "\tDetails of Adverse Credit 3\n";
		}
	}
	
	if(!(theForm.agree.checked)){
		blnValid = false;
		msg += "\You must agree to the Data Protection Act\n";	
	}
	
	
	
	
	if (blnValid) {
		theForm.action='loan_application_4.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
}


function checkSalesLeadEntry() {
	var theForm = document.leadEntry;
	var msg = "Please enter the following required information\n\n";
	var blnValid = true;
	

	
	if(isBlank(theForm.txtFirstname.value)){
		blnValid = false;
		msg += "\tFirstname\n";
	}
	
	if(isBlank(theForm.txtSurname.value)){
		blnValid = false;
		msg += "\tSurname\n";
	}
	
	if(isBlank(theForm.txtAddress1.value) || isBlank(theForm.txtAddress2.value)){
		blnValid = false;
		msg += "\tClient Address\n";
	}
	
	if (!isUKPostCode(theForm.txtPostcode.value))
	{
		blnValid = false;
		msg += "\tA valid Client Post Code\n";
	}
	
	if(isBlank(theForm.txtTelephone.value || theForm.txtMobile.value)){
			blnValid = false;
			msg += "\tA Home or mobile telephone number\n";
	}
	
	if (!isBlank(theForm.txtTelephone.value))
	{
		var tilter=/^0\d+$/i
		if(!tilter.test(theForm.txtTelephone.value)){
			blnValid = false;
			msg += "\tA valid home telephone number no spaces or dashes\n";
		}
	}
	
	
	if (!isBlank(theForm.txtMobile.value))
	{
		var tilter=/^0\d+$/i
		if(!tilter.test(theForm.txtMobile.value)){
			blnValid = false;
			msg += "\tA valid mobile telephone number no spaces or dashes\n";
		}
	}
	
	if(isBlank(theForm.txtEmail.value)){
			blnValid = false;
			msg += "\tEmail Address\n";
	}
	
	

	if(!isBlank(theForm.txtEmail.value)){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		
		if (!filter.test(theForm.txtEmail.value)){
			blnValid = false;
			msg += "\tA valid E-mail Address\n";
		}
		
	}
	
	
	if(theForm.bjoint[0].checked){
		if(theForm.ddInsuranceType.selectedIndex<1){
		blnValid = false;
		msg += "\tInsurance Type\n";
		}
	}
	
	if(theForm.bjoint[1].checked){
		if(theForm.ddInsuranceType1.selectedIndex<1){
		blnValid = false;
		msg += "\tInsurance Type\n";
		}
	}
	
	
	if(theForm.bjoint[0].checked){
		if(isBlank(theForm.txtPropAddress1.value) || isBlank(theForm.txtPropAddress2.value)){
			blnValid = false;
			msg += "\tProperty Address\n";
		}
	
		if (!isUKPostCode(theForm.txtPropPostcode.value))
		{
			blnValid = false;
			msg += "\tA valid Proprty Address Post Code\n";
		}
		
		
	}
	
	
	
	
	/////////////////////////////
	if(isBlank(theForm.txtSalesFirstname.value)){
		blnValid = false;
		msg += "\tYour Firstname\n";
	}
	
	if(isBlank(theForm.txtSalesSurname.value)){
		blnValid = false;
		msg += "\tYour Surname\n";
	}
	
	if(isBlank(theForm.txtSalesTelephone.value || theForm.txtSalesMobile.value)){
			blnValid = false;
			msg += "\tYour telephone or mobile number\n";
	}
	
	if (!isBlank(theForm.txtSalesTelephone.value))
	{
		var tilter=/^0\d+$/i
		if(!tilter.test(theForm.txtSalesTelephone.value)){
			blnValid = false;
			msg += "\tA valid telephone number no spaces or dashes\n";
		}
	}
	
	if (!isBlank(theForm.txtSalesMobile.value))
		{
		var tilter=/^0\d+$/i
		if(!tilter.test(theForm.txtSalesMobile.value)){
			blnValid = false;
			msg += "\tA valid mobile telephone number no spaces or dashes\n";
		}
	}
	
	if(isBlank(theForm.txtSalesEmail.value)){
			blnValid = false;
			msg += "\tYour Email Address\n";
	}

	if(!isBlank(theForm.txtSalesEmail.value)){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		
		if (!filter.test(theForm.txtSalesEmail.value)){
			blnValid = false;
			msg += "\tA valid E-mail Address\n";
		}
		
	}
	
	
	if(theForm.txtDateDay.selectedIndex<1 || theForm.txtDateMonth.selectedIndex<1|| theForm.txtDateYear.selectedIndex<1){
		blnValid = false;
		msg += "\tDate of Sale made\n";
	}
	if(theForm.txtSalesInsuranceType.selectedIndex<1){
		blnValid = false;
		msg += "\tInsurance Type\n";
	}
	if(theForm.txtChannelType.selectedIndex<1){
		blnValid = false;
		msg += "\tChannel Type\n";
	}
	
	
		if (!isBlank(theForm.txtSalesMobile.value))
			{
			if(!isNumeric(theForm.PolicyAmount.value)){
				blnValid = false;
				msg += "\tA valid mobile telephone number no spaces or dashes\n";
			}
		}
		
	if (blnValid) {
		theForm.action='salesLeadConfirm.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
}


function checkLogin() {
	var theForm = document.SalesLogin;
	var msg = "Please enter the following required information\n\n";
	var blnValid = true;
	
	if(isBlank(theForm.TxtUsername.value)){
		blnValid = false;
		msg += "\tUsername\n";
	}
	
	if(isBlank(theForm.TxtPassword.value)){
		blnValid = false;
		msg += "\tPassword\n";
	}
	
	if (blnValid) {
		theForm.action='LoginCheck.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
	
	
}

function checkReport() {
	var theForm = document.FrmReport;
	var msg = "Please correct the following information\n\n";
	var blnValid = true;
	
	if(!isBlank(theForm.DayFrom.value || theForm.MonthFrom.value || theForm.YearFrom.value)){
	
		if (!/^\d{2}\/\d{2}\/\d{4}$/.test(theForm.DayFrom.value+"/"+theForm.MonthFrom.value+"/"+theForm.YearFrom.value)) {
 			alert("Date field must be filled and in dd/mm/yyyy format");
 			return false;
		}

		var aD = (theForm.DayFrom.value+"/"+theForm.MonthFrom.value+"/"+theForm.YearFrom.value).split("/");
		var nD = new Date(aD[2], aD[1]-1, aD[0])

		if((aD[2]!=nD.getFullYear() || aD[1]!=nD.getMonth()+1 || aD[0]!=nD.getDate())){
  			blnValid = false;
  			msg += "\tValid date\n";
		}
	}
	
	if(!isBlank(theForm.DayTill.value || theForm.MonthTill.value || theForm.YearTill.value)){
	
		if (!/^\d{2}\/\d{2}\/\d{4}$/.test(theForm.DayTill.value+"/"+theForm.MonthTill.value+"/"+theForm.YearTill.value)) {
 			alert("Date field must be filled and in dd/mm/yyyy format");
 			return false;
		}

		var aD = (theForm.DayTill.value+"/"+theForm.MonthTill.value+"/"+theForm.YearTill.value).split("/");
		var nD = new Date(aD[2], aD[1]-1, aD[0])

		if((aD[2]!=nD.getFullYear() || aD[1]!=nD.getMonth()+1 || aD[0]!=nD.getDate())){
  			blnValid = false;
  			msg += "\tValid date\n";
		}
	}
	
	if(!isBlank(theForm.PolicyAmmount.value)){
	
		if(!isInteger(theForm.PolicyAmmount.value)){
			
			blnValid = false;
  			msg += "\tPolicy ammount with no commas\n";
		}
	
	}
	
	if(!isBlank(theForm.ComissionAmmount.value)){
	
		if(!isInteger(theForm.ComissionAmmount.value)){
			
			blnValid = false;
  			msg += "\tComission ammount with no commas\n";
		}
	
	}
	
	
	if (blnValid) {
		theForm.action='ReportingSuite.asp';
		theForm.submit();
	}else{
		alert(msg);
	}
	
	
}

