	$(document).ready(function() {
		// bind form using ajaxForm
		$('#feedbackForm').ajaxForm({
			// dataType identifies the expected content type of the server response
			dataType:  'xml',
			beforeSubmit:  checkRequest,
			success:   processXml
		});
	});
	
	function processXml(responseXML) {
		// 'responseXML' is the XML document returned by the server; we use
		// jQuery to extract the content of the message node from the XML doc
		var message = $('message', responseXML).text();
		var errortype = $('error', responseXML).text();
		if (!(errortype)){
			$('#feedbackForm').clearForm();
		}
		alert(message);
	}

	function checkRequest(formData, jqForm, options) {
		$("#feedbackForm").validate();
		if ( $("#feedbackForm").valid() == true){
			return true;
		}else{
			alert('There is a problem with your submission, please check the details and try again.')
			return false;
		}
	}
