




/*
     FILE ARCHIVED ON 22:48:23 May 3, 2006 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 8:20:46 Sep 15, 2011.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
function ValidateForm()
{
	var bValid=true;

	bValid=(ValidateField(document.frmDetails.Your_Details_FullName, "Please enter your full name")) ? bValid : false;
	bValid=(ValidateField(document.frmDetails.Your_Details_HomePhone, "Please enter your home telephone number")) ? bValid : false;

	if (bValid)
	{
		if (document.frmDetails.Terms_Agreed.checked==false) 
			alert("We can only process your loan application if you agree to the terms and conditions in our declaration. Please tick the box 'I Agree' once you have read the declaration.");
		else
		{
			//remove terms as this will be submitted in email otherwise
			tdOurTerms.removeChild(document.frmDetails.Our_Terms);

			document.frmDetails.submit();
		}
	}
	else  alert("Please complete all mandatory fields before submitting your application");
}

function ValidateField(obj, sMessage)
{
	var bValid=true;
	
	if (obj.value == "")
	{
		obj.style.background="#8BAECF";
		obj.title=sMessage;
		bValid=false;
	}
	else
	{
		obj.style.background="#FFFFFF";
		obj.title="";
	}
	
	return bValid;
}

function ReplaceAll(sWhole,sToReplace,sReplacement)
{
	while (sWhole.indexOf(sToReplace) > -1)
	{
		sWhole=sWhole.replace(sToReplace,sReplacement);		
	}

	return sWhole;
}

function DataProtectionChanged()
{
	document.frmDetails.z_DataProtection_Contactable.value=(document.frmDetails.DataProtection.checked==true) ? "NO" : "YES";
}

