// JavaScript Document
//login page javascript

$(document).ready(function() {
	// Change password form validation
	$("#changePassForm").validate({
		rules: {
			oldPassword: {
				required: true,
				equalTo: "#oldHidPass"
			},
			newPassword: {
				required: true,
				minlength: 6
			},
			confirmPassword: {
				required: true,
				equalTo: "#newPassword"
			}
		},
		messages: {
			oldPassword: {
				required: "Enter old password.",
				equalTo: "Wrong old password."
			},
			newPassword: {
				required: "Enter new password.",
				minlength: "Enter at least 6 characters."
			},
			confirmPassword: {
				required: "Confirm new password.",
				equalTo: "Enter same password as above."
			}
		}
  	});
	// Change Email form validation
	$("#changeEmailForm").validate({
		rules: {
			username: {
				required: true,
				equalTo: "#usernameHidd"
			},
			newEmail: {
				required: true,
				email: true
			}
		},
		messages: {
			username: {
				required: "Enter old email.",
				equalTo: "Old email did not match in the system."
			},
			newEmail: {
				required: "Enter new email address.",
				email: "Invalid email address."
			}
		}
  	});
	
});