// JavaScript Document

  $(function() {
    $(".quickcontactbutton").click(function() {
      // validate and process form here
      
  	  var name = $("input#name").val();
  		if (name == "") {
        $("#label1error").show();
		$("#label1").hide();
		$("input#name").focus(); 
        return false;
      }  else { 
	  $("#label1error").hide();
		$("#label1").show();
	  }
  		var email = $("input#email").val();
  		if (email == "") {
        $("#label2error").show();
		$("#label2").hide();
		$("input#email").focus(); 
        return false;
      } else { 
	  $("#label2error").hide();
		$("#label2").show();
	  }
  		var phone = $("input#phone").val();
  		if (phone == "") {
        $("#label3error").show();
		$("#label3").hide();
		$("input#phone").focus(); 
        return false;
      } else { 
	  $("#label3error").hide();
		$("#label3").show();
	  }
  		var comment = $("textarea#comment").val();
  		if (comment == "") {
		$("#label4error").show();
		$("#label4").hide();
		$("textarea#comment").focus(); 
        return false;
      } else { 
	  $("#label4error").hide();
		$("#label4").show();
	  }
	  
  var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&comment=' + comment;
  //alert (dataString);return false;
  $.ajax({
    type: "POST",
    url: "/quickcontact.php",
    data: dataString,
    success: function() {
      $('#contact_form').html("<div id='quickcontactsuccess'></div>");
      $('#quickcontactsuccess').html("<p>Thank you, your message has been sent</p><p>We will get back to you as soon as possible.</p>")
    }
  });
  return false;
      
    });
  });