$(document).ready(function(){
    if ($(".registerform").length) {
		$(".registerform").validate({
		rules: {
			firstname: "required",
			lastname: "required",
			phone: "required",
			email: {
				required: true,
				email: true
			},
			eligible: "required",
			otherservices: "required",
			resume: "required"
		},
		messages: {
			firstname: "Please enter your first name",
			lastname: "Please enter your last name",
			phone: "Please enter your telephone number",
			email: "Please enter a valid email address",
			eligible: "Please confirm whether you are eligible to work in the UK",
			otherservices: "Please confirm whether you would you be interested in hearing about any of the other services offered by Woodward Nash",
			resume: "Please attach your CV"
		},
		errorLabelContainer: $("#errorBox"),
		wrapper: "li" 
		});
	}
	$("#el1").click(function(){ $("#elhid").val('Yes'); });
	$("#el2").click(function(){ $("#elhid").val('No'); });
	$("#os1").click(function(){ $("#oshid").val('Yes'); });
	$("#os2").click(function(){ $("#oshid").val('No'); });
	var loc = window.location.toString().split("/");
    thelocation = loc[loc.length - 1];
	if (thelocation=='') { thelocation=loc[loc.length - 2]+'/'; 
	} else {thelocation=loc[loc.length - 2]+'/'+loc[loc.length - 1];
	}
	//alert(thelocation);
    $(".subnav a[href=\""+thelocation+"\"]").parent().addClass("active");});


(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","auto");
		});
	}
})(jQuery);



