$(document).ready(function(){
$("#contact_form").validate({

showErrors: function() {
                for ( var i = 0; this.errorList[i]; i++ ) {
                        this.settings.highlight.call( this, this.errorList[i].element,
this.settings.errorClass );
                }
                if (this.settings.unhighlight) {
                        for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
                                this.settings.unhighlight.call( this, elements[i],
this.settings.errorClass );
                        }
                }
        },

highlight: function(element, errorClass) {
     $(element).addClass(errorClass);
  },
  unhighlight: function(element, errorClass) {
     $(element).removeClass(errorClass);
  },

rules: {
	/*project_type: {
		required: true
	},*/

	name: {
		required: true,
		minlength: 2,
		maxlength: 55
	},

	company_name: {
		required: true,
		minlength: 2,
		maxlength: 55
	},

	phone: {
		required: true,
		minlength: 10,
		maxlength: 15
	},

	email: {
		required: true,
		email: true
	},

	details: {
		required: true,
		minlength: 5,
		maxlength: 1024
	}
},

invalidHandler: function(form, validator) {
      var errors = validator.numberOfInvalids();
      if (errors) {
        alert("Almost there...some of the fields are incomplete, which are highlighted in red. Please check those fields, correct the errors and resubmit your inquiry. Thanks!")
      }
    }

});
});