$(document).ready(function () {
	$('#sendContactForm').submit(function () {
		$('._phone').each(function () {
			this.value = this.value.toString().split(" ").join("").split("-").join("");
		});
	});


	$('#sendContactForm').validate({
		rules: {
			name: {
				required: true
			},
			surname: {
				required: true
			},
			agree1: {
				required: true
			},
			email: {
				required: true,
				email: true
			},
			phone: {
				required: true
			},
			address: {
				required: true
			},
			city: {
				required: true
			},
			post_code: {
				required: true
			},
			message: {
				required: {
                  depends: function() {
                      return ($('input[name=referat]:checked').val() == '1' || $('input[name=poster]:checked').val() == '1');
                  }
              }
			},
			message_long: {
				required: {
                  depends: function() {
                      return $('input[name=referat]:checked').val() == '1' || $('input[name=poster]:checked').val() == '1';
                  }
              }
			},
			hiddenRecaptcha: {
				required: function () {
					if (grecaptcha.getResponse() == '') {
                      $('#hiddenRecaptcha').valid();
						return true;
					} else {
						return false;
					}
				}
			}
		},
		errorElement: "p",
		errorClass: "warning"
	});


});


//function recaptchaCallback() {
//	$('#hiddenRecaptcha').valid();
//}
//;