if (Prototype) {
	Event.observe(window, 'load', prepQuoteForm);
}

function prepQuoteForm() {
	if (!$('quote'))
		return;

	$('quote').onsubmit = function() {
		return !processQuoteForm();
	}
}

function processQuoteForm() {
	var url = "/include/quote.php";
	var params = Form.serialize('quote');
	params += "&return_url=" + escape(window.location.href);
	var container = 'quote-container';
	var ajax = new Ajax.Updater(container, url, {parameters: params, onLoading: showLoading, onComplete: showComplete});
	return (ajax ? true : false);
}

function showLoading() {
	$('quote-container').style.display = 'none';
	$('quote-loading').style.display = 'block';
}

function showComplete(req) {
	$('quote-loading').style.display = 'none';
	$('quote-container').style.display = 'block';
	prepQuoteForm();
}
