$(document).ready(function() {
	// validate signupform on keyup and submit
	var validator = $("#frmGeneral").validate({
		rules: {
			firstname: "required",
			lastname: "required",
			email: "required",
			companyname: "required",
			phone: "required",
			code: "required",
			street: "required",
			suburb: "required",
			city: "required",
			postcode: "required"
		},
		messages: {
			firstname: "<img src=\"images/error.gif\" alt=\"Enter your first name\" border=\"0\" />",
			lastname: "<img src=\"images/error.gif\" alt=\"Enter your last name\" border=\"0\" />",
			email: "<img src=\"images/error.gif\" alt=\"Enter your email\" border=\"0\" />",
			companyname: "<img src=\"images/error.gif\" alt=\"Enter your company name\" border=\"0\" />",
			phone: "<img src=\"images/error.gif\" alt=\"Enter your phone number\" border=\"0\" />",
			comment: "<img src=\"images/error.gif\" alt=\"Enter a comment\" border=\"0\" />",
			code: "<img src=\"images/error.gif\" alt=\"Enter security code\" border=\"0\" />",
			street: "<img src=\"images/error.gif\" alt=\"Enter security code\" border=\"0\" />",
			suburb: "<img src=\"images/error.gif\" alt=\"Enter security code\" border=\"0\" />",
			city: "<img src=\"images/error.gif\" alt=\"Enter security code\" border=\"0\" />",
			postcode: "<img src=\"images/error.gif\" alt=\"Enter security code\" border=\"0\" />"
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
				error.appendTo( element.parent().next() );
		},
		// specifying a submitHandler prevents the default submit, good for the demo
		submitHandler: function() {
			doWork();
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {

		}
	});

});

