
  /*if the document has finished loading*/
  $(document).ready(function () {

    /*when the sector option changes set the value for the listName and sector
    required by pure*/
    $("#optionListName").change(function(event) {

      var optionvalue;
      optionvalue = $("#optionListName").val();
      //console.debug(optionvalue);
      $("#sector").val($("#optionListName").val());
      if(optionvalue == 'Primary') {
        $("#listName").val("primary");
      } else {
        $("#listName").val("secondary_and_other");
      }
      //console.debug($("#listName").val());
      //alert($("#listName").val());
    });

    /*some form validation */
    $("form").submit(function(event) {
      if($("#email").val() == "") {
        alert("You must enter an email.");
        return false;
      } else if($("#optionListName").val() == "") {
        alert("Please select a sector.");
        return false;
      } else if($("#job_title").val() == "") {
        alert("Please select you role.");
        return false;
      }
    });
    /*end form validation */

  });
