﻿$(document).ready(function() {
    $("#SelectVacancyByArea").change(function() {
        if ($(this).val() == "London Head Office") {
            var thisValue = 'Business Manager';
            var thisText = 'Business Manager';
            var thisOpt = document.createElement('option');
            thisOpt.value = thisValue;
            thisOpt.setAttribute("id", "BusinessManagerOption");
            thisOpt.appendChild(document.createTextNode(thisText));

            $("#SelectVacancyByType").append(thisOpt);

        }
        else {
            removeBusinessManagerOption();
        }
    })

    removeBusinessManagerOption();
});

function removeBusinessManagerOption()
{
    $("#SelectVacancyByType").children("option").each(function() {
        var thisoption = $(this);
        if (thisoption.val() == 'Business Manager') {
            thisoption.remove();
        }
    })
}