var gCareer1 = {

        oldList: null,

        idLet: '',

        idList: '',

        init: function (idLet, idList) {
              this.idLet = idLet;
              this.idList = idList;
              this.oldList = $("#"+this.idList+" option");
              this.selChange();
              $("#"+this.idLet).change();
        },

        selChange: function () {
            $("#"+gCareer1.idLet).change(function() {
                $("#"+gCareer1.idList+" option").remove();
                var lit = this.options[this.selectedIndex].value.toLowerCase();
                $(gCareer1.oldList).each(function (i, option) {
                    if (option.text[0].toLowerCase() == lit) {
                        $("#"+gCareer1.idList).append('<option value="' + option.text + '">' + option.text + '</option>');
                    }
                });
            });
        },
    };
    
    var gCareer2 = {

        oldList: null,

        idLet: '',

        idList: '',

        init: function (idLet, idList) {
              this.idLet = idLet;
              this.idList = idList;
              this.oldList = $("#"+this.idList+" option");
              this.selChange();
              $("#"+this.idLet).change();
        },

        selChange: function () {
            $("#"+gCareer2.idLet).change(function() {
                $("#"+gCareer2.idList+" option").remove();
                var lit = this.options[this.selectedIndex].value.toLowerCase();
                $(gCareer2.oldList).each(function (i, option) {
                    if (option.text[0].toLowerCase() == lit) {
                        $("#"+gCareer2.idList).append('<option value="' + option.text + '">' + option.text + '</option>');
                    }
                });
            });
        },
    };
    
    var gCareer3 = {

        oldList: null,

        idLet: '',

        idList: '',

        init: function (idLet, idList) {
              this.idLet = idLet;
              this.idList = idList;
              this.oldList = $("#"+this.idList+" option");
              this.selChange();
              $("#"+this.idLet).change();
        },

        selChange: function () {
            $("#"+gCareer3.idLet).change(function() {
                $("#"+gCareer3.idList+" option").remove();
                var lit = this.options[this.selectedIndex].value.toLowerCase();
                $(gCareer3.oldList).each(function (i, option) {
                    if (option.text[0].toLowerCase() == lit) {
                        $("#"+gCareer3.idList).append('<option value="' + option.text + '">' + option.text + '</option>');
                    }
                });
            });
        },
    };


    $(document).ready(function(){
        gCareer1.init('career_letter_1', 'career_1');
        gCareer2.init('career_letter_2', 'career_2');
        gCareer3.init('career_letter_3', 'career_3');
    });






