function ReportFormNavigate(theForm, ID, lngUseHTTPS){
		if (lngUseHTTPS == 1) {
			var strURL = "HTTPS://" + document.domain + "/freight/"
		}
		else {var strURL = ""}
		disableButtons(theForm);
		theForm.action=strURL + "reports.asp?id=" + ID;
		theForm.submit();
}

function DefaultFormNavigate(theForm, lngUseHTTPS){
		if (lngUseHTTPS == 1) {
			var strURL = "HTTPS://" + document.domain + "/freight/"
		}
		else {var strURL = ""}
		disableButtons(theForm);
		theForm.action=strURL + "default.asp";
		theForm.submit();
}

function ValidateFFRegOK(theForm)
{
	var strMsg;
	
	if (!IsValidGuid(theForm.txt_FFregno.value)){
		alert("Invalid Registration number. Please enter carefully")
		theForm.txt_FFregno.focus();
		return false;
	}
	
	if (theForm.txt_FFemail.value.length==0){
		alert("Please enter your email address in the space provided.")
		theForm.txt_FFemail.focus();
		return false;	
	}
	if (!isEmail(theForm.txt_FFemail.value)){
		alert("Please enter a valid email address in the space provided.")
		theForm.txt_FFemail.focus();
		return false;	
	}

	if (theForm.txt_FFpassword.value.length < 5){
		alert("Password must be at least 5 characters")
		theForm.txt_FFpassword.focus();
		return false;
	}
	
	if (theForm.txt_FFusername.value.length==0){
		alert("Please enter your name in the space provided.")
		theForm.txt_FFusername.focus();
		return false;	
	}
	
	if (theForm.terms.checked == false){
		alert("Please tick the box to show that you have read the Terms and Conditions.")
		theForm.terms.focus();
		return false;	
	}

	document.getElementById("backgroundcolor").value = document.styleSheets(0).rules("BODY").style.backgroundColor

	strMsg="Please confirm that the email address is correct; this will be your userid for the GoCargo system" + '\n' + "If not click cancel and retype your email address" + '\n' + '\n' + theForm.txt_FFemail.value
	
	if (confirm(strMsg) == false) { return false }
	else {disableButtons(theForm);
		return true
	}
	//return true;

}

function ValidateFFActivate(theForm) {
	
		if (theForm.txt_FFBankName.value.length==0){
			alert("Please enter the name of your bank in the space provided..")
				theForm.txt_FFBankName.focus();
				return false;
		}
		
		if (theForm.txt_FFBankAddress1.value.length==0){
			alert("Please enter the first line of your bank's address in the space provided..")
				theForm.txt_FFBankAddress1.focus();
				return false;
		}
		
		if (theForm.txt_FFBankAccountNo.value.length==0){
			alert("Please enter your bank account number in the space provided..")
				theForm.txt_FFBankAccountNo.focus();
				return false;
		}

		if (theForm.txt_FFBankBranchCode.value.length==0){
			alert("Please enter your bank branch code in the form nn-nn-nn in the space provided..")
				theForm.txt_FFBankBranchCode.focus();
				return false;
		}
		
		if (theForm.txt_FFBankBranchCode.value.length>0){
			if (!isBranch(theForm.txt_FFBankBranchCode.value))	{
				alert("Please enter your bank branch code in the form nn-nn-nn in the space provided..")
				theForm.txt_FFBankBranchCode.focus();
				return false;
			}
		}
		disableButtons(theForm);
	}
	
function ValidateFFOK(theForm) {
		if (theForm.txt_Telephone.value.length>0){
			if (!isPhone(theForm.txt_Telephone.value)){
				alert("Invalid telephone number")
				theForm.txt_Telephone.focus();
				return false;
			}
		}
		disableButtons(theForm);
}
function ValidateFFtoBank(theForm, lngDestination,lngUseHTTPS) {

		if (theForm.txt_Surname.value.length==0){
			alert("Please enter your surname in the space provided..")
				theForm.txt_Surname.focus();
				return false;
		}
		if (theForm.txt_FirstName.value.length==0){
			alert("Please enter your first name in the space provided..")
				theForm.txt_FirstName.focus();
				return false;
		}
		if (theForm.txt_PositionHeld.value.length==0){
			alert("Please enter your position in the space provided..")
				theForm.txt_PositionHeld.focus();
				return false;
		}
		
		if (theForm.txt_Telephone.value.length==0){
			alert("Please enter your telephone number in the space provided..")
				theForm.txt_Telephone.focus();
				return false;
		}

		if (theForm.txt_Telephone.value.length>0){
			if (!isPhone(theForm.txt_Telephone.value)){
				alert("Invalid telephone number")
				theForm.txt_Telephone.focus();
				return false;
			}
		}
// not mandatory - JS 22/02/05
//		if ((theForm.txt_CompanyRegistration.value.length==0) && (theForm.txt_CompanyVAT.value.length==0)){
//			alert("Please enter either your company registration number or your VAT number in the space provided..")
//				theForm.txt_CompanyRegistration.focus();
//				return false;
//		}

		if (theForm.txt_CompanyRegistration.value.length > 0 && !isCompanyRegistration(theForm.txt_CompanyRegistration.value)) {
			alert("Invalid company registration number. Must be a 8 digit number e.g. 12345678")
			theForm.txt_CompanyRegistration.focus();
			return false;
		}
		if (theForm.txt_CompanyVAT.value.length > 0 && !isVAT(theForm.txt_CompanyVAT.value)) {
			alert("Invalid VAT number. Must be 'GB' followed by 9 digits e.g. GB123456789")
			theForm.txt_CompanyVAT.focus();
			return false;
		}

		if (lngUseHTTPS == 1) {
			var strURL = "HTTPS://" + document.domain + "/public/"
		}
		else {var strURL = ""}
		disableButtons(theForm);
		theForm.action=strURL + "FF.asp?id=" + lngDestination;
		theForm.submit();
}
