{% if display_tools is not defined %}
  {% set display_tools = false %}
{% endif %}
{% if display_help_notags is not defined %}
  {% set display_help_notags = false %}
{% endif %}

<a title="{{ 'tags.prompt.help_box_title'|trans({}, 'userui') }}" href="{{ path('helpbox_bootstrap', {'ressource_id':'tags_prompt'}) }}" class="helpbox tag_prompt_tool tags_prompt_helpbox">
  <img alt="help ?" src="{{ asset('img/1362157855_help.png') }}" />
</a>

{% if display_tools %}

  <a title="{{ 'tags.prompt.remove_all'|trans({}, 'userui') }}" href="#" class="tag_prompt_tool tags_prompt_remove_all">
    <img alt="remove_all" src="{{ asset('img/icon_close_red.png') }}" />
  </a>

  <a title="{{ 'tags.prompt.favorites'|trans({}, 'userui') }}" href="{{ path('ajax_get_favorites_tags', {'favorites' : true}) }}" class="tag_prompt_tool tags_prompt_favorites">
    <img alt="favorites" src="{{ asset('img/icon_heart.png') }}" />
  </a>

{% endif %}

<div class="tags_prompt" id="tags_prompt_{{ form_name }}">
   
  <ul class="tagbox"></ul>
  
  {% if display_help_notags %}
    <p class="help_notags" {% if search_tags is defined %}{% if search_tags|length %}style="display: none;"{% endif %}{% endif %}>
      <img src="{{ asset('/img/1372956700_gnome-dev-symlink.png') }}" alt="here" />
      <span>{{ 'filter.help_text'|trans({}, 'userui') }}</span>
    </p>
  {% endif %}
  <div style="clear: both;"></div>
  
  <input
    class="tag_prompt niceinput"
    value=""
    placeholder="{{ 'tags.inputtext.help'|trans({}, 'userui') }}"
  />
  <img id="tag_prompt_loader_{{ form_name }}" class="tag_loader" style="display: none;"
    src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
  
  <div id="search_tag_{{ form_name }}" class="search_tag_list" style="display: none;">
    <span class="info"></span>
    <p class="help">
      {{ 'tags.prompt.help'|trans({}, 'userui') }}
    </p>
    <div class="tag_loader_div">
      <img id="tag_loader_{{ form_name }}" class="tag_loader" style="display: none;"
        src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
    </div>
    <ul class="search_tag_list"></ul>
    <div class="textcenter">
      <a class="more button" href="#" style="display: none;">
        {{ 'tags.search.display_more'|trans({}, 'userui') }}
      </a>
    </div>
  </div>
  
</div>

<script language="javascript" type="text/javascript">
  $(document).ready(function(){
    
    window.{{ form_name }}_tag_prompt_connector = new TagPromptConnector(
      $('form[name="{{ form_name }}"] input.tag_prompt'),
      $('form[name="{{ form_name }}"] input.tagBox_tags_ids'),
      $('form[name="{{ form_name }}"] div.search_tag_list'),
      $('form[name="{{ form_name }}"] ul.tagbox'),
      $('#tag_prompt_loader_{{ form_name }}')
    );
    
    var {{ form_name }}_taginit = new Array();
    {% if search_tags is defined %}
      {% for tid, tname in search_tags %}
        {{ form_name }}_taginit[{{ loop.index0 }}] = {"id":"{{ tid }}", "name":"{{ tname }}"};
      {% endfor %}
    {% endif %}
    
    window.{{ form_name }}_tag_prompt_connector.initializeTags({{ form_name }}_taginit);
  
  });
</script>