	//initiate validator on load 
	$(function() {
		// validate contact form on keyup and submit
		$("#contactForm").validate({
			//set the rules for the fild names
			rules: {
				name: {
					required: true,
					minlength: 2
				},
				email: {
					required: true,
					email: true
				},
				comment: {
					required: true
				}
			},
			//set messages to appear inline
			messages: {
				name: "",
				email: "",
				comment: ""
			},
			submitHandler: function() {
				//trigger ajax to email me
				$('#contactBox').hide();
				$('#tips').hide();
				$('#loading').css({display:'block'}); 
				$.get('mail.php', {name:$('#name').val(), email:$('#email').val(), comment:$('#comment').val()},
					function(data){
						$('#loading').css({display:'none'}); 
						$('#container').append(data);  
					});						
				return false;	
			}
		});
		
});
