
<%= stylesheet_link_tag "gallery" %>

<div id="orbit_gallery" class="rg">
  <div class="rgbody">
    <div id="imgholder">
      <div class="rslide" style="position:relative; width:100%;">
        <div class="rslideinside"><div id="loading" style="display:none;"></div>
          <div class="comp" id='main_pic' data-content='<%= @image.gallery_album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.url %>" alt="" /></a></div>
          <div class="rslidenav">
            <a href="" class="navP" title="上一張" onclick="return false;">Prev</a>
            <a href="" class="navN" title="下一張" onclick="return false;">Next</a>
          </div>
        </div>
        <div class="slidelist">
          <ul id='galleryimagelist' style="display:none;">
            <% @images.each_with_index do |image,i| %>
              <li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
            <% end  %>
          </ul>
        </div>
        <div class="slidectrl">
          <a href="" class="togglescreen" title="切換全螢幕" onclick="return false;">Screen</a>
          <a href="" class="togglelist" title="顯示照片清單" onclick="return false;">List</a>
          <a href="" class="browserfullscreen" title="顯示照片清單" onclick="return false;">F</a>
          <div class="slideinfo">
            <span class="info"><%= @image.description %></span>
          </div>
        </div>
      </div>
    </div>
  </div>

  <% if is_admin? %> 
  <!--  #TODO or 類別屬於他 -->
  <!-- tag part -->
  <div id="tag_panel" class="my_scroll">
    <div class="scrollbar">
      <div class="track">
        <div class="thumb">
          <div class="end"></div>
        </div>
      </div>
    </div>
     <% 
        @locales = Array.new
        @site_valid_locales.each do |locale|
          @locales << locale
        end
      %>
    <div class="viewport">
      <div class="overview">
        <ul class="tag_list" id="gallery_tag_list">
          <%# if @authenticated %>
          <% @tags.each do |tag| %>
             <li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
          <% end %>
          <%# end %>
        </ul>
      </div>
    </div>
    <%# if @authenticated %>
     <div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
    <%# end %>
    
  </div>

  <%end%>
  
  <script type="text/javascript">
      var $tag_panel = $('#tag_panel');
          orbit_bar_height = $('#orbit-bar').outerHeight();
          action_panel_height = $('.form-actions').outerHeight();
          window_height = $(window).height();

      
      $tag_panel.height( window_height - orbit_bar_height - 90 );
      $tag_panel.tinyscrollbar();

      $(window).resize(function(){
        $tag_panel.tinyscrollbar_update('relative');
        $tag_panel.height( $(window).height() - orbit_bar_height - 90 );
      });

      
  </script>
  <!-- tag end -->
  <div class="form-actions form-fixed pagination-right rghead">
  <div class="rgfn">
    <%= link_to (content_tag(:i,I18n.t("gallery.back_to_photos"),:class=>"icon-arrow-left icon-black")),"",:class=>"bt-back btn pull-left btn-primary",:title=>I18n.t("gallery.back_to_photos")%>

    <% if is_admin? %>
    <!-- #TODO or類別屬於他 -->
    <%= link_to (content_tag(:i,I18n.t("gallery.edit"),:class=>"icon-pencil icon-white")),edit_panel_gallery_back_end_album_path(@album),:class=>"bt-edit btn btn-primary pull-right",:title=>I18n.t("gallery.edit")%>
    <%= link_to (content_tag(:i,I18n.t("gallery.photo_tag"),:class=>"icon-pencil icon-white")),'#tags',:class=>"bt-tag btn btn-primary pull-right",:title=>I18n.t("gallery.photo_tag")%>
    <% end %>

  </div>
</div>
</div>

<% content_for :page_specific_javascript do %>
  <%= javascript_include_tag "galleryAPI" %>
<% end %>

<script type="text/javascript">
  galleryAPI.prototype.locale = "<%= I18n.locale %>";
  var gallery = new galleryAPI();
  gallery.initialize();
   gallery.loadArea = "theater";
   gallery.loadTheater("<%= params[:id] %>");
</script>





