$(function() {

  $('.error').hide();
  
  $('input.text-input').css({backgroundColor:"#ffffff"});
  
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#dcdcdc"});
  });
  
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#dcdcdc"});
  });

 

  $("#contactSubmit").click(function() {
	
	$(this).attr("disabled", true)
    $('.error').hide();

	var name = $("input#field-name").val();
	var company = $("input#field-company").val();
	var phone = $("input#field-phone").val();
	var email = $("input#field-email").val();
	var msg = $("#field-message").val();	
	
	if (name == "") {
      $("#contactSubmit").attr("disabled", false);
      $("label#field-name").show();
      $("input#field-name").focus();
      return false;
    }
	
	if (email == "") {
      $("label#field-email").show();
      $("input#field-email").focus();
      $("#contactSubmit").attr("disabled", false);
      return false;
    }
 		
	var dataString = 'form=signup&name='+ name + '&company=' + company + '&phone=' + phone + '&email=' + email + '&msg=' + msg;
	//alert (dataString);
	//return false;
		
	$.ajax({
      type: "POST",
      url: "/bin/process.php",
      data: dataString,
      success: function() {
        $('#contactBlock').html("<div id='signupMessage'></div>");
        $('#signupMessage').html("<p class='subhead'>Thank you for your submission.</p>")
        .hide()
        .fadeIn(2500, function(){
        	$('#dropdown').animate({ height: 0 }, { duration: 500, complete: function () {
	        $div.hide();
	      } 
	    });
	    return false;
        });
      }
     });
    return false;
	});

});
