$(document).ready(function(){
//return;
	$("#tx_smenocontactform").validate({
		ignore: ".ignore",
		ignoreTitle: true,
		focusCleanup: true,
		onkeyup: false,
		errorPlacement: function(error, element) {
			fieldName = $(element).attr("name");
			if(typeof(this.messages[fieldName]) == "undefined") return true;
			
			error.insertAfter(element);
		},
		invalidHandler: function(form, validator) {
			$("#tx_smenocontactform div.warning").html("<p><strong>Merci de corriger les champs signal&eacute;s en rouge</strong></p>");
		},
		rules: {
			"tx_smenocontactform_pi1[lastname]" : "required",
			"tx_smenocontactform_pi1[firstname]" : "required",
			"tx_smenocontactform_pi1[bd_day]" : {
				required: true,
				min: 1
			},
			"tx_smenocontactform_pi1[bd_month]" : {
				required: true,
				min: 1
			},
			"tx_smenocontactform_pi1[bd_year]" : {
				required: true,
				min: 1
			},
			"tx_smenocontactform_pi1[mail]": {
				required: true,
				email: true
			},
			"tx_smenocontactform_pi1[message]": {
				required: true
			},
			"tx_smenocontactform_pi1[tel]": {
				required: true
			},
			"tx_smenocontactform_pi1[subject]": {
				min: 1
			},
			"tx_smenocontactform_pi1[city]": {
				min: 1
			}
		}
	});
	
	$('#tx_smenocontactform_pi1_subject').change(function(){
		$('#tx_smenocontactform_pi1_subject_tips p').each(function() {
			$(this).hide();
		});
		$("option:selected",this).each(function () {
			if($(this).attr('class') !== '') {
				var c = $(this).attr('class');
				$('#'+c).show();
			}
		});
	});

});
