$(function() {
  $('.error2').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#00b7cd"});
  });
  
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $(".button2").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error2').hide();
		
	var name2 = $("input#name2").val();
		if (name2 == "" || name2 == "Name") {
		  $("label#name_error2").show();
		  $("input#name2").focus();
		  return false;
		}
	var email2 = $("input#email2").val();
		if (email2 == "" || email2 == "Email") {
		  $("label#email_error2").show();
		  $("input#email2").focus();
		  return false;
		}

	var message2 = $("textarea#message2").val();
		
	var dataString2 = 'name2=' + name2 + '&email2=' + email2 + '&message2=' + message2;
	//alert (dataString);return false;
		
	$.ajax({
      type: "POST",
      url: "footer_form/bin/process.php",
      data: dataString2,
      success: function() {
        $('#contact_form').html("<div id='message2'></div>");
        $('#message2').html("<img id='checkmark' src='footer_form/images/check.png' align='left' /><br /><br />")
        //.append("<h2>Quote Form Submitted!</h2>")
        .hide()
        .fadeIn(1500, function() {
          $('#message2').append("<p>Thank you. We will be in touch soon.</p>");
        });
      }
     });
    return false;
	});
});
runOnLoad(function(){
  //$("input#name").select().focus();
});
