jQuery().ready(function() {
		var validator = jQuery("#ContactForm").bind("invalid-form.validate", function() {
			jQuery("#drawer").html("Your form contains " + validator.numberOfInvalids() + " errors. Errors have a <samp style=\"color:red\"><strong>red</strong></samp> background.");
		}).validate({
			
			errorContainer: jQuery("#drawer"),
		
			//Setup our validation rules
			 rules: {
				name: {
				   required: true,
				   minlength: 1
				 },
				email: {
					required: true,
					email: true
				},
				domain: {
					required: true,
					minlength: 5
				}
			},	
			
			//Execute this Function if Form is invalid
			 invalidHandler: function(form, validator) {		    
				
				//alert("Error");
				
				//Fancy drawer function from jquery.tools
				jQuery("#drawer").slideDown(function()  {		
					// colored flash effect
					jQuery("#drawer").css("backgroundColor", "#B21D23");
					setTimeout(function() { jQuery("#drawer").css("backgroundColor", "#13283B"); }, 1000);
				});
				
			 },
			 
			 submitHandler: function(form) {			
				//on SUCCESFUL submit, slide that SHIZ up!
				jQuery("#drawer").slideUp();	
				form.submit();//VERY IMPORTANT!
			 }
		
	});
		
});