$(document).ready(function() {

    $('.weather_city_dd').click(function(e) {
        e.stopPropagation();
        if ($(this).hasClass('weather_city_dd_active')) {
            $(this).parent().find('span:eq(0)').css('color', '#333');
            $('.weather_city_dd_active').removeClass('weather_city_dd_active');
            $('#weather_city_dd').hide();
        }
        else {
            $(this).parent().find('span:eq(0)').css('color', '#fff');
            $('.weather_city_dd_active').removeClass('weather_city_dd_active');
            $(this).addClass('weather_city_dd_active');
            $(this).parent().append($('#weather_city_dd'));
            $('#weather_city_dd').show();
            $('#defaultCities').uncolumnlists();
            $('#defaultCities').makeacolumnlists({ cols: 3, equalHeight: true });
        };
        e.preventDefault();
    });

    $('#weather_city_dd').click(function(e) {
        e.stopPropagation();
    });
    $(document).click(function() {
        $('.weather_city_dd').parent().find('span:eq(0)').css('color', '#333');
        $('.weather_city_dd_active').removeClass('weather_city_dd_active');
        $('#weather_city_dd').hide();
    });
});