<%
/*
 * ====================================================================
 * Copyright (c) 2005-2011 sventon project. All rights reserved.
 *
 * This software is licensed as described in the file LICENSE, which
 * you should have received as part of this distribution. The terms
 * are also available at http://www.sventon.org.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 * ====================================================================
 */
%>
<div align="right" class="entryTrayContainer" id="entryTrayContainerDiv">
  <table class="entryTrayHeaderTable">
    <tr>
      <td>
        <spring:message code="entrytray.dragdrop.header"/>&nbsp;
        <a class="sventonHeaderLink" href="#" onclick="toggleInnerHTML('hideShowTrayLink', '<spring:message code='hide'/>', '<spring:message code='show'/>'); showHideEntryTray(); return false;">
          [<span id="hideShowTrayLink"><spring:message code='show'/></span>]
        </a>
      </td>
    </tr>
  </table>
  <div id="entryTrayWrapper" style="display: none">
    <div id="entryTray">
      <%@ include file="/WEB-INF/jsp/ajax/entryTray.jsp"%>
    </div>
  </div>
</div>

<script type="text/javascript">
  var entries = document.getElementsByClassName('entry');
  for (var i = 0; i < entries.length; i++) {
    new Draggable(entries[i].id, {revert:true})
  }
  Droppables.add('entryTrayContainerDiv', {onDrop:
      function(element, dropon, event) {
        new Ajax.Updater({success: $('entryTray')}, element.id, {
          method: 'post', onFailure: reportAjaxError, onComplete: function() {
          Element.hide('spinner');
        }
        });
        Element.show('spinner');
      }
  })
</script>