<!--//

	// create the validator
	var v = new Validator();


	// validate the contact form
	function validateForm() {

		v.clear();

		v.addRule(new Rule({id: 'name', type:'required', text:'Please enter your name'}));
		v.addRule(new Rule({id: 'email', type:'required', text:'Please enter your email'}));
		v.addRule(new Rule({id: 'email', type:'email', text:'Your email is in an invalid format'}));
		v.addRule(new Rule({id: 'regarding', type:'required', text:'Please indicate what your enquiry is regarding'}));
		v.addRule(new Rule({id: 'enquiry', type:'required', text:'Please enter your enquiry'}));
		
		// if have any messages
		if(v.validateForm('form')) {
		
			// all good - we validted
			var url = WWW_ROOT + "contact/index.html";

			// show the spinner
			$('submitSpinner').show();
					
			new Ajax.Request(url, {
				method: 'post',
				parameters: { fa: 'ajax_submit', 
								name: $F('name'), 
								email: $F('email'), 
								phone: $F('phone'), 
								regarding: $F('regarding'),
								enquiry: $F('enquiry')
				}, 
				
				onSuccess: function (transport) {
					if (transport.responseText == 'OK') {
						$('generalEnquiryForm').hide();
						$('submitRow').hide();
						$('submitSpinner').hide();
						Effect.Appear('contactSuccess', {duration: 0.3, queue: {position: 'end', scope: 'queue'}});
					} else {
						$('submitSpinner').hide();
						Effect.Appear('contactError', {duration: 0.3, queue: {position: 'end', scope: 'queue'}});
					}
				},
					
				onFailure: function () {},				
				onException: function (requestObj, ex) {alert(requestObj.responseText)}
			});	
		}

		// 
		return false;
	}
//-->
