{% extends "events/base.html" %}
{% load pagination_tags %}
{% load event_tags %}
{% load base_tags %}
{% load perm_tags %}
{% load search_tags %}
{% load i18n %}

{% block title %}{{ block.super }}Search{% endblock %}

{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}css/events.css">
<link type="text/css" href="{{ STATIC_URL }}css/jquery_ui_all_custom/jquery-ui-1.8.5.custom.css" rel="stylesheet" />
<link rel="stylesheet" href="{{ STATIC_URL }}css/events-search.css">
<link rel="alternate" type="application/rss+xml" title="Latest Events" href="{% url event.feed %}" />
{% endblock %}

{% block body %}

<div class="t search-view">
{% event_nav request.user %}
    <h1>{{ SITE_GLOBAL_SITEPRIMARYKEYWORDS }} {% firstof MODULE_EVENTS_LABEL_PLURAL 'Events' %}</h1>  

    {% autopaginate events 10 %}
    {% event_search %}
    <div class="highlight">
            You found {{ paginator.count }} event{{ paginator.count|pluralize }}{% if with_registration %} with registration{% endif %}{% if event_type %}.{% else %} starting on or after {{ start_dt|date:"F jS, Y" }}.{% endif %}
    </div>

    <div class="events-wrap">
    {% for event in events %}
        {% search_result event %}
    {% endfor %}
    </div>

    {% paginate %}
</div>
{% endblock %}

{% block extra_body %}
    {{ block.super }}

    <script type="text/javascript" src="{{ STATIC_URL }}js/global/dropdown.js"></script>
	<script type="text/javascript">
		var iconrow = new dropdown({
			container:	'more-options-wrap',
			trigger:	'more-options-trigger',
			target:		'more-options-target'
		});
	</script>
	<script src="{{ STATIC_URL }}js/jquery.inputfieldtext.js" type="text/javascript"></script>
	<script type="text/javascript" src="{{ STATIC_URL }}js/jquery_ui_all_custom/jquery-ui-1.8.5.custom.min.js"></script>
	<script type="text/javascript">
	   $(".datepicker").live('focus', function() {
            console.log('this', this);
            $(this).datepicker({ dateFormat: 'yy-mm-dd' });
       });
		// Dialog			
		$('#event_export_dialog').dialog({
			autoOpen: false,
			width: 600,
			buttons: { 
				"Close": function() { 
					$(this).dialog("close"); 
				} 
			}
		});
		// Dialog Link
		$('#event_export_link').click(function(){
			$('#event_export_dialog').show();
	        $('#event_export_dialog').dialog('open'); 
	 
			return false;
		});
	</script>
{% endblock %}
