<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
<% allow_delete ||= false %>
<% if parent_jour%>
    <% reply_allow = JournalsForMessage.create_by_user? User.current %>
    <% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
    <div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
      <div class="recall_head">
        <% if show_name %>
            <%= image_tag url_to_avatar(reply.user),:width => '30',:height => '30' %>
        <% else %>
            <%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %>
        <% end %>
      </div>
      <div class="recall_con f14">
        <% id = 'project_respond_form_'+ reply.id.to_s %>
        <%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %>
        <%= l(:label_reply_to)%>
        <% if show_name %>
            <%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %>
        <% else %>
            <%= l(:label_anonymous) %>
        <% end %>
        <div id="reply_<%= reply.id %>">
            <p>
              <%= reply.notes.html_safe %>
            </p>
        </div>
        <script type="text/javascript">
            $(function(){
                showNormalImage('reply__<%= reply.id %>');
                autoUrl('reply_<%= reply.id %>');
            });
        </script>
        <div class="cl"></div>
            <span class="c_grey fl">
              <%= format_time reply.created_on %>
            </span>
        <div class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
          <span id="reply_praise_count_<%=reply.id %>">
            <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
          </span>
          <% if User.current.admin? || reply.user.id == User.current.id || allow_delete%>
              <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
                          :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete))  %>
          <% end %>
          <% if reply_allow %>
              <%#= link_to l(:button_reply),'',
                                     {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
              <%= link_to l(:button_reply),'javascript:;',{:nhname=>"reply_btn"} %>
          <% end %>  <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
        </div>
        <div class="cl"></div>
        <div id='<%=id%>' class="respond-form">
          <% if reply_allow %>
              <% if journal.jour_type == "Course" || journal.jour_type == "Project" %>
                  <%= render :partial => "words/new_respond_course", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %>
              <% else %>
                  <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %>
              <% end %>
          <% end %>
        </div>
      </div>
      <div class="cl"></div>
    </div>
<% end %>
