    function jobTypeChangeEvent(form)
    {
        // Build the salary range drop down list if possible
        buildsalaryRangeSelectControl(form);
    }

    function buildsalaryRangeSelectControl(thisForm)
    {

        // Clear the select control
        clearSelectControl(thisForm.salaryRange);

        // Get the selected parent value (country)
        var selectedParentValueCountry;
        selectedParentValueCountry = thisForm.homeCountryId.value;

        // Get the selected parent value (jobType)
        var selectedParentIndexJobType, selectedParentValueJobType;

        var user_input = '';
        for (i=0;i<thisForm.jobTypeIds.length;i++)
        {
          if (thisForm.jobTypeIds[i].checked)
          {
           selectedParentIndexJobType = i;
           selectedParentValueJobType = thisForm.jobTypeIds[i].value;
          }
        }

	// If a jobtype and country hasn't been selected then the list can't be built
        if (selectedParentIndexJobType < 0) {
            var newOp = new Option(thisForm.selectJobTypeMessage.value, '0', true, true);
            thisForm.salaryRange.options[thisForm.salaryRange.length] = newOp;
            return;
        }

        // The key used to find the index in the salaryRangeOptions array is a combination
        // of the countryId and the jobtypeId
        var parentKey = selectedParentValueCountry + "-" + selectedParentValueJobType;

        // Search for the key in the parent array list to try and find it's index
        // that will be used in the children array.
        var found = false;
        var childrenIndex;
        for (var i=0; i < countryJobType.length && !found; i++) {
            if (countryJobType[i] == parentKey) {
                found = true;
                childrenIndex = i;
            }
        }

        // Loop through the parent's children array and add each one as an option
        // to the select control
        if (found && salaryRangeOptions[childrenIndex].length > 0) {
            // enable the child
             thisForm.salaryRange.disabled = false;

            // Add any pre options that are to be added to each children list
            var newOp = new Option(thisForm.availableSalaryRangesMessage.value, '0', true, true);
            thisForm.salaryRange.options[thisForm.salaryRange.length] = newOp;

            // Loop through the parent's children array and add each one as an option
            // to the select control
            for (var i=0; i < salaryRangeOptions[childrenIndex].length; i++) {
                var newOp = new Option(salaryRangeOptions[childrenIndex][i][0], salaryRangeOptions[childrenIndex][i][1], false, false);
                thisForm.salaryRange.options[thisForm.salaryRange.length] = newOp;
            }
        }
        else {

            // Add any pre options that are to be added to each children list
            var newOp = new Option(thisForm.availableSalaryRangesMessage.value, '0', true, true);
            thisForm.salaryRange.options[thisForm.salaryRange.length] = newOp;
            
            // Loop through the parent's children array and add each one as an option
            // to the select control
            for (var i=0; i < salaryRangeAllOptions.length; i++) {
                var newOp = new Option(salaryRangeAllOptions[i][0], salaryRangeAllOptions[i][1], false, false);
                thisForm.salaryRange.options[thisForm.salaryRange.length] = newOp;
            }        	
        	
        	
//        	
//            // Add a reason for the user to explain why there are no salaries
//            var newOp = new Option(thisForm.noSalaryRangeAvailableMessage.value, '-2', true, true);
//            thisForm.salaryRange.options[thisForm.salaryRange.length] = newOp;
//
//            // Disable the child
//            thisForm.salaryRange.disabled = false;
//            thisForm.salaryRange.selectedIndex = 0;
        }
    }

    function clearSelectControl(controlObject) {

        // Clear the select control
        while (controlObject.length > 0) {
            controlObject.options[0] = null;
        }
    }

    function buildSubSpecialisationSelectControl(thisForm) {
        // Clear the select control
        clearSelectControl(thisForm.subSpecialisations);

        // Get the selected parent value
        var selectedParentIndex, selectedParentValue;
        selectedParentIndex = thisForm.parentSpecialisationIds.selectedIndex;
        selectedParentValue = thisForm.parentSpecialisationIds.options[selectedParentIndex].value;

        // Search for the value in the parent array list to try and find it's index
        // that will be used in the children array. This needs to be done instead of
        // simply using the parent index incase a 'please select....' option has been added
        // to the parent control
        var found = false;
        var childrenIndex;
        for (var x=0; x < subSpecialisationsKey.length && !found; x++) {
            if (subSpecialisationsKey[x] == selectedParentValue) {
                found = true;
                childrenIndex = x;
            }
        }

            // Add any pre options that are to be added to each children list
        var newOp = new Option(thisForm.subspecialisation.value, '0', true, true);
        thisForm.subSpecialisations.options[thisForm.subSpecialisations.length] = newOp;

        // Loop through the parent's children array and add each one as an option
        // to the select control
        if (found) {
            // enable the child
             thisForm.subSpecialisations.disabled = false;

            // Loop through the parent's children array and add each one as an option
            // to the select control
// alert(subSpecialisationsOptions[childrenIndex].length-1);
            var lengthy = subSpecialisationsOptions[childrenIndex].length;
            for (var i=0; i < lengthy; i++) {
             var newOp = new Option(subSpecialisationsOptions[childrenIndex][i][0], subSpecialisationsOptions[childrenIndex][i][1], false, false);
// alert(subSpecialisationsOptions[childrenIndex][i][0]);
             thisForm.subSpecialisations.options[thisForm.subSpecialisations.length] = newOp;
            }
        }
        else {
            // Disable the child
             thisForm.subSpecialisations.disabled = true;
             thisForm.subSpecialisations.selectedIndex = -1;
        }
    }
