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

  $(".button").click(function() {

    $('.error').hide();
		
	  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 phone = $("input#phone").val();
		if (phone == "") {
      $("label#phone_error").show();
      $("input#phone").focus();
      return false;
    }
	
			var project_type = $("input#project_type").val();
		if (project_type == "") {
      $("label#project_type_error").show();
      $("input#project_type").focus();
      return false;
    }
	
	 var description = $("textarea#description").val();
		if (description == "") {
      $("label#description_error").show();
      $("textarea#description").focus();
      return false;
    }
	
				var budget = $("input#budget").val();
		if (budget == "") {
      $("label#budget_error").show();
      $("input#budget").focus();
      return false;
    }
		
		var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&project_type=' + project_type + '&description=' + description + '&budget=' + budget;
		//alert (dataString);return false;
		
      $.ajax({
      type: "POST",
      url: "http://digitaleuphoria.com/bin/process.php",
      data: dataString,
      success: function() {
$("#name").val(''); 
$("#email").val(''); 
$("#phone").val('');
$("#project_type").val('');
$("#description").val('');   
$("#budget").val('');   
        $('#contact-form').html("<div id='message'></div>");
        $('#message').html("<h2>You have taken the first step!</h2>")
        .append("<p>We will be in touch soon.</p>")
        .hide()
        .fadeIn(500, function() {
          $('#message').append("<img id='checkmark' src='/images/assets/check.png' />");
        });
		   $('#contact-form').delay(5000).fadeOut();
		   	$('.formsent').show();
      }
     });
	      
   
    return false;
	});
});
//runOnLoad(function(){
 // $("input#name").select().focus();
//});

