      $(document).ready(function() {
      $('.backtotop').click(function(){
      $('html, body').animate({scrollTop:0}, 'slow');
      });
      });
      
  $(function() {
    $('.error').hide();
    $(".button").click(function() {
      // validate and process form here

      $('.error').hide();
  	  var name = $("input#name").val();
  		if (name == "") {
        $("label#name_error").show();
        $("input#name").focus();
        return false;
      }
  	  var surname = $("input#surname").val();
  		if (name == "") {
        $("label#surname_error").show();
        $("input#surname").focus();
        return false;
      }      
  	  var surname = $("input#company").val();
  		if (name == "") {
        $("label#company_error").show();
        $("input#company").focus();
        return false;
      }      
  	  var surname = $("input#phone").val();
  		if (name == "") {
        $("label#phone_error").show();
        $("input#phone").focus();
        return false;
      }      
  		var email = $("input#email").val();
  		if (email == "") {
        $("label#email_error").show();
        $("input#email").focus();
        return false;
      }
  		var message = $("textarea#message").val();
  		if (message == "") {
        $("label#message_error").show();
        $("textarea#message").focus();
        return false;
      }

		var dataString = 'name='+ name + '&surname='+ surname + '&email=' + email + '&message=' + message;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "/bin/process.php",
      data: dataString,
      success: function() {
        $('#contact_form').html("<div id='message'></div>");
        $('#message').html("<h2>Thank you!</h2>")
        .append("<p>We will be in touch soon &#8211; or give Gill a call on 020 8385 3800.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#message').append("<img id='checkmark' src='images/check.png' />");
        });
      }
     });
    return false;
	});
});


