$(function () {
	var v = $("#contactForm").validate({
		rules: {
			name: "required",
			email: {
				required: true,
				email: true
			},
			company: "required",
			address_1: "required",
			city: "required",
			state: "required",
			zip: "required",
			country: "required",
			phone: "required"
		},
		messages: {
			name: "Please enter your name",
			email: "Please enter a valid email address",
			company: "Please enter your company",
			address_1: "Please enter your address",
			city: "Please enter your city",
			state: "Please enter your state",
			zip: "Please enter your zip",
			country: "Please enter your country",
			phone: "Please enter your phone"
		}/*,
		submitHandler: function(form) {
			$(form).ajaxSubmit(function() {
				window.scroll(0,0);
				$("#contactForm").slideUp(800, function () {
					$("#thankyou").slideDown(300);
				});
			});
		}*/
	});
	
	//$("#zip").mask("99999");
	//$("#phone").mask("(999) 999-9999");
	//$("#fax").mask("(999) 999-9999");
	
	var loader = $('<div id="loader"><img src="images/loader.gif" alt="loading..." /></div>')
		.css({position: "absolute", top: "5px", left: "70px"})
		.appendTo("#submitButton")
		.hide();
	$().ajaxStart(function() {
		loader.show();
	}).ajaxStop(function() {
		loader.hide();
	}).ajaxError(function(a, b, e) {
		loader.hide();
		if(b.status == 403) {
			$('#submitButton').append('<label class="captcha error"><strong>Invalid Captcha, Try Again</strong></label>');
			Recaptcha.reload();
		}
	});
});