function FinanceQuote() {
	this.quoteFormObject = false;
	
	this.SetFinanceQuoteForm = SetFinanceQuoteForm;
	this.RequestFinanceQuote = RequestFinanceQuote;
}

function SetFinanceQuoteForm(formObject) {
	this.quoteFormObject = formObject;
}

function RequestFinanceQuote(contactMethod) {
	var errorMessage = '';
	if (this.quoteFormObject.firstname.value == '') {
		errorMessage += "\nFirst Name is empty";
	}
	if (contactMethod == 'telephone' && this.quoteFormObject.telephone.value == '') {
		errorMessage += "\nTelephone number is empty";
	}
	if (contactMethod == 'email' && this.quoteFormObject.email.value == '') {
		errorMessage += "\nEmail Address is empty";
	}
	if (errorMessage != '') {
		alert("The form has not been completed:\n"+errorMessage);
	} else {
		this.quoteFormObject.contact_method.value = contactMethod;
		this.quoteFormObject.submit();
	}
}

