$(function() {
  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
		
	  var name = $("input#name").val();
		if (name == "") {
		alert( "Please enter your name.");
		return false;
    }
		var email = $("input#email").val();
		if (email == "") {
		alert( "Please enter your email.");
		return false;
    }
		
		var dataString = 'name='+ name + '&email=' + email;
		// alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "../../scripts/castContact.php",
      data: dataString,
      success: function() {
        $('#contactFRM').html("<div id='message'></div>");
        $('#message').html("<p class=\"HeadlineBlack\">Thank You!</p>");
      }
     });
    return false;
	});
});
runOnLoad();

