function getRadioCheckedValue(btn) {
	var cnt = -1;
	
	for (var i=btn.length-1; i > -1; i--) {
	   if (btn[i].checked) {cnt = i; i = -1;}
	   }
	if (cnt > -1) return btn[cnt].value;
	else return null;
}


// test function above


function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'menubar=no,location=no,menus=no,scrollbars=yes,resizable=0,status=yes,width=825px,height=710px,top=20px,left=20px');");
}

function popUpApplication(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'menubar=no,location=no,menus=no,scrollbars=yes,resizable=0,status=yes,width=1005px,height=680px,top=20px,left=20px');");
}

function popUpInternetBanking(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'menubar=no,location=no,menus=no,scrollbars=yes,resizable=1,status=yes,width=1020px,height=670px,top=20px,left=20px');");
}

function Compare_String(string1,string2){
	alert("string 1= " + string1);
	alert("string 2= " + string2);
	if (string1.toUpperCase() == string2.toUpperCase()) {
    	alert("equals");
	}else{
		alert("not equals");
	}
}

function DoSearch(){

	document.frmSearch.action = "search.asp";
	document.frmSearch.submit();
}

function Jump_Menu(targ,selObj,restore){ //v3.0

	var myTarget = new Array();
	myTarget = selObj.options[selObj.selectedIndex].value.split('|');
	
	if(myTarget.length == 2){
		if(myTarget[1] == 1){
			window.open(myTarget[0], "_Blank");
		}else if(myTarget[1] == 2){
			popUpApplication(myTarget[0]);
		}else if(myTarget[1] == 3){
			popUpInternetBanking(myTarget[0]);
		}
	}else{
  		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	}	

	if (restore) selObj.selectedIndex=0;
}

function HideRow(RowID){
	document.getElementById(RowID).style.display = "none";		
}	

function ShowRow(RowID){
	document.getElementById(RowID).style.display = "";	
}	

function checkDate(myDayStr, myMonthStr, myYearStr ) {
	var myMonth = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); var myDateStr = myDayStr + ' ' + myMonth[myMonthStr] + ' ' + myYearStr;
	
	/* Using form values, create a new date object
	using the setFullYear function */
	var myDate = new Date();
	myDate.setFullYear( myYearStr, myMonthStr, myDayStr );
	
	if ( myDate.getMonth() != myMonthStr ) {
	  return false;
	} else {
	  return true;
	}
}

function Cancel_Loan_Application(){

	var result
	
	result =  confirm("Are you sure you want to cancel your loan application? \n\nAll entered data will be lost");

	if(result){
		window.location.replace("Cancelled.asp");
	}
}

function Validate_General_Enquiry(){

	var EmailFilter  = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;	
	var Errors = false;
	var ErrorDesc = "";
	var ErrorNumber = 0;
	
	var cboTitle = document.getElementById("cboTitle").value;
	var txtFirstName = document.getElementById("txtFirstName").value;
	var txtLastName = document.getElementById("txtLastName").value;
	var txtMemberNumber = document.getElementById("txtMemberNumber").value;
	var optContact = document.getElementsByName('optContact');
	var txtPhoneNumber = document.getElementById("txtPhoneNumber").value;
	var txtEmailAddress = document.getElementById("txtEmailAddress").value;
	var cboEnquiryType = document.getElementById("cboEnquiryType").value;
	var txtMessage = document.getElementById("txtMessage").value;

	
	if(cboTitle == ''){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please select your Title.\n";
	}
	
	if((txtFirstName == '') || (txtFirstName == null)){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please provide your First Name.\n";
	}
	
	if((txtLastName == '') || (txtLastName == null)){					
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please provide your Last Name.\n";
	}
	
	if(getCheckedValue(optContact) == ''){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please select your Prefered Contact.\n";
	}	

	if((txtPhoneNumber == '') || (txtPhoneNumber == null)){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please provide your Phone Number.\n";
	}

	if((txtEmailAddress == '') || (txtEmailAddress == null)){					
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please provide your Email Address.\n";
	}else if (! EmailFilter.test(txtEmailAddress)){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please check that your Email Address is in the correct format.\n";
	}	

	if(cboEnquiryType == ''){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please select a Enquiry Type.\n";
	}

	if((txtMessage == '') || (txtMessage == null)){
		Errors = true
		ErrorNumber++
		ErrorDesc = ErrorDesc + ErrorNumber + ". Please provide a brief Message.\n";
	}


	//Check if there is any Errors
	if(Errors == true){
		alert("Please review your application and fix any errors that have been identified.");
		alert(ErrorDesc);
		document.getElementById('errDesc').innerHTML = ErrorDesc;
	}else{
		//Check if action should be post
		if(Action == true){
			alert("Move to next Page.");
			//document.LoanApplication.submit();
		}
	}
}

function chk_res_length(ResLengthID){
	var ResLength = document.getElementById(ResLengthID).value;
	var RowID;

	if(ResLengthID == "cboResLength"){
		RowID = "App1PrevRes";
	}else{
		RowID = "App1PrevRes";
	}
	
	if(ResLength == "" || ResLength == "More than 3 Years"){
		HideRow(RowID);
	}else{
		ShowRow(RowID);
	}	
}


function chk_emp_status(EmpStatusID,RowID){
	var EmpStatus = document.getElementById(EmpStatusID).value;

	if(EmpStatus == "" || EmpStatus == "Unemployed" || EmpStatus == "Retired" || EmpStatus == "Pension"){
		HideRow(RowID);
	}else{
		ShowRow(RowID);
	}	
}

function CalculateAssets () {
	// Value Fields
	var txtOwnerPropertyValue = parseFloat(document.getElementById("4a_txtOwnerPropertyValue").value);
	var txtProperty1Value = parseFloat(document.getElementById("4a_txtProperty1Value").value);
	var txtProperty2Value = parseFloat(document.getElementById("4a_txtProperty2Value").value);
	var txtSuperValue = parseFloat(document.getElementById("4a_txtSuperValue").value);
	var txtSharesValue = parseFloat(document.getElementById("4a_txtSharesValue").value);
	var txtSaving1Value = parseFloat(document.getElementById("4a_txtSaving1Value").value);
	var txtSaving2Value = parseFloat(document.getElementById("4a_txtSaving2Value").value);
	var txtAsset1Value = parseFloat(document.getElementById("4a_txtAsset1Value").value);
	var txtAsset2Value = parseFloat(document.getElementById("4a_txtAsset2Value").value);
	var txtVehicle1Value = parseFloat(document.getElementById("4a_txtVehicle1Value").value);
	var txtVehicle2Value = parseFloat(document.getElementById("4a_txtVehicle2Value").value);
	var myAssetsValue = new Array(txtOwnerPropertyValue,txtProperty1Value,txtProperty2Value,txtSuperValue,txtSharesValue,txtSaving1Value,txtSaving2Value,txtAsset1Value,txtAsset2Value,txtVehicle1Value,txtVehicle2Value)
	
	// Total Fields
	var txtTotalValue = 0;
	var x;
	
	for (x in myAssetsValue)
	{
		if(! isNaN(myAssetsValue[x])){
			txtTotalValue = txtTotalValue + myAssetsValue[x];
		}
	}

	// Set Total Fields
	document.getElementById("4a_txtTotalValue").value = txtTotalValue.toFixed(2);

}

function CalculateLiabBal () {
	// Balance Fields
	var txtOwnerPropertyBal = parseFloat(document.getElementById("4b_txtOwnerPropertyBal").value);
	var txtProperty1Bal = parseFloat(document.getElementById("4b_txtProperty1Bal").value);
	var txtProperty2Bal = parseFloat(document.getElementById("4b_txtProperty2Bal").value);
	var txtPersonal1Bal = parseFloat(document.getElementById("4b_txtPersonal1Bal").value);
	var txtPersonal2Bal = parseFloat(document.getElementById("4b_txtPersonal2Bal").value);
	var txtCreditCardBal = parseFloat(document.getElementById("4b_txtCreditCardBal").value);
	var txtHecsBal = parseFloat(document.getElementById("4b_txtHecsBal").value);
	var txtOtherBal = parseFloat(document.getElementById("4b_txtOtherBal").value);
	var myLibBal = new Array(txtOwnerPropertyBal,txtProperty1Bal,txtProperty2Bal,txtPersonal1Bal,txtPersonal2Bal,txtCreditCardBal,txtHecsBal,txtOtherBal)
	
	// Total Fields
	var txtTotalBal = 0;
	var x;
	
	for (x in myLibBal)
	{
		if(! isNaN(myLibBal[x])){
			txtTotalBal = txtTotalBal + myLibBal[x];
		}
	}

	// Set Total Fields
	document.getElementById("4b_txtTotalBal").value = txtTotalBal.toFixed(2);

}

