<!--//

	// validate the contact form
	function submitAskForm() {
	
		// create the validator
		var v = new Validator();

		v.clearAll();
		
		v.addRule(new Rule({id:'your_name', type:'required', text:'Please enter your name', title:'Your Name'}));
		v.addRule(new Rule({id:'your_email', type:'required', text:'Please enter your email address', title:'Your Email'}, {type:'email', text: 'Your email address is in an invalid format'}));
		v.addRule(new Rule({id:'comments', type:'required', text:'Please enter your question', title:'Question'}));

		// if have any messages
		if(!v.validateForm('form')) {
			
			// show the spinner
			$('submitSpinner').show();
			
			// all good - we validted
			var url = WWW_ROOT + "/faqs/ask.html";

			new Ajax.Request(url, {
				method: 'post',
				parameters: { fa: 'ajax_submit', your_name: $F('your_name'), 
												your_email: $F('your_email'), 
												comments: $F('comments')
												}, 
				
				onSuccess: function (transport) {
					if (transport.responseText == 'OK') {
						$('askForm').hide();
						$('submitRow').hide();
						$('submitSpinner').hide();
						Effect.Appear('askSuccess', {duration: 0.3, queue: {position: 'end', scope: 'queue'}});
					} else {
						$('submitSpinner').hide();
						Effect.Appear('askError', {duration: 0.3, queue: {position: 'end', scope: 'queue'}});
					}
				},
					
				onFailure: function () {},				
				onException: function (requestObj, ex) {alert(requestObj.responseText)}
			});	
		}

		// 
		return false;
	}

        $('your_name').focus();
		Event.observe('askSubmitButton', 'click', submitAskForm);
		Event.observe('askSubmitButton', 'keypress', function (event) {
			if (event.keyCode == 13) {
				submitAskForm();
			}
		});
//-->
