  $(function() {
    $('.error').hide();
    $(".button").click(function() {
      // validate and process form here
      
      $('.error').hide();
	  var dir = $("input#dir").val();
	  var contactCompany = $("input#contactCompany").val();
	  var contactCompanyemail = $("input#contactCompanyemail").val();
	  var contactWebsite = $("input#contactWebsite").val();
  	  var name = $("input#name").val();
  		if (name == "") {
        $("label#name_error").show();
        $("input#name").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 verify = $("input#verify").val();
		if ((verify != "five" && verify != "5") || verify == "") {
		$("label#verify_error").show();
		$("input#verify").focus();
		return false;
	  }
	  
	  var dataString = 'name='+ name + '&email=' + email + '&message=' + message + '&contactCompany=' + contactCompany + '&contactCompanyemail=' + contactCompanyemail + '&contactWebsite=' + contactWebsite;
	  //alert (dataString);return false;
	  $.ajax({
		type: "POST",
		url: dir+"/functions/quickcontact.php",
		data: dataString,
		success: function() {
		  $('#quickcontact').html("<div id='quickcontact_message'></div>");
		  $('#quickcontact_message').html("<h3>Contact Form Submitted</h3>")
		  .append("<p>We will be in touch soon.</p>")
		  .hide()
		  .fadeIn(500, function() {
			$('#quickcontact_message').append("<img id='check' src='"+dir+"/images/email_accept.png' />");
		  });
		}
	  });
	  return false;  
      
    });
  });
  
