 $(document).ready(function() {   
         $("#contest").validate({   
             rules: {   
              contact_name: "required",
			  phone: "required",
              email: {required: true,email: true},
              confirm_email: {required: true,equalTo: "#contest_email"}   
            },
             
              errorContainer: $("#contest div.container"), 
			  errorPlacement: function (error, element) {
element.parents(".form-row").find(".fielderror").append(error);
},
                 
             messages: {   
              contact_name: "Enter your Name",
              email: "Enter a Valid Email Address",
              confirm_email: "Email Address Do Not Match"   
           },
		   
		   
submitHandler: function(form) {

		var data = 'form_tools_form_id=3';

		//$('.text').attr('disabled','false');
		
	
		$('.loading').show();
		
	
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "http://www.knibbeautomotive.com/_fTools/process.php",	
			
			//GET method is used
			type: "POST",
 
			//pass the data			
			data: $("#contest").serialize()+"&"+data,	
			
			//Do not cache the page
			cache: false,
			
			//success
				success: function (form) {				
				
				$("#contest") 
					   .filter(function(){ return ! $(this).is(":empty"); }) 
					   .fadeOut(0, function(){ 
					$(".done_contest").fadeIn(1500);
					});

			}		
		});
		
		//cancel the submit button default behaviours
		return false;
 
		}
	});
$("#reset").click(function() {
		validator.resetForm();
	});
});

