// include SPECIFIC PAGE LEVEL SCRIPTS 
document.write('<script src="assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>');

/////////////////////////////////////
jQuery(document).ready(function() {
	App.init();

	$('#change-password-form').validate({
		ignore: "",
		errorElement: 'label', //default input error message container
//            errorClass: 'help-block', // default input error message class
		focusInvalid: false, // do not focus the last invalid input
		rules: {
			current_password: "required",
			new_password: "required",
			retype_password: {
				"required": true,
				"equalTo": "#new_password"
			}
		},
		messages: {
			current_password: "Veuillez entrer votre password actuel.",
			new_password: "Veuillez entrer votre nouveau password.",
			retype_password: {
				"required": "Veuillez re-entrer votre nouveau password.",
				"equalTo": "Les deux passwords ne corresondent pas."
			}
		},
		invalidHandler: function(event, validator) { //display error alert on form submit   
			// $('.alert-danger', $('#change-password-form')).show();

		},
		highlight: function(element) { // hightlight error inputs
			$(element).closest('.form-group').addClass('has-error'); // set error class to the control group
		},
		success: function(label) {
			var a = label.closest('.form-group');
			label.closest('.form-group').removeClass('has-error');
			label.remove();
		},
		errorPlacement: function(error, element) {
			//error.insertAfter(element.closest('.input-icon'));
			error.appendTo(element.parent("div"));
		}
	});
});