	$(function() {
	 $('#contactform').submit(function() {
	  var inputs = [];
	  $(':input', this).each(function() {
	    inputs.push(this.name + '=' + escape(this.value));
	  })
	  jQuery.ajax({
	    data: inputs.join('&'),
	    url: this.action,
	    timeout: 5000,
	    error: function() {
	      alert('Failed to submit, please try again');
	    },
	    success: function(r) {
	     alert(r);
       if (r.match(/success/)) { 
		    $('#contactform').html('<strong>Your message was successfully sent.</strong>');
		   }
	    }
	  })
	  return false;
	 })
	})
