var cities = { '': [ "Cape Coral",
"Estero",
"Fort Myers",
"Bonita Springs",
"La Belle",
"Lehigh Acres",
"Naples",
"North Cape Coral",
"Sanibel",
"St. James City",
"Fort Myers Beach" ],
'1': [ "Cape Coral" ],
'2': [ "Estero",
"Fort Myers" ],
'5': [ "Cape Coral",
"Fort Myers" ],
'7': [ "Cape Coral" ],
'8': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"La Belle",
"Lehigh Acres",
"Naples",
"North Cape Coral",
"Sanibel",
"St. James City" ],
'10': [ "Fort Myers",
"Naples" ],
'11': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"Fort Myers Beach",
"Lehigh Acres",
"North Cape Coral",
"St. James City" ],
'14': [ "Cape Coral",
"Fort Myers" ],
'15': [ "Cape Coral" ],
'16': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"North Cape Coral" ],
'17': [ "Bonita Springs",
"Cape Coral",
"Fort Myers" ],
'20': [ "Fort Myers" ],
'22': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"North Cape Coral" ],
'23': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"Lehigh Acres" ],
'24': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"North Cape Coral" ],
'25': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"North Cape Coral" ],
'28': [ "Fort Myers" ],
'29': [ "Cape Coral",
"Fort Myers",
"Lehigh Acres" ],
'34': [ "Cape Coral",
"Fort Myers",
"Naples" ],
'36': [ "Cape Coral",
"Estero",
"Fort Myers",
"Lehigh Acres" ],
'38': [ "Fort Myers" ],
'39': [ "Cape Coral",
"Fort Myers",
"Lehigh Acres" ],
'41': [ "Cape Coral" ],
'46': [ "Fort Myers" ],
'52': [ "Cape Coral",
"Fort Myers",
"Lehigh Acres" ],
'55': [ "Fort Myers" ],
'56': [ "Fort Myers" ],
'57': [ "Cape Coral",
"Fort Myers" ],
'59': [ "Cape Coral",
"Fort Myers" ],
'60': [ "Bonita Springs",
"Fort Myers" ],
'61': [ "Cape Coral",
"Fort Myers",
"Naples" ],
'63': [ "Fort Myers" ],
'67': [ "Fort Myers",
"Naples" ],
'69': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"Lehigh Acres" ],
'71': [ "Fort Myers",
"Naples" ],
'72': [ "Bonita Springs" ],
'73': [ "Fort Myers" ],
'74': [ "Estero",
"Fort Myers" ],
'75': [ "Estero",
"Fort Myers" ],
'76': [ "Fort Myers" ],
'77': [ "Cape Coral",
"Fort Myers" ],
'78': [ "Fort Myers" ],
'79': [ "Fort Myers" ],
'80': [ "Bonita Springs",
"Cape Coral",
"Fort Myers",
"North Cape Coral" ] }

function populateLocation() { // {{{
    var specialty = $('#specialty').val().replace(' ', '')
    var city = $('#location').val()
    var cityele = $('#location').val('').empty()
    var o

    if (cities[specialty]) {
        o = $(document.createElement('option'))
        o.val('').text('(all locations)')
        cityele.append(o).attr('disabled', false)
        for (x=0; x<cities[specialty].length; x++) {
            o = $(document.createElement('option'))
            o.val(cities[specialty][x]).text(cities[specialty][x])
            cityele.append(o)
            if (city == cities[specialty][x])
                o.attr('selected', true)
        }

    } else {
        o = $(document.createElement('option'))
        o.val('').text('(all locations)')
        cityele.append(o).attr('disabled', true)
    }
} // }}}

$(document).ready(function () {
    populateLocation()
    $('#specialty').change(populateLocation)
})
