$(document).ready(function() {
   jQuery.validator.addMethod("notequalto", function(value, element,param) {
      if(value != param) { return true; }
   });

   var validator = $("#maintenance_request_form").validate({
      rules: {
         name: "required",
         address: "required",
         email: {
            required: true,
            email: true
         },
         email_verify: {
            required: true,
            email: true,
            equalTo: "#email"
         },
         request_where: {
            required: true,
            notequalto: 0
         },
         request_new: {
            required: true,
            notequalto: 0
         },
         description: "required",
         permission: {
            required: true,
            notequalto: 0
         }
      },
      messages: {
         name: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter your name.</div>",
         address: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter your address.</div>",
         email: {
            required: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter your email.</div>",
            email: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter a valid email.</div>"
         },
         email_verify: {
            required: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter your email.</div>",
            email: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter a valid email.</div>",
            equalTo: "<div style=\"color: red; clear: both; font-weight: bold;\">Email addresses do not match.</div>"
         },
         request_where: {
            required: "<div style=\"color: red; clear: both; font-weight: bold;\">Please select an option.</div>",
            notequalto: "<div style=\"color: red; clear: both; font-weight: bold;\">Please select an option.</div>"
         },
         request_new: {
            required: "<div style=\"color: red; clear: both; font-weight: bold;\">Please select an option.</div>",
            notequalto: "<div style=\"color: red; clear: both; font-weight: bold;\">Please select an option.</div>"
         },
         description: "<div style=\"color: red; clear: both; font-weight: bold;\">Please enter a description.</div>",
         permission: {
            required: "<div style=\"color: red; clear: both; font-weight: bold;\">Please select an option.</div>",
            notequalto: "<div style=\"color: red; clear: both; font-weight: bold;\">Please select an option.</div>"
         }
      }
   });
});