{% load i18n sanitize chimere_tags %}
{% if news_lst or welcome_message %}
<a href='#' id='welcome_button' class='ui-widget ui-button ui-state-default ui-corner-all'>{% trans "Welcome message"%}</a>
<script type='text/javascript'>
function display_welcome(){
    var width = $(window).width();
    width = width - 40*width/100;
    var height = $(window).height()-200;
    $("#welcome").dialog({title:"{% trans "Welcome"%}",
                          width:width, height:height});
}
$("#welcome_button").bind('click', display_welcome);
$(function(){
    $('#welcome div.media-player').jmeEmbedControls();
    $('#welcome video').each(function(index){$(this).pause()});
    $('#welcome audio').each(function(index){$(this).pause()});
    {% if display %}display_welcome();{%endif%}
});
</script>
<div id='welcome' style='display:none'>
    <div id='news_content'>
        {% if welcome_message %}
        <div id='welcome_message'>
            {{welcome_message|safe}}
        </div>
        {% endif %}
        <div class='news'>
            {% if news_lst %}
                {% for news in news_lst %}
                    <div class='info'>
                        {% if news.title %}
                            <h3>{{news.title}} &ndash; {{ news.date }}</h3>
                            <p>{{news.content|safe}}</p>
                        {% else %}
                            <h3>{{news.name}} &ndash; {{ news.start_date }}{% if news.end_date %} - {{ news.end_date }}{% endif %}</h3>
                            {% if news.default_pictures or news.default_pictures or news.default_multimedia_items%}
                            <div class='small-gallery'>
                            {% for picture in news.default_pictures %}
                                {% multimedia_render picture %}
                            {%endfor%}
                            {% for multimedia_item in news.default_multimedia_items %}
                                {% multimedia_render multimedia_item %}
                            {%endfor%}
                            </div>
                            {%endif%}
                            {% if news.description %}
                                <p class='description'>{{news.description|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td th tr"|safe}}</p>
                            {% endif %}
                            {% for property in news.getProperties %}
                                <p class='{{news.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td th tr"|safe }}</p>
                            {% endfor %}
                            <p class='marker_link'><a href='{% get_tinyfied_url news area_name %}'>{% trans "See it on the map"%}</a></p>
                        {% endif %}
                    </div>
                {%endfor%}
            {% endif %}
            <div class='info'>
            </div>
        </div>
    </div>
</div>
{% endif %}
