// JavaScript Document
$(document).ready(function () {
					jQuery.validator.addMethod("phoneUS", function(cphone, element) {
						cphone = cphone.replace(/\s+/g, ""); 
						return this.optional(element) || cphone.length > 9; 
						cphone.match(/^(1\s*[-\/\.]?)?(\((\d{3})\)|(\d{3}))\s*[-\/\.]?\s*(\d{3})\s*[-\/\.]?\s*(\d{4})\s*(([xX]|[eE][xX][tT])\.?\s*(\d+))*$/);
					},
					"Please enter a valid phone number.  Ex: (+800) 555-5555");
					jQuery.validator.messages.required = "";
					$("#commentForm").validate({
						invalidHandler: function(e, validator) {
							var errors = validator.numberOfInvalids();
							if (errors) {
								var message = errors == 1
									? 'You missed 1 field. It has been highlighted below'
									: 'You missed " + errors + " fields.  They have been highlighted below';
								$("div.content-important").addClass('content-warning');
								$("div.content-important").removeClass('content-important');
								$("div.content-warning").html(message);
								// $("div.content-warning").show();
							} else {
								$("div.content-warning").hide();
							}
						},
						rules: {
							cphone: {
							  required: true,
							  phoneUS: true		
							 }
						 },
						messages: {
							cName: "Please enter your full name",
							cTitle: "Please enter your job title",
							cCompany: "Please enter your company's name",
							cIndustry: "Please select an industry",
							cHowHear: "Please make a selection",
							cphone :{
								required: "please enter a phone number"
								},
							cEmail: {
								required: "Please enter an email address",
								email: "Please enter a valid email address",
								remote: jQuery.validator.format("{0} is already taken, please enter a different address.")	
							},
							cComments: "Please tell us about your needs"
						}
					});
});