function validate_form(thisform, required) {
	var error = false;
	var total = 0;
	var errorbox = "";
	for (var i in required) {
		if (typeof required[i] == 'string') {
			if ($("#"+required[i], thisform).val() === '') {
				$("#"+required[i], thisform).addClass("invalid");
				error = true;
				errorbox = required[i];
				total++;
			} else {
				$("#"+required[i], thisform).removeClass("invalid");
			}
		} else if (typeof required[i] == 'object') {
			if ($("#"+required[i][0], thisform).val() === required[i][1]) {
				$("#"+required[i], thisform).addClass("invalid");
				error = true;
				errorbox = required[i];
				total++;
			} else {
				$("#"+required[i], thisform).removeClass("invalid");
			}
		}
	}
	if (error) {
		var suffix = '';
		if (total > 1) {
			suffix = "es";
		} else {
			suffix = "";
			$("#"+errorbox, thisform).focus();
		}
		$("#error", thisform).html("<p>Sorry, but you did not complete the form correctly.<br />Please correct the box"+suffix+" highlighted in green.</p>").show("slow");
		return false;
	} else {
		return true;
	}

}