function CalculateLiabRep () {
	// Repayment Fields
	var txtOwnerPropertyRep = parseFloat(document.getElementById("4b_txtOwnerPropertyRep").value);
	var txtProperty1Rep = parseFloat(document.getElementById("4b_txtProperty1Rep").value);
	var txtProperty2Rep = parseFloat(document.getElementById("4b_txtProperty2Rep").value);
	var txtPersonal1Rep = parseFloat(document.getElementById("4b_txtPersonal1Rep").value);
	var txtPersonal2Rep = parseFloat(document.getElementById("4b_txtPersonal2Rep").value);
	var txtCreditCardRep = parseFloat(document.getElementById("4b_txtCreditCardRep").value);
	var txtHecsRep = parseFloat(document.getElementById("4b_txtHecsRep").value);
	var txtRentRep = parseFloat(document.getElementById("4b_txtRentRep").value);
	var txtChildRep = parseFloat(document.getElementById("4b_txtChildRep").value);
	var txtOtherRep = parseFloat(document.getElementById("4b_txtOtherRep").value);	
	var myLiabRep = new Array(txtOwnerPropertyRep,txtProperty1Rep,txtProperty2Rep,txtPersonal1Rep,txtPersonal2Rep,txtCreditCardRep,txtHecsRep,txtRentRep,txtChildRep,txtOtherRep)
	
	// Total Fields
	var txtTotalRep = 0;
	var x;
	
	for (x in myLiabRep)
	{
		if(! isNaN(myLiabRep[x])){
			txtTotalRep = txtTotalRep + myLiabRep[x];
		}
	}

	// Set Total Fields
	document.getElementById("4b_txtTotalRep").value = txtTotalRep.toFixed(2);

}

function CalculateLiabCred () {
	// Credit Fields
	var txtOwnerPropertyCred = parseFloat(document.getElementById("4b_txtOwnerPropertyCred").value);
	var txtProperty1Cred = parseFloat(document.getElementById("4b_txtProperty1Cred").value);
	var txtProperty2Cred = parseFloat(document.getElementById("4b_txtProperty2Cred").value);
	var txtPersonal1Cred = parseFloat(document.getElementById("4b_txtPersonal1Cred").value);
	var txtPersonal2Cred = parseFloat(document.getElementById("4b_txtPersonal2Cred").value);
	var txtCreditCardCred = parseFloat(document.getElementById("4b_txtCreditCardCred").value);
	var txtOtherCred = parseFloat(document.getElementById("4b_txtOtherCred").value);	
	var myLiabCred = new Array(txtOwnerPropertyCred,txtProperty1Cred,txtProperty2Cred,txtPersonal1Cred,txtPersonal2Cred,txtCreditCardCred,txtOtherCred)
	
	// Total Fields
	var txtTotalCred = 0;
	var x;
	
	for (x in myLiabCred)
	{
		if(! isNaN(myLiabCred[x])){
			txtTotalCred = txtTotalCred + myLiabCred[x];
		}
	}

	// Set Total Fields
	document.getElementById("4b_txtTotalCred").value = txtTotalCred.toFixed(2);

}

function CalculateAssetsInc () {
	// Income Fields
	var txtProperty1inc = parseFloat(document.getElementById("4a_txtProperty1inc").value);
	var txtProperty2inc = parseFloat(document.getElementById("4a_txtProperty2inc").value);
	var txtSuperInc = parseFloat(document.getElementById("4a_txtSuperInc").value);
	var txtSharesInc = parseFloat(document.getElementById("4a_txtSharesInc").value);
	var txtSaving1Inc = parseFloat(document.getElementById("4a_txtSaving1Inc").value);
	var txtSaving2Inc = parseFloat(document.getElementById("4a_txtSaving2Inc").value);

	var myAssetsInc = new Array(txtProperty1inc,txtProperty2inc,txtSuperInc,txtSharesInc,txtSaving1Inc,txtSaving2Inc)
	
	// Total Fields
	var txtTotalIncome = 0;
	var y;
	
	for (y in myAssetsInc)
	{
		if(! isNaN(myAssetsInc[y])){
			txtTotalIncome = txtTotalIncome + myAssetsInc[y];
		}
	}

	// Set Total Fields
	document.getElementById("4a_txtTotalIncome").value = txtTotalIncome.toFixed(2);

}

function ValidateDeclaration(){
	var chkDeclaration = document.getElementById("chkDeclaration").checked;
			
	if(chkDeclaration != true){
		alert("Please make sure you have confirmed, you have read the Privacy Statement and the Comparison Rate Schedule.");
		return false;
	}
	
	return true;
}

function GoBackForm(BackPageSRC){

	document.LoanApplication.action = BackPageSRC;
	document.LoanApplication.submit();
}

