function ToggleSection(sectionName){
		if ($(this).attr("checked")) {
			$(sectionName).show();
		} else {
			$(sectionName).hide();
		}
	}

$(document).ready(function() {
	 // hide extra form sections
	 $("#SectionDismissal").hide();
	 $("#SectionDiscrimination").hide();
	 $("#SectionRedundancy").hide();
	 $("#SectionPaymentsOwed").hide();
	 $("#SectionComplaints").hide();
						   
     // setup togglers
	 $("#SelectDismissal").click(function(){
		if ($(this).attr("checked")) {
			$("#SectionDismissal").show();
		} else {
			$("#SectionDismissal").hide();
		}
  	 });
	 
	 $("#SelectDiscrimination").click(function(){
		if ($(this).attr("checked")) {
			$("#SectionDiscrimination").show();
		} else {
			$("#SectionDiscrimination").hide();
		}
  	 });
	 
	 $("#SelectRedundancy").click(function(){
		if ($(this).attr("checked")) {
			$("#SectionRedundancy").show();
		} else {
			$("#SectionRedundancy").hide();
		}
  	 });
	 
	 $("#SelectPaymentsOwed").click(function(){
		if ($(this).attr("checked")) {
			$("#SectionPaymentsOwed").show();
		} else {
			$("#SectionPaymentsOwed").hide();
		}
  	 });
	 
	 $("#SelectComplaints").click(function(){
		if ($(this).attr("checked")) {
			$("#SectionComplaints").show();
		} else {
			$("#SectionComplaints").hide();
		}
  	 });
	 
						   
	 // http://docs.jquery.com/Plugins/Validation
	 $("#questionnaire").validate({
		rules: {
			Title: "required",
			FirstName: "required",
			Surname: "required",
			DateOfBirth: "required",
			Address: "required",
			ContactNumber: "required",
			EmailAddress: {
				required: true,
				email: true
			},
			EmployerName: "required",
			EmployerAddress: "required",
			EmploymentStartDate: "required",
			EmploymentEndDate: "required",
			EmploymentContinuing: "required",
			JobTitle: "required",
			HoursWorkedPerWeek: "required",
			TotalPaid: "required"
		},
		messages: {
			Title: "Please enter your title",
			FirstName: "Please enter your first name",
			Surname: "Please enter your surname",
			DateOfBirth: "Please enter your date of birth",
			Address: "Please enter your address",
			ContactNumber: "Please enter your contact number",
			EmailAddress: {
				required: "Please enter your email address",
				email: "Please enter a valid email address"
			},
			EmployerName: "Please enter your employers name",
			EmployerAddress: "Please enter your employers address",
			EmploymentStartDate: "Please enter your employment start date",
			EmploymentEndDate: "Please enter your employment end date",
			EmploymentContinuing: "Please enter if your employment is continuing",
			JobTitle: "Please enter your job title",
			HoursWorkedPerWeek: "Please enter the hours you have worked per week",
			TotalPaid: "Please enter the total amount you were paid"
		},
		errorElement: "div",
        highlight: function(element, errorClass) {
		 $(element).parent("li").animate({ backgroundColor: "#ffff66" }, 'fast').animate({ backgroundColor: "#ffffff" }, 'slow');
		},
		
		onkeyup: false		
/*		success: function(element, errorClass) {
		 $(element).parent("li").animate({ backgroundColor: "#73B829" }, 'fast').animate({ backgroundColor: "#ffffff" }, 'fast');
		}*/
/*		onfocusout: false,
		errorContainer: "#errorModalConten2t",
		errorLabelContainer: "#errorList",
		wrapper: "li",
		showErrors: function(errorMap, errorList) {
				this.defaultShowErrors();			
				$("#errorModalContent").modal();
				}*/
		});

});
