$(function(){
  $("#postcode").predictOzState($("#state"));
  $("#currentInsurer").change(function() {
    $("#otherInsurerSet").toggle(this.value == "OTHER");
    $("#otherInsurer")[0].validated = false;//reset validation
  }).change();

  $("#otherInsurer").addValidation(function() {
    if (!(this.valid = !(this.form["currentInsurer"].value == "OTHER" && this.value == ""))) {
      this.error = "Value not entered";
    }
  });
  
  $("#publicLiability1").click(function() {
		if (this.form["associationLiability"][0].checked) {
			this.form["associationLiability"][1].checked = true;
		}
	});
  
  $("#associationLiability0").click(function() {
		this.form["publicLiability"][0].checked = true;
	});
});
