function estimatorForm() {
	var responseElement = $('estimated_cost');
	var estimatorForm = $('estimatorForm');
	var responseElementFx = new Fx.Slide('estimated_cost');

	// hide the responseElement
	responseElementFx.hide();

	estimatorForm.addEvent('submit', function(e) {
		/**
		 * Prevent the submit event
		 */
		new Event(e).stop();
	 
		/**
		 * This hides the form, empties the response element and shows the spinning indicator
		 */
		this.addClass('calculating');

		/**
		 * send takes care of encoding and returns the Ajax instance.
		 * onComplete removes the spinner from the log.
		 */
		this.send({
			onComplete: function() {
				estimatorForm.removeClass('calculating');
				responseElementFx.slideIn();
			},
			update: responseElement
		});
	});
}

window.addEvent('domready', estimatorForm);