function ValidateForm(ActivePage,Action, Validate){
	var EmailFilter  = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;	
	var Errors = false;

	//check if we have to validate yet
	if(Validate == true){


		//Start Applicant 1
		if(ActivePage == "step-1a"){
			var cboAccount = document.getElementById("1a_cboAccount").value;
			var cboLead = document.getElementById("1a_cboLead").value;
			var txtMemberNumber = document.getElementById("1a_txtMemberNumber").value;
			var cboTitle = document.getElementById("1a_cboTitle").value;
			var txtFirstName = document.getElementById("1a_txtFirstName").value;
			var txtMiddleName = document.getElementById("1a_txtMiddleName").value;
			var txtLastname = document.getElementById("1a_txtLastname").value;
			var cboGender = document.getElementById("1a_cboGender").value;
			var txtDOB = document.getElementById("1a_txtDOB").value;
			var txtDayPhone = document.getElementById("1a_txtDayPhone").value;
			var txtEveningPhone = document.getElementById("1a_txtEveningPhone").value;
			var txtMobile = document.getElementById("1a_txtMobile").value;
			var txtEmail = document.getElementById("1a_txtEmail").value;
			var txtConfirmEmail = document.getElementById("1a_txtConfirmEmail").value;
			var txtDriversLicence = document.getElementById("1a_txtDriversLicence").value;
			var cboDriversState = document.getElementById("1a_cboDriversState").value;
			var txtDriversExpiry = document.getElementById("1a_txtDriversExpiry").value;
			var optOtherNames = document.getElementsByName('1a_optOtherNames');
			var txtOtherNames = document.getElementById("1a_txtOtherNames").value;
			var txtDependants = document.getElementById("1a_txtDependants").value;
			var optBankrupt = document.getElementsByName('1a_optBankrupt');
			var optBenifits = document.getElementsByName('1a_optBenifits');
			var optAustralian = document.getElementsByName('1a_optAustralian');
	
			if(cboAccount == ''){
				Errors = true
				ShowRow("eAccountType");
			}else{
				HideRow("eAccountType");
			}
	
			if(getRadioCheckedValue(optBankrupt) == ''){
				Errors = true;
				ShowRow("eBankrupt");
			}else{
				HideRow("eBankrupt");
			}
			
			if(getRadioCheckedValue(optBenifits) == ''){
				Errors = true;
				ShowRow("eBenifits");
			}else{
				HideRow("eBenifits");
			}
			
			if(getRadioCheckedValue(optAustralian) == ''){
				Errors = true;
				ShowRow("eAustralian");
			}else{
				HideRow("eAustralian");
			}	
			
			if(cboLead == ''){
				Errors = true
				ShowRow("eLead");
			}else{
				HideRow("eLead");
			}
			
			if(cboTitle == ''){
				Errors = true
				ShowRow("eTitle");
			}else{
				HideRow("eTitle");
			}
			
			if((txtFirstName == '') || (txtFirstName == null)){
				Errors = true
				ShowRow("eFirstName");
			}else{
				HideRow("eFirstName");
			}
			
			if((txtLastname == '') || (txtLastname == null)){					
				Errors = true
				ShowRow("eLastName");
			}else{
				HideRow("eLastName");
			}
			
			if(cboGender == ''){
				Errors = true
				ShowRow("eGender");
			}else{
				HideRow("eGender");
			}
			
			if((txtDOB == '') || (txtDOB == null)){					
				Errors = true
				ShowRow("eDOB");
			}else{
				HideRow("eDOB");
			}
			
			if((txtDayPhone == '') || (txtDayPhone == null)){
				Errors = true
				ShowRow("eDayPhone");
			}else{
				HideRow("eDayPhone");
			}
			
			if((txtEmail == '') || (txtEmail == null)){					
				Errors = true
				ShowRow("eEmail");
			}else if (! EmailFilter.test(txtEmail)){
				Errors = true
				HideRow("eEmail");
				ShowRow("eEmailF");
			}else if(txtEmail != txtConfirmEmail){
				Errors = true
				HideRow("eEmail");
				HideRow("eEmailF");
				ShowRow("eConfirmEmail");
			}else{
				HideRow("eEmail");
				HideRow("eEmailF");
				HideRow("eConfirmEmail");
			}	
		
			if((getRadioCheckedValue(optOtherNames) == '') || (getRadioCheckedValue(optOtherNames) == null)){
				Errors = true
				ShowRow("eOtherNames");
			}else if((getRadioCheckedValue(optOtherNames) == 'Yes')){
				ShowRow("App1OtherName");
			}else if((getRadioCheckedValue(optOtherNames) == 'Yes') && (txtOtherNames == '') || (txtOtherNames == null) ){
				Errors = true
				ShowRow("eOtherNamesText");
				ShowRow("App1OtherName");
			}else{
				HideRow("eOtherNames");
				HideRow("eOtherNamesText");			
			}
		
			if((txtDependants == '') || (txtDependants == null)){
				Errors = true
				ShowRow("eDependants");
			}else{
				HideRow("eDependants");
			}
		} //End Applicant 1
		
	
		//Start Applicant 1
		if(ActivePage == "step-1b"){
	
			var txtResAddr = document.getElementById("1b_txtResAddr").value;
			var txtResSuburb = document.getElementById("1b_txtResSuburb").value;
			var cboResState = document.getElementById("1b_cboResState").value;
			var txtResPostcode = document.getElementById("1b_txtResPostcode").value;
			var cboResStatus = document.getElementById("1b_cboResStatus").value;
			var cboResLength = document.getElementById("1b_cboResLength").value;
			var txtPrevResAddr = document.getElementById("1b_txtPrevResAddr").value;
			var txtPrevResSuburb = document.getElementById("1b_txtPrevResSuburb").value;
			var cboPrevResState = document.getElementById("1b_cboPrevResState").value;
			var txtPrevResPostcode = document.getElementById("1b_txtPrevResPostcode").value;
			var optMailing = document.getElementsByName('1b_optMailing');
			var txtMailAddr = document.getElementById("1b_txtMailAddr").value;
			var txtMailSuburb = document.getElementById("1b_txtMailSuburb").value;
			var cboMailState = document.getElementById("1b_cboMailState").value;
			var txtMailPostcode = document.getElementById("1b_txtMailPostcode").value;
			var txtPrevResCountry = document.getElementById("1b_txtPrevResCountry").value;		
			var txtPrevResYears = document.getElementById("1b_txtPrevResYears").value;
			var txtPrevResMonths = document.getElementById("1b_txtPrevResMonths").value;
			
	
			if((txtResAddr == '') || (txtResAddr == null)){
				Errors = true;
				ShowRow("eResAddr");
			}else{
				HideRow("eResAddr");
			}	
	
			if((txtResSuburb == '') || (txtResSuburb == null)){
				Errors = true;
				ShowRow("eResSuburb");
			}else{
				HideRow("eResSuburb");
			}	
	
			if(cboResState == ''){
				Errors = true;
				ShowRow("eResState");
			}else{
				HideRow("eResState");
			}	
	
			if((txtResPostcode == '') || (txtResPostcode == null)){
				Errors = true;
				ShowRow("eResPostCode");
			}else if(isNaN(txtResPostcode)){
				Errors = true;
				HideRow("eResPostCode");
				ShowRow("eResPostCodeV");
			}else if(txtResPostcode.length < 4){
				Errors = true;
				HideRow("eResPostCode");
				HideRow("eResPostCodeV");
				ShowRow("eResPostCodeL");
			}else{
				HideRow("eResPostCode");
				HideRow("eResPostCodeV");
				HideRow("eResPostCodeL");
			}
	
			if(cboResStatus == ''){
				Errors = true;
				ShowRow("eResStatus");
			}else{
				HideRow("eResStatus");
			}	
	
			if(cboResLength == ''){
				Errors = true;
				ShowRow("eResLength");
			}else if(cboResLength != '' && cboResLength != 'More than 3 Years'){
				HideRow("eResLength");
	
				ShowRow("App1PrevRes");
	
				if((txtPrevResAddr == '') || (txtPrevResAddr == null)){
					Errors = true;
					ShowRow("ePrevResAddr");
				}else{
					HideRow("ePrevResAddr");
				}	
		
				if((txtPrevResSuburb == '') || (txtPrevResSuburb == null)){
					Errors = true;
					ShowRow("ePrevResSuburb");
				}else{
					HideRow("ePrevResSuburb");
				}	
		
				if(cboPrevResState == ''){
					Errors = true;
					ShowRow("ePrevResState");
				}else{
					HideRow("ePrevResState");
				}	
		
				if((txtPrevResPostcode == '') || (txtPrevResPostcode == null)){
					Errors = true;
					ShowRow("ePrevResPostcode");
				}else if(isNaN(txtPrevResPostcode)){
					Errors = true;
					HideRow("ePrevResPostcode");
					ShowRow("ePrevResPostCodeV");
				}else if(txtPrevResPostcode.length < 4){
					Errors = true;
					HideRow("ePrevResPostcode");
					HideRow("ePrevResPostCodeV");
					ShowRow("ePrevResPostCodeL");
				}else{
					HideRow("ePrevResPostcode");
					HideRow("ePrevResPostCodeV");
					HideRow("ePrevResPostCodeL");
				}		
	
				if((txtPrevResCountry == '') || (txtPrevResCountry == null)){
					Errors = true;
					ShowRow("ePrevResCountry");
				}else{
					HideRow("ePrevResCountry");
				}	

				if(((txtPrevResYears == '') || (txtPrevResYears == null)) && ((txtPrevResMonths == '') || (txtPrevResMonths == null))){
					Errors = true;
					ShowRow("ePrevResLength");
				}else if(isNaN(txtPrevResYears) || isNaN(txtPrevResMonths)){
					Errors = true;
					HideRow("ePrevResLength");
					ShowRow("ePrevResLengthV");
				}else{
					HideRow("ePrevResLength");
					HideRow("ePrevResLengthV");
				}
				
			}else if(cboResLength == 'More than 3 Years'){
				HideRow("eResLength");
			}
	
			if(getRadioCheckedValue(optMailing) == ''){
				Errors = true;
				ShowRow("eOptMailing");
			}else if(getRadioCheckedValue(optMailing) == 'no'){
				HideRow("eOptMailing");
	
				ShowRow("App1Mail");
	
				if((txtMailAddr == '') || (txtMailAddr == null)){
					Errors = true;
					ShowRow("eMailAddr");
				}else{
					HideRow("eMailAddr");
				}	
		
				if((txtMailSuburb == '') || (txtMailSuburb == null)){
					Errors = true;
					ShowRow("eMailSuburb");
				}else{
					HideRow("eMailSuburb");
				}	
		
				if(cboMailState == ''){
					Errors = true;
					ShowRow("eMailState");
				}else{
					HideRow("eMailState");
				}	
		
				if((txtMailPostcode == '') || (txtMailPostcode == null)){
					Errors = true;
					ShowRow("eMailPostcode");
				}else if(isNaN(txtMailPostcode)){
					Errors = true;
					HideRow("eMailPostcode");
					ShowRow("eMailPostCodeV");
				}else if(txtMailPostcode.length < 4){
					Errors = true;
					HideRow("eMailPostcode");
					HideRow("eMailPostCodeV");
					ShowRow("eMailPostCodeL");
				}else{
					HideRow("eMailPostcode");
					HideRow("eMailPostCodeV");
					HideRow("eMailPostCodeL");
				}		
				
			}else{
				HideRow("eOptMailing");
			}
		}
	
		//Start Applicant 2
		if(ActivePage == "step-1c"){
			var cboLead2 = document.getElementById("1c_cboLead2").value;
			var txtMemberNumber2 = document.getElementById("1c_txtMemberNumber2").value;
			var cboTitle2 = document.getElementById("1c_cboTitle2").value;
			var txtFirstName2 = document.getElementById("1c_txtFirstName2").value;
			var txtMiddleName2 = document.getElementById("1c_txtMiddleName2").value;
			var txtLastname2 = document.getElementById("1c_txtLastname2").value;
			var cboGender2 = document.getElementById("1c_cboGender2").value;
			var txtDOB2 = (document.forms['LoanApplication'].elements['1c_txtDOB2'].value);
			var txtDayPhone2 = document.getElementById("1c_txtDayPhone2").value;
			var txtEveningPhone2 = document.getElementById("1c_txtEveningPhone2").value;
			var txtMobile2 = document.getElementById("1c_txtMobile2").value;
			var txtEmail2 = document.getElementById("1c_txtEmail2").value;
			var txtConfirmEmail2 = document.getElementById("1c_txtConfirmEmail2").value;
			var txtDriversLicence2 = document.getElementById("1c_txtDriversLicence2").value;
			var cboDriversState2 = document.getElementById("1c_cboDriversState2").value;
			var txtDriversExpiry2 = (document.forms['LoanApplication'].elements['1c_txtDriversExpiry2'].value);
			var optOtherNames2 = (document.forms['LoanApplication'].elements['1c_optOtherNames2']);
			var txtOtherNames2 = document.getElementById("1c_txtOtherNames2").value;
	
			if(cboLead2 == ''){
				Errors = true
				ShowRow("eLead");
			}else{
				HideRow("eLead");
			}
			
			if(cboTitle2 == ''){
				Errors = true
				ShowRow("eTitle");
			}else{
				HideRow("eTitle");
			}
			
			if((txtFirstName2 == '') || (txtFirstName2 == null)){
				Errors = true
				ShowRow("eFirstName");
			}else{
				HideRow("eFirstName");
			}
			
			if((txtLastname2 == '') || (txtLastname2 == null)){					
				Errors = true
				ShowRow("eLastName");
			}else{
				HideRow("eLastName");
			}
			
			if(cboGender2 == ''){
				Errors = true
				ShowRow("eGender");
			}else{
				HideRow("eGender");
			}
			
			if((txtDOB2 == '') || (txtDOB2 == null)){					
				Errors = true
				ShowRow("eDOB");
			}else{
				HideRow("eDOB");
			}
			
			if((txtDayPhone2 == '') || (txtDayPhone2 == null)){
				Errors = true
				ShowRow("eDayPhone");
			}else{
				HideRow("eDayPhone");
			}
			
			if((txtEmail2 == '') || (txtEmail2 == null)){					
				Errors = true
				ShowRow("eEmail");
			}else if (! EmailFilter.test(txtEmail2)){
				Errors = true
				HideRow("eEmail");
				ShowRow("eEmailF");
			}else if(txtEmail2 != txtConfirmEmail2){
				Errors = true
				HideRow("eEmail");
				HideRow("eEmailF");
				ShowRow("eConfirmEmail");
			}else{
				HideRow("eEmail");
				HideRow("eEmailF");
				HideRow("eConfirmEmail");
			}	
		
			if((getRadioCheckedValue(optOtherNames2) == '') || (getRadioCheckedValue(optOtherNames2) == null)){
				Errors = true
				ShowRow("eOtherNames");
			}else if((getRadioCheckedValue(optOtherNames2) == 'Yes')){
				ShowRow("App2OtherName");
			}else if((getRadioCheckedValue(optOtherNames2) == 'Yes') && (txtOtherNames2 == '') || (txtOtherNames2 == null) ){
				Errors = true
				ShowRow("eOtherNamesText");
				ShowRow("App2OtherName");
			}else{
				HideRow("eOtherNames");
				HideRow("eOtherNamesText");
			}

		} //End Applicant 2
	
		//Start Applicant 2
		if(ActivePage == "step-1d"){
	
			var txtResAddr2 = document.getElementById("1d_txtResAddr2").value;
			var txtResSuburb2 = document.getElementById("1d_txtResSuburb2").value;
			var cboResState2 = document.getElementById("1d_cboResState2").value;
			var txtResPostcode2 = document.getElementById("1d_txtResPostcode2").value;
			var cboResStatus2 = document.getElementById("1d_cboResStatus2").value;
			var cboResLength2 = document.getElementById("1d_cboResLength2").value;
			var txtPrevResAddr2 = document.getElementById("1d_txtPrevResAddr2").value;
			var txtPrevResSuburb2 = document.getElementById("1d_txtPrevResSuburb2").value;
			var cboPrevResState2 = document.getElementById("1d_cboPrevResState2").value;
			var txtPrevResPostcode2 = document.getElementById("1d_txtPrevResPostcode2").value;
			var optMailing2 = document.getElementsByName('1d_optMailing2');
			var txtMailAddr2 = document.getElementById("1d_txtMailAddr2").value;
			var txtMailSuburb2 = document.getElementById("1d_txtMailSuburb2").value;
			var cboMailState2 = document.getElementById("1d_cboMailState2").value;
			var txtMailPostcode2 = document.getElementById("1d_txtMailPostcode2").value;
			var txtPrevResCountry2 = document.getElementById("1d_txtPrevResCountry2").value;		
			var txtPrevResYears2 = document.getElementById("1d_txtPrevResYears2").value;
			var txtPrevResMonths2 = document.getElementById("1d_txtPrevResMonths2").value;
	
			if((txtResAddr2 == '') || (txtResAddr2 == null)){
				Errors = true;
				ShowRow("eResAddr");
			}else{
				HideRow("eResAddr");
			}	
	
			if((txtResSuburb2 == '') || (txtResSuburb2 == null)){
				Errors = true;
				ShowRow("eResSuburb");
			}else{
				HideRow("eResSuburb");
			}	
	
			if(cboResState2 == ''){
				Errors = true;
				ShowRow("eResState");
			}else{
				HideRow("eResState");
			}	
	
			if((txtResPostcode2 == '') || (txtResPostcode2 == null)){
				Errors = true;
				ShowRow("eResPostCode");
			}else if(isNaN(txtResPostcode2)){
				Errors = true;
				HideRow("eResPostCode");
				ShowRow("eResPostCodeV");
			}else if(txtResPostcode2.length < 4){
				Errors = true;
				HideRow("eResPostCode");
				HideRow("eResPostCodeV");
				ShowRow("eResPostCodeL");
			}else{
				HideRow("eResPostCode");
				HideRow("eResPostCodeV");
				HideRow("eResPostCodeL");
			}
	
			if(cboResStatus2 == ''){
				Errors = true;
				ShowRow("eResStatus");
			}else{
				HideRow("eResStatus");
			}	

			if(cboResLength2 == ''){
				Errors = true;
				ShowRow("eResLength");
			}else if(cboResLength2 != '' && cboResLength2 != 'More than 3 Years'){
				HideRow("eResLength");
	
				ShowRow("App1PrevRes");
	
				if((txtPrevResAddr2 == '') || (txtPrevResAddr2 == null)){
					Errors = true;
					ShowRow("ePrevResAddr");
				}else{
					HideRow("ePrevResAddr");
				}	
		
				if((txtPrevResSuburb2 == '') || (txtPrevResSuburb2 == null)){
					Errors = true;
					ShowRow("ePrevResSuburb");
				}else{
					HideRow("ePrevResSuburb");
				}	
		
				if(cboPrevResState2 == ''){
					Errors = true;
					ShowRow("ePrevResState");
				}else{
					HideRow("ePrevResState");
				}	
		
				if((txtPrevResPostcode2 == '') || (txtPrevResPostcode2 == null)){
					Errors = true;
					ShowRow("ePrevResPostcode");
				}else if(isNaN(txtPrevResPostcode2)){
					Errors = true;
					HideRow("ePrevResPostcode");
					ShowRow("ePrevResPostCodeV");
				}else if(txtPrevResPostcode2.length < 4){
					Errors = true;
					HideRow("ePrevResPostcode");
					HideRow("ePrevResPostCodeV");
					ShowRow("ePrevResPostCodeL");
				}else{
					HideRow("ePrevResPostcode");
					HideRow("ePrevResPostCodeV");
					HideRow("ePrevResPostCodeL");
				}		
	
				if((txtPrevResCountry2 == '') || (txtPrevResCountry2 == null)){
					Errors = true;
					ShowRow("ePrevResCountry");
				}else{
					HideRow("ePrevResCountry");
				}	

				if(((txtPrevResYears2 == '') || (txtPrevResYears2 == null)) && ((txtPrevResMonths2 == '') || (txtPrevResMonths2 == null))){
					Errors = true;
					ShowRow("ePrevResLength");
				}else if(isNaN(txtPrevResYears2) || isNaN(txtPrevResMonths2)){
					Errors = true;
					HideRow("ePrevResLength");
					ShowRow("ePrevResLengthV");
				}else{
					HideRow("ePrevResLength");
					HideRow("ePrevResLengthV");
				}
				
			}else if(cboResLength2 == 'More than 3 Years'){
				HideRow("eResLength");
			}
	
			if(getRadioCheckedValue(optMailing2) == ''){
				Errors = true;
				ShowRow("eOptMailing");
			}else if(getRadioCheckedValue(optMailing2) == 'no'){
				HideRow("eOptMailing");
	
				ShowRow("App2Mail");
	
				if((txtMailAddr2 == '') || (txtMailAddr2 == null)){
					Errors = true;
					ShowRow("eMailAddr");
				}else{
					HideRow("eMailAddr");
				}	
		
				if((txtMailSuburb2 == '') || (txtMailSuburb2 == null)){
					Errors = true;
					ShowRow("eMailSuburb");
				}else{
					HideRow("eMailSuburb");
				}	
		
				if(cboMailState2 == ''){
					Errors = true;
					ShowRow("eMailState");
				}else{
					HideRow("eMailState");
				}	
		
				if((txtMailPostcode2 == '') || (txtMailPostcode2 == null)){
					Errors = true;
					ShowRow("eMailPostcode");
				}else if(isNaN(txtMailPostcode2)){
					Errors = true;
					HideRow("eMailPostcode");
					ShowRow("eMailPostCodeV");
				}else if(txtMailPostcode2.length < 4){
					Errors = true;
					HideRow("eMailPostcode");
					HideRow("eMailPostCodeV");
					ShowRow("eMailPostCodeL");
				}else{
					HideRow("eMailPostcode");
					HideRow("eMailPostCodeV");
					HideRow("eMailPostCodeL");
				}		
	
			}else{
				HideRow("eOptMailing");
			}
		} //End Applicant 2
	
		//Start Your Loan Details
		if(ActivePage == "step-2"){
			var txtBorrowAmt = document.getElementById("2_txtBorrowAmt").value;
			var cboLoanTerm = document.getElementById("2_cboLoanTerm").value;
			var cboRepayment = document.getElementById("2_cboRepayment").value;
		//	var optLivIn = (document.forms['LoanApplication'].elements['2_optLivIn']);
		
			var optLivIn = document.getElementsByName('2_optLivIn');
		
			var optLoanFor = document.getElementsByName('2_optLoanFor');
			var txtEstimateValue = document.getElementById("2_txtEstimateValue").value;
			var txtContribute = document.getElementById("2_txtContribute").value;
			var optFirstHome = document.getElementsByName('2_optFirstHome');


			if((txtBorrowAmt == '') || (txtBorrowAmt == null)){
				Errors = true;
				ShowRow("eBorrowAmt");
			}else if(isNaN(txtBorrowAmt)){
				Errors = true;
				HideRow("eBorrowAmt");
				ShowRow("eBorrowAmtV");
			}else{
				HideRow("eBorrowAmt");
				HideRow("eBorrowAmtV");
			}		
	
			if(cboLoanTerm == ''){
				Errors = true;
				ShowRow("eLoanTerm");
			}else{
				HideRow("eLoanTerm");
			}	
			
			if(cboRepayment == ''){
				Errors = true;
				ShowRow("eRepayment");
			}else{
				HideRow("eRepayment");
			}			
	
			if(getRadioCheckedValue(optLivIn) == ''){
				Errors = true;
				ShowRow("eLivIn");
			}else{
				HideRow("eLivIn");
			}
	
			if(getRadioCheckedValue(optLoanFor) == ''){
				Errors = true;
				ShowRow("eLoanFor");
			}else{
				HideRow("eLoanFor");
			}
	
			if(isNaN(txtEstimateValue)){
				Errors = true;
				ShowRow("eEstimateValueV");
			}else{
				HideRow("eEstimateValueV");
			}		
			
			if(isNaN(txtContribute)){
				Errors = true;
				ShowRow("eContributeV");
			}else{
				HideRow("eContributeV");
			}		
	
			if(getRadioCheckedValue(optFirstHome) == ''){
				Errors = true;
				ShowRow("eFirstHome");
			}else{
				HideRow("eFirstHome");
			}
		}
		
		//Start Your Income Details
		if(ActivePage == "step-3a"){
			var txtNetMonthlyIncome = document.getElementById("3a_txtNetMonthlyIncome").value;
			var txtNetMonthlyIncomeRental = document.getElementById("3a_txtNetMonthlyIncomeRental").value;
			var txtFamilyAllowance = document.getElementById("3a_txtFamilyAllowance").value;
	
			if(isNaN(txtNetMonthlyIncome)){
				Errors = true;
				HideRow("eNetMonthlyIncome");
				ShowRow("eNetMonthlyIncomeV");
			}else{
				HideRow("eNetMonthlyIncome");
				HideRow("eNetMonthlyIncomeV");
			}		
	
			if(isNaN(txtNetMonthlyIncomeRental)){
				Errors = true;
				HideRow("eNetMonthlyIncomeRental");
				ShowRow("eNetMonthlyIncomeRentalV");
			}else{
				HideRow("eNetMonthlyIncomeRental");
				HideRow("eNetMonthlyIncomeRentalV");
			}
		
			if(isNaN(txtFamilyAllowance)){
				Errors = true;
				HideRow("eFamilyAllowance");
				ShowRow("eFamilyAllowanceV");
			}else{
				HideRow("eFamilyAllowance");
				HideRow("eFamilyAllowanceV");
			}	
	
		}
	
		//Start Applicant 1 - Your Income Details
		if(ActivePage == "step-3b"){
			var cboEmpType = document.getElementById("3b_cboEmpType").value;
			var cboEmpStatus = document.getElementById("3b_cboEmpStatus").value;
			var opt2ndEmp = document.getElementsByName('3b_opt2ndEmp');
			
			var txtEmpYears = document.getElementById("3b_txtEmpYears").value;
			var txtEmpMonths = document.getElementById("3b_txtEmpMonths").value;
			var txtOccupation = document.getElementById("3b_txtOccupation").value;
			var txtEmp = document.getElementById("3b_txtEmp").value;
			var txtEmpPhone = document.getElementById("3b_txtEmpPhone").value;
			var txtEmpAddr = document.getElementById("3b_txtEmpAddr").value;
			var txtEmpSuburb = document.getElementById("3b_txtEmpSuburb").value;
			var cboEmpState = document.getElementById("3b_cboEmpState").value;
			var txtEmpPostcode = document.getElementById("3b_txtEmpPostcode").value;
			
			var cbo2ndEmpType = document.getElementById("3b_cbo2ndEmpType").value;
			var cbo2ndEmpStatus = document.getElementById("3b_cbo2ndEmpStatus").value;
			var txt2ndEmpYears = document.getElementById("3b_txt2ndEmpYears").value;
			var txt2ndEmpMonths = document.getElementById("3b_txt2ndEmpMonths").value;
			var txt2ndOccupation = document.getElementById("3b_txt2ndOccupation").value;
			var txt2ndEmpName = document.getElementById("3b_txt2ndEmpName").value;
			var txt2ndEmpPhone = document.getElementById("3b_txt2ndEmpPhone").value;
			var txt2ndEmpAddr = document.getElementById("3b_txt2ndEmpAddr").value;
			var txt2ndEmpSuburb = document.getElementById("3b_txt2ndEmpSuburb").value;
			var cbo2ndEmpState = document.getElementById("3b_cbo2ndEmpState").value;
			var txt2ndEmpPostcode = document.getElementById("3b_txt2ndEmpPostcode").value;
	
			var optPrevEmp = document.getElementsByName('3b_optPrevEmp');
			var cboPrevEmpType = document.getElementById("3b_cboPrevEmpType").value;
			var cboPrevEmpStatus = document.getElementById("3b_cboPrevEmpStatus").value;
			var txtPrevEmpYears = document.getElementById("3b_txtPrevEmpYears").value;
			var txtPrevEmpMonths = document.getElementById("3b_txtPrevEmpMonths").value;
			var txtPrevOccupation = document.getElementById("3b_txtPrevOccupation").value;
			var txtPrevEmpName = document.getElementById("3b_txtPrevEmpName").value;
			var txtPrevEmpPhone = document.getElementById("3b_txtPrevEmpPhone").value;
			
			if(cboEmpType == ''){
				Errors = true;
				ShowRow("eEmpType");
			}else{
				HideRow("eEmpType");
			}	
	
			if(cboEmpStatus == ''){
				Errors = true;
				ShowRow("eEmpStatus");
			}else if(cboEmpStatus != "" && cboEmpStatus != "Unemployed" && cboEmpStatus != "Retired" && cboEmpStatus != "Pension"){
				HideRow("eEmpStatus");
	
				ShowRow("App1Emp");
	
				if(getRadioCheckedValue(opt2ndEmp) == ''){
					Errors = true;
					ShowRow("e2ndEmp");
				}else{
					HideRow("e2ndEmp");
				}
	
				if(((txtEmpYears == '') || (txtEmpYears == null)) && ((txtEmpMonths == '') || (txtEmpMonths == null))){
					Errors = true;
					ShowRow("eEmpLength");
				}else if(isNaN(txtEmpYears) || isNaN(txtEmpMonths)){
					Errors = true;
					HideRow("eEmpLength");
					ShowRow("eEmpLengthV");
				}else{
					HideRow("eEmpLength");
					HideRow("eEmpLengthV");
				}
				
				if((txtOccupation == '') || (txtOccupation == null)){
					Errors = true;
					ShowRow("eOccupation");
				}else{
					HideRow("eOccupation");
				}
				
				if((txtEmp == '') || (txtEmp == null)){
					Errors = true;
					ShowRow("eEmp");
				}else{
					HideRow("eEmp");
				}
	
				if((txtEmpPhone == '') || (txtEmpPhone == null)){
					Errors = true;
					ShowRow("eEmpPhone");
				//}else if(isNaN(txtEmpPhone)){
				//	Errors = true;
				//	HideRow("eEmpPhone");
				//	ShowRow("eEmpPhoneV");
				}else{
					HideRow("eEmpPhone");
				//	HideRow("eEmpPhoneV");
				}
				
				if((txtEmpAddr == '') || (txtEmpAddr == null)){
					Errors = true;
					ShowRow("eEmpAddr");
				}else{
					HideRow("eEmpAddr");
				}	
		
				if((txtEmpSuburb == '') || (txtEmpSuburb == null)){
					Errors = true;
					ShowRow("eEmpSuburb");
				}else{
					HideRow("eEmpSuburb");
				}	
		
				if(cboEmpState == ''){
					Errors = true;
					ShowRow("eEmpState");
				}else{
					HideRow("eEmpState");
				}	
		
				if((txtEmpPostcode == '') || (txtEmpPostcode == null)){
					Errors = true;
					ShowRow("eEmpPostcode");
				}else if(isNaN(txtEmpPostcode)){
					Errors = true;
					HideRow("eEmpPostcode");
					ShowRow("eEmpPostcodeV");
				}else if(txtEmpPostcode.length < 4){
					Errors = true;
					HideRow("eEmpPostcode");
					HideRow("eEmpPostcodeV");
					ShowRow("eEmpPostcodeL");
				}else{
					HideRow("eEmpPostcode");
					HideRow("eEmpPostcodeV");
					HideRow("eEmpPostcodeL");
				}
			}else{
				HideRow("eEmpStatus");
			}
	
			//2nd job
			if(getRadioCheckedValue(opt2ndEmp) == 'yes'){
	
				ShowRow("App12ndEmp");
	
				if(((txt2ndEmpYears == '') || (txt2ndEmpYears == null)) && ((txt2ndEmpMonths == '') || (txt2ndEmpMonths == null))){
					Errors = true;
					ShowRow("e2ndEmpLength");
				}else if(isNaN(txt2ndEmpYears) || isNaN(txt2ndEmpMonths)){
					Errors = true;
					HideRow("e2ndEmpLength");
					ShowRow("e2ndEmpLengthV");
				}else{
					HideRow("e2ndEmpLength");
					HideRow("e2ndEmpLengthV");
				}
	
				if(cbo2ndEmpType == ''){
					Errors = true;
					ShowRow("e2ndEmpType");
				}else{
					HideRow("e2ndEmpType");
				}
	
				if(cbo2ndEmpStatus == ''){
					Errors = true;
					ShowRow("e2ndEmpStatus");
				}else if(cbo2ndEmpStatus != "" && cbo2ndEmpStatus != "Unemployed" && cbo2ndEmpStatus != "Retired" && cbo2ndEmpStatus != "Pension"){
					HideRow("e2ndEmpStatus");
		
					ShowRow("App12ndEmp");
					ShowRow("App12ndEmpDetails");
		
					if((txt2ndOccupation == '') || (txt2ndOccupation == null)){
						Errors = true;
						ShowRow("e2ndOccupation");
					}else{
						HideRow("e2ndOccupation");
					}
					
					if((txt2ndEmpName == '') || (txt2ndEmpName == null)){
						Errors = true;
						ShowRow("e2ndEmpName");
					}else{
						HideRow("e2ndEmpName");
					}
		
					if((txt2ndEmpPhone == '') || (txt2ndEmpPhone == null)){
						Errors = true;
						ShowRow("e2ndEmpPhone");
					//}else if(isNaN(txt2ndEmpPhone)){
					//	Errors = true;
					//	HideRow("e2ndEmpPhone");
					//	ShowRow("e2ndEmpPhoneV");
					}else{
						HideRow("e2ndEmpPhone");
					//	HideRow("e2ndEmpPhoneV");
					}
					
					if((txt2ndEmpAddr == '') || (txt2ndEmpAddr == null)){
						Errors = true;
						ShowRow("e2ndEmpAddr");
					}else{
						HideRow("e2ndEmpAddr");
					}	
			
					if((txt2ndEmpSuburb == '') || (txt2ndEmpSuburb == null)){
						Errors = true;
						ShowRow("e2ndEmpSuburb");
					}else{
						HideRow("e2ndEmpSuburb");
					}	
			
					if(cbo2ndEmpState == ''){
						Errors = true;
						ShowRow("e2ndEmpState");
					}else{
						HideRow("e2ndEmpState");
					}	
			
					if((txt2ndEmpPostcode == '') || (txt2ndEmpPostcode == null)){
						Errors = true;
						ShowRow("e2ndEmpPostcode");
					}else if(isNaN(txt2ndEmpPostcode)){
						Errors = true;
						HideRow("e2ndEmpPostcode");
						ShowRow("e2ndEmpPostcodeV");
					}else if(txt2ndEmpPostcode.length < 4){
						Errors = true;
						HideRow("e2ndEmpPostcode");
						HideRow("e2ndEmpPostcodeV");
						ShowRow("e2ndEmpPostcodeL");
					}else{
						HideRow("e2ndEmpPostcode");
						HideRow("e2ndEmpPostcodeV");
						HideRow("e2ndEmpPostcodeL");
					}
					
				}else{
					HideRow("e2ndEmpStatus");
				}
			}
	
			//Previous Employer
			if(getRadioCheckedValue(optPrevEmp) == 'yes'){
	
				ShowRow("App1PrevEmp");
	
				if(((txtPrevEmpYears == '') || (txtPrevEmpYears == null)) && ((txtPrevEmpMonths == '') || (txtPrevEmpMonths == null))){
					Errors = true;
					ShowRow("ePrevEmpLength");
				}else if(isNaN(txtPrevEmpYears) || isNaN(txtPrevEmpMonths)){
					Errors = true;
					HideRow("ePrevEmpLength");
					ShowRow("ePrevEmpLengthV");
				}else{
					HideRow("ePrevEmpLength");
					HideRow("ePrevEmpLengthV");
				}
	
				if(cboPrevEmpType == ''){
					Errors = true;
					ShowRow("ePrevEmpType");
				}else{
					HideRow("ePrevEmpType");
				}
	
				if(cboPrevEmpStatus == ''){
					Errors = true;
					ShowRow("ePrevEmpStatus");
				}else if(cboPrevEmpStatus != "" && cboPrevEmpStatus != "Unemployed" && cboPrevEmpStatus != "Retired" && cboPrevEmpStatus != "Pension"){
					HideRow("ePrevEmpStatus");
		
					ShowRow("App1PrevEmp");
					ShowRow("App1PrevEmpDetails");
		
					if((txtPrevOccupation == '') || (txtPrevOccupation == null)){
						Errors = true;
						ShowRow("ePrevOccupation");
					}else{
						HideRow("ePrevOccupation");
					}
					
					if((txtPrevEmpName == '') || (txtPrevEmpName == null)){
						Errors = true;
						ShowRow("ePrevEmpName");
					}else{
						HideRow("ePrevEmpName");
					}
		
					if((txtPrevEmpPhone == '') || (txtPrevEmpPhone == null)){
						Errors = true;
						ShowRow("ePrevEmpPhone");
					//}else if(isNaN(txtPrevEmpPhone)){
					//	Errors = true;
					//	HideRow("ePrevEmpPhone");
					//	ShowRow("ePrevEmpPhoneV");
					}else{
						HideRow("ePrevEmpPhone");
					//	HideRow("ePrevEmpPhoneV");
					}
				}else{
					HideRow("ePrevEmpStatus");
				}
			}
		}
		//End Applicant 1 Your Income Details
	
		//Start Your Income Details
		if(ActivePage == "step-3c"){
			var txtNetMonthlyIncome2 = document.getElementById("3c_txtNetMonthlyIncome2").value;
			var txtNetMonthlyIncomeRental2 = document.getElementById("3c_txtNetMonthlyIncomeRental2").value;
			var txtFamilyAllowance2 = document.getElementById("3c_txtFamilyAllowance2").value;
	
			if(isNaN(txtNetMonthlyIncome2)){
				Errors = true;
				HideRow("eNetMonthlyIncome");
				ShowRow("eNetMonthlyIncomeV");
			}else{
				HideRow("eNetMonthlyIncome");
				HideRow("eNetMonthlyIncomeV");
			}		
	
			if(isNaN(txtNetMonthlyIncomeRental2)){
				Errors = true;
				HideRow("eNetMonthlyIncomeRental");
				ShowRow("eNetMonthlyIncomeRentalV");
			}else{
				HideRow("eNetMonthlyIncomeRental");
				HideRow("eNetMonthlyIncomeRentalV");
			}
		
			if(isNaN(txtFamilyAllowance2)){
				Errors = true;
				HideRow("eFamilyAllowance");
				ShowRow("eFamilyAllowanceV");
			}else{
				HideRow("eFamilyAllowance");
				HideRow("eFamilyAllowanceV");
			}	
	
		}
	
		//Start Applicant 2 - Your Income Details
		if(ActivePage == "step-3d"){
			var cboEmpType2 = document.getElementById("3d_cboEmpType2").value;
			var cboEmpStatus2 = document.getElementById("3d_cboEmpStatus2").value;
			var opt2ndEmp2 = document.getElementsByName('3d_opt2ndEmp2');
			
			var txtEmpYears2 = document.getElementById("3d_txtEmpYears2").value;
			var txtEmpMonths2 = document.getElementById("3d_txtEmpMonths2").value;
			var txtOccupation2 = document.getElementById("3d_txtOccupation2").value;
			var txtEmp2 = document.getElementById("3d_txtEmp2").value;
			var txtEmpPhone2 = document.getElementById("3d_txtEmpPhone2").value;
			var txtEmpAddr2 = document.getElementById("3d_txtEmpAddr2").value;
			var txtEmpSuburb2 = document.getElementById("3d_txtEmpSuburb2").value;
			var cboEmpState2 = document.getElementById("3d_cboEmpState2").value;
			var txtEmpPostcode2 = document.getElementById("3d_txtEmpPostcode2").value;
			
			var cbo2ndEmpType2 = document.getElementById("3d_cbo2ndEmpType2").value;
			var cbo2ndEmpStatus2 = document.getElementById("3d_cbo2ndEmpStatus2").value;
			var txt2ndEmpYears2 = document.getElementById("3d_txt2ndEmpYears2").value;
			var txt2ndEmpMonths2 = document.getElementById("3d_txt2ndEmpMonths2").value;
			var txt2ndOccupation2 = document.getElementById("3d_txt2ndOccupation2").value;
			var txt2ndEmpName2 = document.getElementById("3d_txt2ndEmpName2").value;
			var txt2ndEmpPhone2 = document.getElementById("3d_txt2ndEmpPhone2").value;
			var txt2ndEmpAddr2 = document.getElementById("3d_txt2ndEmpAddr2").value;
			var txt2ndEmpSuburb2 = document.getElementById("3d_txt2ndEmpSuburb2").value;
			var cbo2ndEmpState2 = document.getElementById("3d_cbo2ndEmpState2").value;
			var txt2ndEmpPostcode2 = document.getElementById("3d_txt2ndEmpPostcode2").value;

			var optPrevEmp2 = document.getElementsByName('3d_optPrevEmp2');
			var cboPrevEmpType2 = document.getElementById("3d_cboPrevEmpType2").value;
			var cboPrevEmpStatus2 = document.getElementById("3d_cboPrevEmpStatus2").value;
			var txtPrevEmpYears2 = document.getElementById("3d_txtPrevEmpYears2").value;
			var txtPrevEmpMonths2 = document.getElementById("3d_txtPrevEmpMonths2").value;
			var txtPrevOccupation2 = document.getElementById("3d_txtPrevOccupation2").value;
			var txtPrevEmpName2 = document.getElementById("3d_txtPrevEmpName2").value;
			var txtPrevEmpPhone2 = document.getElementById("3d_txtPrevEmpPhone2").value;

			if(cboEmpType2 == ''){
				Errors = true;
				ShowRow("eEmpType");
			}else{
				HideRow("eEmpType");
			}	
	
			if(cboEmpStatus2 == ''){
				Errors = true;
				ShowRow("eEmpStatus");
			}else if(cboEmpStatus2 != "" && cboEmpStatus2 != "Unemployed" && cboEmpStatus2 != "Retired" && cboEmpStatus2 != "Pension"){
				HideRow("eEmpStatus");
	
				ShowRow("App2Emp");
	
				if(getRadioCheckedValue(opt2ndEmp2) == ''){
					Errors = true;
					ShowRow("e2ndEmp");
				}else{
					HideRow("e2ndEmp");
				}
	
				if(((txtEmpYears2 == '') || (txtEmpYears2 == null)) && ((txtEmpMonths2 == '') || (txtEmpMonths2 == null))){
					Errors = true;
					ShowRow("eEmpLength");
				}else if(isNaN(txtEmpYears2) || isNaN(txtEmpMonths2)){
					Errors = true;
					HideRow("eEmpLength");
					ShowRow("eEmpLengthV");
				}else{
					HideRow("eEmpLength");
					HideRow("eEmpLengthV");
				}
				
				if((txtOccupation2 == '') || (txtOccupation2 == null)){
					Errors = true;
					ShowRow("eOccupation");
				}else{
					HideRow("eOccupation");
				}
				
				if((txtEmp2 == '') || (txtEmp2 == null)){
					Errors = true;
					ShowRow("eEmp");
				}else{
					HideRow("eEmp");
				}
	
				if((txtEmpPhone2 == '') || (txtEmpPhone2 == null)){
					Errors = true;
					ShowRow("eEmpPhone");
				//}else if(isNaN(txtEmpPhone2)){
					Errors = true;
				//	HideRow("eEmpPhone");
				//	ShowRow("eEmpPhoneV");
				}else{
					HideRow("eEmpPhone");
				//	HideRow("eEmpPhoneV");
				}
				
				if((txtEmpAddr2 == '') || (txtEmpAddr2 == null)){
					Errors = true;
					ShowRow("eEmpAddr");
				}else{
					HideRow("eEmpAddr");
				}	
		
				if((txtEmpSuburb2 == '') || (txtEmpSuburb2 == null)){
					Errors = true;
					ShowRow("eEmpSuburb");
				}else{
					HideRow("eEmpSuburb");
				}	
		
				if(cboEmpState2 == ''){
					Errors = true;
					ShowRow("eEmpState");
				}else{
					HideRow("eEmpState");
				}	
		
				if((txtEmpPostcode2 == '') || (txtEmpPostcode2 == null)){
					Errors = true;
					ShowRow("eEmpPostcode");
				}else if(isNaN(txtEmpPostcode2)){
					Errors = true;
					HideRow("eEmpPostcode");
					ShowRow("eEmpPostcodeV");
				}else if(txtEmpPostcode2.length < 4){
					Errors = true;
					HideRow("eEmpPostcode");
					HideRow("eEmpPostcodeV");
					ShowRow("eEmpPostcodeL");
				}else{
					HideRow("eEmpPostcode");
					HideRow("eEmpPostcodeV");
					HideRow("eEmpPostcodeL");
				}
			}else{
				HideRow("eEmpStatus");
			}
	
			//2nd job
			if(getRadioCheckedValue(opt2ndEmp2) == 'yes'){
			
				ShowRow("App22ndEmp");
	
				if(((txt2ndEmpYears2 == '') || (txt2ndEmpYears2 == null)) && ((txt2ndEmpMonths2 == '') || (txt2ndEmpMonths2 == null))){
					Errors = true;
					ShowRow("e2ndEmpLength");
				}else if(isNaN(txt2ndEmpYears2) || isNaN(txt2ndEmpMonths2)){
					Errors = true;
					HideRow("e2ndEmpLength");
					ShowRow("e2ndEmpLengthV");
				}else{
					HideRow("e2ndEmpLength");
					HideRow("e2ndEmpLengthV");
				}
	
				if(cbo2ndEmpType2 == ''){
					Errors = true;
					ShowRow("e2ndEmpType");
				}else{
					HideRow("e2ndEmpType");
				}
	
	
				if(cbo2ndEmpStatus2 == ''){
					Errors = true;
					ShowRow("e2ndEmpStatus");
				}else if(cbo2ndEmpStatus2 != "" && cbo2ndEmpStatus2 != "Unemployed" && cbo2ndEmpStatus2 != "Retired" && cbo2ndEmpStatus2 != "Pension"){
					HideRow("e2ndEmpStatus");
		
					ShowRow("App22ndEmp");
					ShowRow("App22ndEmpDetails");
		
					if((txt2ndOccupation2 == '') || (txt2ndOccupation2 == null)){
						Errors = true;
						ShowRow("e2ndOccupation");
					}else{
						HideRow("e2ndOccupation");
					}
					
					if((txt2ndEmpName2 == '') || (txt2ndEmpName2 == null)){
						Errors = true;
						ShowRow("e2ndEmpName");
					}else{
						HideRow("e2ndEmpName");
					}
		
					if((txt2ndEmpPhone2 == '') || (txt2ndEmpPhone2 == null)){
						Errors = true;
						ShowRow("e2ndEmpPhone");
					//}else if(isNaN(txt2ndEmpPhone2)){
					//	Errors = true;
					//	HideRow("e2ndEmpPhone");
					//	ShowRow("e2ndEmpPhoneV");
					}else{
						HideRow("e2ndEmpPhone");
					//	HideRow("e2ndEmpPhoneV");
					}
					
					if((txt2ndEmpAddr2 == '') || (txt2ndEmpAddr2 == null)){
						Errors = true;
						ShowRow("e2ndEmpAddr");
					}else{
						HideRow("e2ndEmpAddr");
					}	
			
					if((txt2ndEmpSuburb2 == '') || (txt2ndEmpSuburb2 == null)){
						Errors = true;
						ShowRow("e2ndEmpSuburb");
					}else{
						HideRow("e2ndEmpSuburb");
					}	
			
					if(cbo2ndEmpState2 == ''){
						Errors = true;
						ShowRow("e2ndEmpState");
					}else{
						HideRow("e2ndEmpState");
					}	
			
					if((txt2ndEmpPostcode2 == '') || (txt2ndEmpPostcode2 == null)){
						Errors = true;
						ShowRow("e2ndEmpPostcode");
					}else if(isNaN(txt2ndEmpPostcode2)){
						Errors = true;
						HideRow("e2ndEmpPostcode");
						ShowRow("e2ndEmpPostcodeV");
					}else if(txt2ndEmpPostcode2.length < 4){
						Errors = true;
						HideRow("e2ndEmpPostcode");
						HideRow("e2ndEmpPostcodeV");
						ShowRow("e2ndEmpPostcodeL");
					}else{
						HideRow("e2ndEmpPostcode");
						HideRow("e2ndEmpPostcodeV");
						HideRow("e2ndEmpPostcodeL");
					}
				}else{
					HideRow("e2ndEmpStatus");
				}				
			}
	
			//Previous Employer
			if(getRadioCheckedValue(optPrevEmp2) == 'yes'){
	
				ShowRow("App2PrevEmp");
	
				if(((txtPrevEmpYears2 == '') || (txtPrevEmpYears2 == null)) && ((txtPrevEmpMonths2 == '') || (txtPrevEmpMonths2 == null))){
					Errors = true;
					ShowRow("ePrevEmpLength");
				}else if(isNaN(txtPrevEmpYears2) || isNaN(txtPrevEmpMonths2)){
					Errors = true;
					HideRow("ePrevEmpLength");
					ShowRow("ePrevEmpLengthV");
				}else{
					HideRow("ePrevEmpLength");
					HideRow("ePrevEmpLengthV");
				}
	
				if(cboPrevEmpType2 == ''){
					Errors = true;
					ShowRow("ePrevEmpType");
				}else{
					HideRow("ePrevEmpType");
				}
	
				if(cboPrevEmpStatus2 == ''){
					Errors = true;
					ShowRow("ePrevEmpStatus");
				}else if(cboPrevEmpStatus2 != "" && cboPrevEmpStatus2 != "Unemployed" && cboPrevEmpStatus2 != "Retired" && cboPrevEmpStatus2 != "Pension"){
					HideRow("ePrevEmpStatus");
		
					ShowRow("App2PrevEmp");
					ShowRow("App2PrevEmpDetails");
		
					if((txtPrevOccupation2 == '') || (txtPrevOccupation2 == null)){
						Errors = true;
						ShowRow("ePrevOccupation");
					}else{
						HideRow("ePrevOccupation");
					}
					
					if((txtPrevEmpName2 == '') || (txtPrevEmpName2 == null)){
						Errors = true;
						ShowRow("ePrevEmpName");
					}else{
						HideRow("ePrevEmpName");
					}
		
					if((txtPrevEmpPhone2 == '') || (txtPrevEmpPhone2 == null)){
						Errors = true;
						ShowRow("ePrevEmpPhone");
					//}else if(isNaN(txtPrevEmpPhone2)){
					//	Errors = true;
					//	HideRow("ePrevEmpPhone");
					//	ShowRow("ePrevEmpPhoneV");
					}else{
						HideRow("ePrevEmpPhone");
					//	HideRow("ePrevEmpPhoneV");
					}
				}else{
					HideRow("ePrevEmpStatus");
				}
			}
		}//End Applicant 2 Your Income Details

	}
	
		//Check if there is any Errors
		if(Errors == true){
			alert("Please review your application and fix any errors that have been identified.");
		}else{
			//Check if action should be post
			if(Action == true){
				document.LoanApplication.submit();
			}
		}

}