// JavaScript Document
  $(function() {
	
	$('.error').hide();
	  $('input.text-input').css({backgroundColor:"#FFEA66"});
	  $('input.text-input').focus(function(){
		$(this).css({backgroundColor:"#FFDDAA"});
	  });
	  $('input.text-input').blur(function(){
		$(this).css({backgroundColor:"#FFEA66"});
	  });
	 
    $(".button").click(function() {
      // validate and process form here
	  
	  var name = $("input#name").val();
	  if (name == "") {
      $("input#name").focus();
      return false;
    }
	  var email = $("input#email").val();
	  if (email == "") {
      $("input#email").focus();
      return false;
    }
	  var message = $("#message").val();
	  if (message == "") {
      $("#message").focus();
      return false;
    }
	  var ip = $("input#ip").val();
	  var httpref = $("input#httpref").val();
	  var httpagent = $("input#httpagent").val();
	  
	    var dataString = 'name='+ name + '&email=' + email + '&message=' + message + '&ip=' + ip + '&httpref=' + httpref + '&httpagent=' + httpagent;
		  //alert (dataString);return false;
		  $.ajax({
			type: "POST",
			url: "sendmessage.php",
			data: dataString,
			success: function() {
			  $('#contact_form').html("<div id='sentmessage'></div>");
			  $('#sentmessage').html("<h2>Message Sent!</h2>")
			  .append("<p>I will be in touch soon.</p>")
			  .hide()
			  .fadeIn(1500, function() {
				$('#sentmessage').append("<img id='checkmark' src='images/check.png' />");
			  });
			}
		  });

			$(':input','#contactForm')
			 .not(':button, :submit, :reset, :hidden')
			 .val('')
			 .removeAttr('checked')
			 .removeAttr('selected');

		  
		  return false;
  
    });
  });
  