{% load i18n %}
{% if areas and areas.count > 1 %}
    <div id='areas-div'>
        <label for='areas-select'>{% trans "Areas:" %}</label>
        <select id='areas-select'>
            {% if not has_default_area %}<option value=''>--</option>{% endif %}
        {% for area in areas %}
            <option value='{{area.urn}}'{% if area_name and area.urn == area_name %} selected='selected'{% endif %}{% if not area_name and area.default %} selected='selected'{% endif %}>{{area.name}}</option>
        {% endfor %}
        </select>
    </div>
    <script language='javascript' type='text/javascript'>
    jQuery('#areas-select').change(
        function (){
            val = jQuery(this).val();
            if(val){
                window.location = "{{ base_url }}" + jQuery(this).val();
            }
            else{
                window.location = "{{ base_url }}";
            }
        }
    );
    </script>
{% endif %}
