$(function() {
	  $('.error').hide();
	  $('.text-input').css({backgroundColor:"#FFFFFF"});
	  $('.text-input').focus(function(){
		$(this).css({borderColor:"#990000"});
		$(this).css({borderWidth:"2px"});
	  });
	  $('.text-input').blur(function(){
		$(this).css({borderColor:"black"});
		$(this).css({borderWidth:"1px"});
	//	$(this).css({backgroundColor:"#FFFFFF"});
	  });
	
	  $(".button").click(function() {
			// validate and process form
			// first hide any error messages
			$('.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;
				}
				
			// only phone number is required field	
			  var phone = $("input#phone").val();
				if (phone == "") {
					  $("label#phone_error").show();
					  $("input#phone").focus();
					  return false;
				}
		
			var msg = $("textarea#msg").val();
			
			var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&msg=' + msg;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "process.php",								//place here the name of the script that will handle the contact form submission
      data: dataString,
      success: function(html) {
		//  if (html == 1)
		 {
			  $('.form').hide();	
			  $('.done').fadeIn('slow'); 
		  }
		//  else alert('Something went wrong\nPlease try again');
      }
     });
    return false;
	});
});
runOnLoad(function(){
 // $("input#name").select().focus();
});
