<%@ page language="java" buffer="100kb" errorPage="/common/error.jsp"%>

<%@ page import="org.apache.struts.Globals"%>
<%@ page import="vkc.db.entities.VKCCategory" %>
<%@ page import="vkc.view.WebShare" %>
<%@ page import="vkc.view.TabId" %>
<%@ page import="vkc.view.ClipBoard" %>
<%@ page import="vkc.util.treeview.TreeView" %>
<%@ page import="vkc.view.form.ShowCategoryForm" %>
<%@ page import="vkc.view.form.DisplayUrlForm" %>

<%@ taglib uri="struts-html"     prefix="html"     %>
<%@ taglib uri="struts-bean"     prefix="bean"     %>
<%@ taglib uri="struts-logic"    prefix="logic"    %>
<%@ taglib uri="vkc-taglib"      prefix="vkc"      %>

<vkc:init/>
<html:html locale="true">
<head>
  <logic:present name="showCategoryForm">
  <logic:notEmpty name="showCategoryForm" property="category">
  <title><vkc:write name="showCategoryForm" property="category.name"/></title>
  <meta http-equiv="keywords"      content="<vkc:write name='showCategoryForm' property='category.keywordsAsString'/>" />
  <meta http-equiv="description"   content="<vkc:write name='showCategoryForm' property='category.description'/>" />
  </logic:notEmpty>
  </logic:present>

  <meta http-equiv="content-type"  content="text/html; charset=iso-8859-1" />
  <meta http-equiv="cache-control" content="no-cache" />
  <meta http-equiv="pragma"        content="no-cache" />
  <meta http-equiv="expires"       content="0" />
  <meta http-equiv="robots"        content="index" />
  <meta http-equiv="robots"        content="follow" />

  <vkc:cssinclude />
  <link rel="SHORTCUT ICON" href="<vkc:rewrite page='/templates/${template.name}/gfx/vkc.ico'/>">

  <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>
  <script type="text/javascript" src="<vkc:rewrite page='/common/overlib/overlib.js'/>"><!-- overLIB (c) Erik Bosrup --></script>

  <script type="text/javascript">

  window.name = "MAINVIEW";
  var aclform = null;
  var associatedTabId = <%=TabId.DOCUMENT_TAB%>;
  </script>

</head>
<body onload="javascript:init();" id="categoryview" marginwidth="0" marginheight="0">
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<html:form action="/showCategory" method="post">

<logic:notEmpty name="showCategoryForm" property="category">

  <bean:define id="form" name="showCategoryForm" type="vkc.view.form.ShowCategoryForm" toScope="request"/>
  <bean:define id="category"   name="form" property="category"   type="vkc.db.entities.VKCCategory" toScope="session" />
  <bean:define id="categoryId" name="form" property="categoryId" type="java.lang.Integer"/>

  <html:hidden property="selectedId" />
  <html:hidden property="documentId" />
  <html:hidden property="searchCategories" />
  <html:hidden property="categorySortMode" />
  <html:hidden name="category" property="categoryId"/>
  <logic:iterate id="id" name="form" property="showDocumentDetails" type="java.lang.Integer">
    <html:hidden property="showDocumentDetails" name="form" value='<%=String.valueOf(id.toString())%>'/>
  </logic:iterate>

  <% ClipBoard clipBoard = (ClipBoard)session.getAttribute( WebShare.CLIPBOARD_KEY ); %>
  <% boolean pasteCount = false; %>

  <table width="100%" cellspacing="1" cellpadding="0" border="0">
  <tr>
    <td colspan="2" class="color_toolbar">
      <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr>
        <!-- Kategoriepfad -->
          <td width="70%" align="left">
            <table>
              <tr>
                <script type="text/javascript">
                    var showLens = false;
                    var treeview = getTreeView();

					if (treeview) {
				        if (document.getElementById) {
				            var cols = parent.document.getElementsByTagName('frameset')[0].cols;
				            var rows = parent.document.getElementsByTagName('frameset')[1].rows;

				        	if (cols.charAt(0) == '0' && rows.charAt(0) == '0') {
				        		showLens = true;
				        	}
				        } else if (document.all) {
				            var cols = parent.document.all('frameset')[0].cols;
				            var rows = parent.document.all('frameset')[1].rows;

				        	if (cols.charAt(0) == '0' && rows.charAt(0) == '0') {
				        		showLens = true;
				        	}
				        } else if (document.layers) {
				            var cols = parent.document.layers('frameset')[0].cols;
				            var rows = parent.document.layers('frameset')[1].rows;

				        	if (cols.charAt(0) == '0' && rows.charAt(0) == '0') {
				        		showLens = true;
				        	}
				        }
					} else {
						showLens = true;
					}

  					if (showLens) {
                        document.write( '<td><vkc:link href="javascript:toggleNavigator();"><vkc:img page="/templates/${template.name}/gfx/navigator.gif" border="0" alt="toggle navigator" imageName="navigatorImage" titleKey="vkc.string.show.explorer"/></vkc:link></td>' );
                    } else {
                        document.write( '<td><vkc:link href="javascript:toggleNavigator();"><vkc:img page="/templates/${template.name}/gfx/trans.gif" border="0" alt="toggle navigator" imageName="navigatorImage" titleKey="vkc.string.show.explorer"/></vkc:link></td>' );
                    }
                </script>
                <td align="left">

                  <bean:define id="absPathDescr" name="category"     property="absPathDescr" />
                  <bean:define id="pathNodes"    name="absPathDescr" property="pathNodes"    />
                  <logic:iterate id="pathdescr" name="pathNodes" indexId="index" type="vkc.util.VKCCategoryPathNode">
                    <logic:greaterThan name="index" value="0">
                      <span dir="ltr">
                      <vkc:img page="/templates/${template.name}/gfx/dot.gif" alt="" border="0"/>
                      </span>
                    </logic:greaterThan>

                    <logic:equal name="pathdescr" property="inTrash" value="true"> 
                      <vkc:img page="/templates/${template.name}/gfx/trash.gif" alt="" border="0"/>
                    </logic:equal>  

                    <logic:equal value="true" name="pathdescr" property="lastNode">
                      <span dir="ltr">
                      <b><vkc:write name="pathdescr" property="pathName"/></b>
                      </span>
                    </logic:equal>

                    <logic:equal value="false" name="pathdescr" property="lastNode">
                      <span dir="ltr">
                      <vkc:link page="/showCategory.do" paramId="categoryId" paramName="pathdescr" paramProperty="pathId" title='<%=pathdescr.getPathName()%>'><vkc:write name="pathdescr" property="pathName"/></vkc:link>
                      </span>
                    </logic:equal>

                  </logic:iterate>
                </td>
                <td>&nbsp;</td>

                <logic:equal name="form" property="showCountCatDocs" value="true">
                  <logic:notEmpty name="form" property="accessibleCountCatDocs">
                    <td valign="bottom" nowrap="nowrap">&nbsp;<vkc:img page="/templates/${template.name}/gfx/count-folders.gif" border="0" alt=""/>&nbsp;:&nbsp;<vkc:write name="form" property="accessibleCountCatDocs.countCats"/>&nbsp;&nbsp;&nbsp;<vkc:img border="0" page="/templates/${template.name}/gfx/count-documents.gif" alt=""/>&nbsp;:&nbsp;<vkc:write name="form" property="accessibleCountCatDocs.countDocs"/> [<vkc:write name="form" property='<%= "accessibleCountCatDocs.formattedAmountDocs(" + user.getLanguageId() + ")" %>'/>]</td>
                  </logic:notEmpty>
                </logic:equal>
              </tr>
            </table>
          </td>

          <!-- Kategoriefunktionen -->
          <td align="right">
            <table border="0" cellspacing="0" cellpadding="0">
              <tbody>
                <tr>
                  <% boolean toolbarBorder = false; %>

                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link href='<%="javascript:screenIt('" + DisplayUrlForm.CATEGORY_LINK + "'," + categoryId + ");"%>'><vkc:img page="/templates/${template.name}/gfx/button-screenit-category.gif" border="0" titleKey="vkc.string.category.screenIt.display" onclick="this.blur();"/></vkc:link></td>

                  <script type="text/javascript">
                  	var versionNumber=navigator.appVersion;
                	var x = versionNumber.substr(navigator.appVersion.indexOf("MSIE")+5,1);
                    if (window.external && document.all && !window.opera && x<8 && x>4) {                    	
                        document.write( '<td width="5" align="right"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt=""  height="10" width="5"/></td>' );
                        document.write( '<td><a target="webdav" href="" FOLDER="<vkc:write name="category" property="webDAVPath"/>"  title="<vkc:message key="vkc.string.view.webfolder"/>" style="behavior: url(#default#AnchorClick);"><vkc:img page="/templates/${template.name}/gfx/webfolder.gif" border="0" titleKey="vkc.string.view.webfolder"/></a></td>' );
                        document.write( '<td width="5" align="right"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt=""  height="10" width="5"/></td>' );
                        document.write( '<td><vkc:link href="javascript:addCategoryToFavorites();" titleKey="vkc.string.add.category.bookmark"><vkc:img page="/templates/${template.name}/gfx/button_add2browserfavorites.gif" border="0" titleKey="vkc.string.add.category.bookmark"/></vkc:link></td>' );
                        
                        }
                  </script>

                  <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer.gif" alt="|"/></td>

                  <td><vkc:link page="/showCategory.do?" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/refresh.gif" border="0" titleKey="vkc.string.refresh"/>
                    </vkc:link></td>

                  <logic:equal name="user" property="guestUser" value="false">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?action.category.go2home=" paramId="prevCategoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-home.gif" border="0" titleKey="vkc.tooltip.go2home"/>
                    </vkc:link></td>
                  </logic:equal>
					<%-- Homecategory registrieren --%>
                  <logic:equal name="user" property="guestUser" value="false">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?action.register.home-category=" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-registerhomecat.gif" border="0" titleKey="vkc.tooltip.startcat"/>
                    </vkc:link></td>
                  </logic:equal>
					
                  <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer.gif" alt="|"/></td>
					<%-- Dokumenteigenschaftsfunktionen --%>
                  <td><vkc:link href='<%= "javascript:showAllDocumentDetails();" %>'><vkc:img page="/templates/${template.name}/gfx/button-documents-fullview.gif" border="0" titleKey="vkc.tooltip.show.all.document.details"/></vkc:link></td>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link href='<%= "javascript:hideAllDocumentDetails();" %>'><vkc:img page="/templates/${template.name}/gfx/button-documents-individualview.gif" border="0" titleKey="vkc.tooltip.hide.all.document.details"/></vkc:link></td>

                  <logic:equal name="categorySettings" property="countCatDocsEnabled" value="true">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?showCountCatDocs=true" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/count-cats-docs.gif" border="0" titleKey="vkc.tooltip.computeCountCatsDocs"/>
                    </vkc:link></td>
                  </logic:equal>
					<%-- Kategorie archivieren --%>
                  <logic:equal name="categorySettings" property="showArchiveCategory" value="true">
                  <vkc:hasAdminPrivileges>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link href='<%= "javascript:archiveCategory();" %>'>     
                      <vkc:img page="/templates/${template.name}/gfx/button-zip.gif" border="0" titleKey="vkc.tooltip.archivecategory" />
                    </vkc:link></td>
                  </vkc:hasAdminPrivileges>
                  </logic:equal>
					<%-- Kategorie clustern --%>
                  <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">
                  <logic:equal name="categorySettings" property="showClusterCategory" value="true">
				  <vkc:hasPermission context="category" requiredPerm="C">
				  <vkc:hasPermission context="category" requiredPerm="d">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link href='<%= "javascript:clusterCategory();" %>'>  
                      <vkc:img page="/templates/${template.name}/gfx/button-clustern.gif" border="0" titleKey="vkc.tooltip.clustercategory"/>
                    </vkc:link></td>
                  </vkc:hasPermission>
                  </vkc:hasPermission>
                  </logic:equal>
                  </logic:notEqual>

                  <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
					<%-- Neuen Dokument erstellen --%>
                  <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">
                  <vkc:hasPermission context="category" requiredPerm="w">
                  <% toolbarBorder = true; %>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/newDocument.do" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-newdocument.gif" border="0" titleKey="vkc.tooltip.insertdocument"/>
                    </vkc:link></td>
                  </vkc:hasPermission>

                  <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.CUT_OPERATION && !clipBoard.isSourceCategoryId( categoryId ) && !clipBoard.isCategoryInClipboard( categoryId ) ) { %>
                  <vkc:hasPermission context="category" requiredPerm="w">
                  <% toolbarBorder = true; %>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?action.clipboard=&clipboardAction=paste" paramId="categoryId" paramName="categoryId" >
                      <vkc:img page="/templates/${template.name}/gfx/button-paste.gif" border="0" titleKey="vkc.tooltip.paste"/>
                    </vkc:link></td>
                  </vkc:hasPermission>
                  <% } %>

                  <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.COPY_OPERATION && !clipBoard.isSourceCategoryId( categoryId ) ) { %>
                  <vkc:hasPermission context="category" requiredPerm="w">
                  <% toolbarBorder = true; %>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?action.clipboard=&clipboardAction=paste" paramId="categoryId" paramName="categoryId" >
                      <vkc:img page="/templates/${template.name}/gfx/button-paste.gif" border="0" titleKey="vkc.tooltip.paste"/>
                    </vkc:link></td>
                  </vkc:hasPermission>
                  <% } %>
					<%-- Neue Kategorie erstellen --%>
                  <vkc:hasPermission context="category" requiredPerm="C">
                  <% toolbarBorder = true; %>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/createCategory.do?validate=false&copyParentAcl=true" paramId="parentCategoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-newcat.gif" border="0" titleKey="vkc.tooltip.newcategory"/>
                    </vkc:link></td>
                  </vkc:hasPermission>
 					<%-- Eigenschaften einer Kategorie bearbeiten --%>
                  <vkc:hasPermission context="category" requiredPerm="c">
                  <% toolbarBorder = true; %>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link href='<%= "javascript:editCategory();" %>'>
                      <vkc:img page="/templates/${template.name}/gfx/button-editcat.gif" border="0" titleKey="vkc.tooltip.editcategory"/>
                    </vkc:link></td>
                  </vkc:hasPermission>
					<%--  Kategorie löschen --%>
                  <logic:notEqual name="category" property="rootCategory" value="true">
                  <%-- <vkc:hasPermission context="category" requiredPerm="D" recursiv="true"> --%>
				  <logic:equal name="user" property="guestUser" value="false">
                  <vkc:hasPermission context="category" requiredPerm="D">
                  <% toolbarBorder = true; %>
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?action.delete.category=" paramId="categoryId" paramName="categoryId" onclick="return confirmDeleteCategory();">
                      <vkc:img page="/templates/${template.name}/gfx/button-deletecategory.gif" border="0" titleKey="vkc.tooltip.deletecategory"/>
                    </vkc:link></td>
                  </vkc:hasPermission>
                  </logic:equal>
                  </logic:notEqual>

                  <% if ( toolbarBorder ) { %>
                  <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                  <% } %>
					<%-- Zugriffsrechte auf diese Kategorie verwalten --%>
                  <vkc:hasPermission context="category" requiredPerm="c" value="true">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link href='<%= "javascript:editCategoryAcl();" %>'> 
                      <vkc:img page="/templates/${template.name}/gfx/button-acl-edit.gif" border="0" titleKey="vkc.tooltip.editacl"/>
                    </vkc:link></td>
                  </vkc:hasPermission>

                  <vkc:hasPermission context="category" requiredPerm="c" value="false">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/displayAcl.do?init=true&ownWindow=false" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-acl-view.gif" border="0" titleKey="vkc.tooltip.viewacl"/>
                    </vkc:link></td>
                  </vkc:hasPermission>

                  </logic:notEqual>

                  <logic:equal value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/displayAcl.do?init=true&ownWindow=false" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-acl-view.gif" border="0" titleKey="vkc.tooltip.viewacl"/>
                    </vkc:link></td>
                  </logic:equal>
                  <logic:equal name="user" property="guestUser" value="false">
				  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
			      <td><vkc:link page="/showCategory.do?action.register.category=" paramId="categoryId" paramName="categoryId">
			          <vkc:img page="/templates/${template.name}/gfx/button-registercat.gif" border="0" titleKey="vkc.tooltip.registercat"/>
			        </vkc:link></td>
		          </logic:equal>                 
                  

                  <logic:equal name="user" property="guestUser" value="false">
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  <td><vkc:link page="/showCategory.do?action.addtofavorites-category=" paramId="categoryId" paramName="categoryId">
                      <vkc:img page="/templates/${template.name}/gfx/button-add-catfavorites.gif" border="0" titleKey="vkc.tooltip.vkcfavorites.addcategory"/>
                    </vkc:link></td>
                  </logic:equal>
                  
                  <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </table>

  <table width="100%" cellspacing="1" cellpadding="0" border="0">
  <tr>
    <td width="100%">
      <table width="100%" cellspacing="3" cellpadding="0" border="0">
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="20" height="5" border="0"/></td></tr>

        <%-- Beschreibung --%>
        <tr>
          <td>
          <logic:equal name="form" property="tinyMCECompatible" value="true">
          <vkc:write name="category" property="description" displayAsHTML="true" renderNewLine="true"/>
          </logic:equal>
          <logic:equal name="form" property="tinyMCECompatible" value="false">
          <vkc:write name="category" property="description" stripHTML="true" renderNewLine="true"/>
          </logic:equal>
          </td>
        </tr>

        <%-- additional attributes --%>
        <logic:notEmpty name="category" property="addAttributes">
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="20" height="20" border="0"/></td></tr>
        <tr>
          <td>
            <table width="100%" cellspacing="3" cellpadding="0" border="0">
              <colgroup><col><col width="100%"></colgroup>
              <logic:iterate id="addAttr" name="category" property="addAttributes" type="vkc.db.entities.VKCAddAttribute">
              <tr align="left" valign="top">
                <td><b><vkc:write name="addAttr" property="name"/>:&nbsp;</b></td>
                <td><vkc:write name="addAttr" property="valuestring"/></td>
              </tr>
              </logic:iterate>
            </table>
          </td>
        </tr>
        </logic:notEmpty>
        <%-- end of additional attributes --%>

        <%-- dynamical attributes --%>
        <logic:notEmpty name="category" property="dynaAttributes">
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="20" height="20" border="0"/></td></tr>
        <tr>
          <td>
            <table width="100%" cellspacing="3" cellpadding="0" border="0">
              <colgroup><col><col width="100%"></colgroup>
              <logic:iterate id="dynaAttr" name="category" property="dynaAttributes" type="vkc.db.entities.VKCDynaAttribute">
              <tr align="left" valign="top">
                <td><b><vkc:write name="dynaAttr" property="name"/>:&nbsp;</b></td>
                <td><vkc:write name="dynaAttr" property="value"/></td>
              </tr>
              </logic:iterate>
            </table>
          </td>
        </tr>
        </logic:notEmpty>
        <%-- end dynamical attributes --%>

        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="5" border="0"/></td></tr>

        <logic:notEqual name="category" property="rootCategory" value="true">
        <tr>
          <td align="left"><vkc:img page="/templates/${template.name}/gfx/parent.gif" align="texttop" border="0" alt=""/>&nbsp;<vkc:link page="/showCategory.do" paramId="categoryId" paramName="category" paramProperty="parentCategoryId"><vkc:message key="vkc.parentcategory" /></vkc:link></td>
        </tr>
        </logic:notEqual>

        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="5" border="0"/></td></tr>

        <tr>
          <td>
            <table cellspacing="2" cellpadding="0" border="0" align="left">         
                                
              <!-- Unterkategorien und Dokumente -->
              <colgroup><col><col align="center"><col width="100%"></colgroup>

              <logic:notEmpty name="form" property="accessibleSubcategories">
              <tr>
                <td colspan="3"><vkc:link linkName="categorysortbar"/>
                <table cellpadding="0" cellspacing="0" align="left">
                  <tr>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="3" border="0"/></td>
                    <logic:equal name="form" property="categorySortMode" value='<%= String.valueOf( ShowCategoryForm.CATEGORY_SORT_NAME_DOWN ) %>'>
                    <td><vkc:link href='<%="javascript:changeCategorySortMode(" + ShowCategoryForm.CATEGORY_SORT_NAME_UP + ");"%>' style="font-weight:normal;"><vkc:img page="/templates/${template.name}/gfx/sort-alphabetical-asc.gif" border="0" titleKey="vkc.tooltip.category.sort.name.ascending"/></vkc:link></td>
                    </logic:equal>
                    <logic:equal name="form" property="categorySortMode" value='<%= String.valueOf( ShowCategoryForm.CATEGORY_SORT_NAME_UP ) %>'>
                    <td><vkc:link href='<%="javascript:changeCategorySortMode(" + ShowCategoryForm.CATEGORY_SORT_NAME_DOWN + ");"%>' style="font-weight:normal;"><vkc:img page="/templates/${template.name}/gfx/sort-alphabetical-desc.gif" border="0" titleKey="vkc.tooltip.category.sort.name.descending"/></vkc:link></td>
                    </logic:equal>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" border="0"/></td>
                    <td><b><vkc:message key="vkc.subcategories" />:</b></td>
                  </tr>
                </table>
                </td>
              </tr>
              <tr><td colspan="3"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="5" border="0"/></td></tr>
              </logic:notEmpty>

              <!-- begin iteration subcategories -->
              <logic:iterate id="subCat" name="form" property="accessibleSubcategories" type="vkc.db.entities.VKCSubCategory">
              <tr>
                <td><html:multibox property="selectedCategoryIds" onfocus="this.blur();"><vkc:write name="subCat" property="subCategoryId"/></html:multibox></td>
                <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.CUT_OPERATION && clipBoard.isCategoryInClipboard( subCat.getSubCategoryId() ) ) { %>
                <td align="left"><vkc:img page='<%="/templates/" +template +"/gfx/" +subCat.getFolderImageShaded()%>' altKey='vkc.category' border='0'/></td>
                <td><vkc:link page="/showCategory.do" style="color:#aaaaaa" paramId="categoryId" paramName="subCat" paramProperty="subCategoryId"><vkc:write name="subCat" property="name"/></vkc:link>
                <logic:equal name="categorySettings" property="countCatDocsEnabled" value="true">
                  <logic:equal name="form" property="showCountCatDocs" value="true">
                    <bean:define id="subCountCatDocs" name="form" property='<%= "accessibleSubCountCatDocs(" + subCat.getSubCategoryId() + ")" %>'/>
                    <span dir="ltr">&nbsp;<font style="color:#aaaaaa"><vkc:img page="/templates/${template.name}/gfx/count-folders.gif" border="0" alt=""/>:<vkc:write name="subCountCatDocs" property="countCats"/>&nbsp;<vkc:img page="/templates/${template.name}/gfx/count-documents.gif" border="0" alt=""/>:<vkc:write name="subCountCatDocs" property="countDocs"/> [<vkc:write name="subCountCatDocs" property='<%= "formattedAmountDocs(" + user.getLanguageId() + ")" %>'/>]</font></span>
                  </logic:equal>
                </logic:equal>
                </td>
                <% } else { %>
                <td align="left"><vkc:img page='<%="/templates/" +template +"/gfx/" +subCat.getFolderImage()%>' altKey='vkc.category' border='0'/></td>
                <td><vkc:link page="/showCategory.do" paramId="categoryId" paramName="subCat" paramProperty="subCategoryId"><vkc:write name="subCat" property="name"/></vkc:link>
                <logic:equal name="categorySettings" property="countCatDocsEnabled" value="true">
                  <logic:equal name="form" property="showCountCatDocs" value="true">
                    <bean:define id="subCountCatDocs" name="form" property='<%= "accessibleSubCountCatDocs(" + subCat.getSubCategoryId() + ")" %>'/>
                    <span dir="ltr">&nbsp;<vkc:img page="/templates/${template.name}/gfx/count-folders.gif" border="0" alt=""/>:<vkc:write name="subCountCatDocs" property="countCats"/>&nbsp;<vkc:img page="/templates/${template.name}/gfx/count-documents.gif" border="0" alt=""/>:<vkc:write name="subCountCatDocs" property="countDocs"/> [<vkc:write name="subCountCatDocs" property='<%= "formattedAmountDocs(" + user.getLanguageId() + ")" %>'/>]</span>
                  </logic:equal>
                </logic:equal>
                </td>
                <% } %>
              </tr>
              </logic:iterate>
              <!-- end iteration subcategories -->

              <!-- begin iteration documents -->
              <logic:iterate id="subdoc" name="form" property="documents" type="vkc.db.entities.VKCDocument">
              <tr>
                <td><html:multibox property="selectedDocumentIds" onfocus="this.blur();"><vkc:write name="subdoc" property="documentId" /></html:multibox></td>
                <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.CUT_OPERATION && clipBoard.isDocumentInClipboard( subdoc.getDocumentId() ) ) { %>
                <td align="left"><vkc:img page='<%="/templates/" + template + subdoc.getDocumentIconShaded()%>' altKey='vkc.document' border='0'/></td>
                <td><a onClick="Mark('#doc<vkc:write name="subdoc" property="documentId"/>')" href="#doc<vkc:write name="subdoc" property="documentId" />" style="color:#aaaaaa" >
                    <logic:equal name="subdoc" property="note" value="true"><vkc:write name="subdoc" property="title"/></logic:equal>
                    <logic:equal name="subdoc" property="link" value="true"><vkc:write name="subdoc" property="title"/></logic:equal>
                    <logic:equal name="subdoc" property="file" value="true"><vkc:write name="subdoc" property="title"/></logic:equal>
                  </a></td>
                <% } else { %>
                <td align="left"><vkc:img page='<%="/templates/" + template + subdoc.getDocumentIcon()%>' altKey='vkc.document' border='0'/></td>
                <td><a onClick="Mark('#doc<vkc:write name="subdoc" property="documentId"/>')" href="#doc<vkc:write name="subdoc" property="documentId"/>">
                    <logic:equal name="subdoc" property="note" value="true"><vkc:write name="subdoc" property="title"/></logic:equal>
                    <logic:equal name="subdoc" property="link" value="true"><vkc:write name="subdoc" property="title"/></logic:equal>
                    <logic:equal name="subdoc" property="file" value="true"><vkc:write name="subdoc" property="title"/></logic:equal>
                  </a></td>
                <% } %>
              </tr>
              </logic:iterate>
              <!-- end iteration documents -->

              <!-- begin iteration virtual documents -->
              <logic:notEmpty name="form" property="virtualDocuments">
                <logic:iterate id="virtualDocument" name="form" property="virtualDocuments" type="vkc.db.entities.VKCDocument">
                <tr>
                  <td>&nbsp;</td>
                  <td align="left"><vkc:img page='<%="/templates/" + template + virtualDocument.getVirtualDocumentIcon()%>' altKey='vkc.document.virtual' border='0'/></td>
                  <td><a onClick="Mark('#doc<vkc:write name="virtualDocument" property="documentId"/>')" href="#doc<vkc:write name="virtualDocument" property="documentId" />"><vkc:write name="virtualDocument" property="title"/></a></td>
                </tr>
                </logic:iterate>
              </logic:notEmpty>
              <!-- end iteration virtual documents -->

              <!-- begin iteration to be published documents -->
              <logic:notEmpty name="form" property="toBePublishedDocuments">
                <logic:iterate id="toBePublishedDocument" name="form" property="toBePublishedDocuments" type="vkc.db.entities.VKCDocument">
                <tr>
                  <td>&nbsp;</td>
                  <td align="left"><vkc:img page='<%="/templates/" + template + toBePublishedDocument.getDocumentIcon()%>' altKey='vkc.document.toBePublished' border='0'/></td>
                  <td><a onClick="Mark('#tbp<vkc:write name="toBePublishedDocument" property="documentId"/>')" href="#doc<vkc:write name="toBePublishedDocument" property="documentId" />"><vkc:write name="toBePublishedDocument" property="title"/></a></td>
                </tr>
                </logic:iterate>
              </logic:notEmpty>
              <!-- end iteration to be published documents -->

              <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">
              <logic:equal name="user" property="guestUser" value="false">
              <logic:equal value="true" name="form" property="hasChildObjects">
              <tr>
                <td><input type="checkbox" name="allItems" value="allItems" onclick="javascript:checkAll(this.form);"></td>
                <td colspan="2" align="left"><vkc:message key="vkc.string.checkAll"/></td>
              </tr>

              <tr>
                <td valign="middle" colspan="2"><vkc:img page="/templates/${template.name}/gfx/function-arrow.gif" alt="-->" align="texttop" border="0"/></td>
                <td nowrap="nowrap">
                  <html:select property="clipboardAction">
                    <html:option value="noaction">-- <vkc:message key="vkc.string.chooseFunction"/> --</html:option>
                    <% pasteCount = false; %>
                    <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.CUT_OPERATION && !clipBoard.isSourceCategoryId( categoryId ) && !clipBoard.isCategoryInClipboard( categoryId ) ) { %>
                    <vkc:hasPermission context="category" requiredPerm="w">
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                    <% pasteCount = true; %>
                    </vkc:hasPermission>
                    <% if ( !pasteCount ) { %>
                    <vkc:hasPermission context="category" requiredPerm="C">
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                    </vkc:hasPermission>
                    <% } %>
                    <% } %>
                    <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.COPY_OPERATION && !clipBoard.isSourceCategoryId( categoryId ) ) { %>
                    <vkc:hasPermission context="category" requiredPerm="w">
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                    <% pasteCount = true; %>
                    </vkc:hasPermission>
                    <% if ( !pasteCount ) { %>
                    <vkc:hasPermission context="category" requiredPerm="C">
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                    </vkc:hasPermission>
                    <% } %>
                    <% } %>
                    <html:option value="cut"><vkc:message key="button.cut"/></html:option>
                    <html:option value="copy"><vkc:message key="button.copy"/></html:option>
                    <html:option value="delete"><vkc:message key="button.delete"/></html:option>
                  </html:select>&nbsp;<vkc:button onclick="confirmDeletion(this);" property="action.clipboard"><vkc:message key="button.execute"/></vkc:button>
                </td>
              </tr>
              </logic:equal>

              <logic:equal value="false" name="form" property="hasChildObjects">
              <% pasteCount = false; %>
              <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.CUT_OPERATION && !clipBoard.isSourceCategoryId( categoryId ) && !clipBoard.isCategoryInClipboard( categoryId ) ) { %>
              <vkc:hasPermission context="category" requiredPerm="w">
              <tr>
                <td colspan="2">&nbsp;</td>
                <td nowrap="nowrap">
                  <html:select property="clipboardAction">
                    <html:option value="noaction">-- <vkc:message key="vkc.string.chooseFunction"/> --</html:option>
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                    <% pasteCount = true; %>
                  </html:select>&nbsp;<vkc:button onclick="confirmDeletion(this);" property="action.clipboard"><vkc:message key="button.execute"/></vkc:button>
                </td>
              </tr>
              </vkc:hasPermission>
              <% if ( !pasteCount ) { %>
              <vkc:hasPermission context="category" requiredPerm="C">
              <tr>
                <td colspan="2">&nbsp;</td>
                <td nowrap="nowrap">
                  <html:select property="clipboardAction">
                    <html:option value="noaction">-- <vkc:message key="vkc.string.chooseFunction"/> --</html:option>
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                  </html:select>&nbsp;<vkc:button onclick="confirmDeletion(this);" property="action.clipboard"><vkc:message key="button.execute"/></vkc:button>
                </td>
              </tr>
              </vkc:hasPermission>
              <% } %>
              <% } %>
              <% if ( clipBoard != null && clipBoard.getOperation() == ClipBoard.COPY_OPERATION && !clipBoard.isSourceCategoryId( categoryId ) ) { %>
              <vkc:hasPermission context="category" requiredPerm="w">
              <tr>
                <td colspan="2">&nbsp;</td>
                <td nowrap="nowrap">
                  <html:select property="clipboardAction">
                    <html:option value="noaction">-- <vkc:message key="vkc.string.chooseFunction"/> --</html:option>
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                    <% pasteCount = true; %>
                  </html:select>&nbsp;<vkc:button onclick="confirmDeletion(this);" property="action.clipboard"><vkc:message key="button.execute"/></vkc:button>
                </td>
              </tr>
              </vkc:hasPermission>
              <% if ( !pasteCount ) { %>
              <vkc:hasPermission context="category" requiredPerm="C">
              <tr>
                <td colspan="2">&nbsp;</td>
                <td nowrap="nowrap">
                  <html:select property="clipboardAction">
                    <html:option value="noaction">-- <vkc:message key="vkc.string.chooseFunction"/> --</html:option>
                    <html:option value="paste"><vkc:message key="vkc.tooltip.paste"/></html:option>
                  </html:select>&nbsp;<vkc:button onclick="confirmDeletion(this);" property="action.clipboard"><vkc:message key="button.execute"/></vkc:button>
                </td>
              </tr>
              </vkc:hasPermission>
              <% } %>
              <% } %>
              </logic:equal>
              </logic:equal>
              </logic:notEqual>

              <logic:equal value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">
              <logic:equal name="user" property="guestUser" value="false">
              <logic:equal value="true" name="form" property="hasChildObjects">
              <tr>
                <td><input type="checkbox" name="allItems" value="allItems" onclick="javascript:checkAll(this.form);"></td>
                <td colspan="2" align="left"><vkc:message key="vkc.string.checkAll"/></td>
              </tr>
              <tr>
                <td valign="middle" colspan="2"><vkc:img page="/templates/${template.name}/gfx/function-arrow.gif" alt="-->" align="texttop" border="0"/></td>
                <td nowrap="nowrap">
                  <html:select property="clipboardAction">
                    <html:option value="noaction">-- <vkc:message key="vkc.string.chooseFunction"/> --</html:option>
                    <html:option value="copy"><vkc:message key="button.copy"/></html:option>
                  </html:select>&nbsp;<vkc:button onclick="confirmDeletion(this);" property="action.clipboard"><vkc:message key="button.execute"/></vkc:button>
                </td>
              </tr>
              </logic:equal>
              </logic:equal>
              </logic:equal>

              <logic:present name="<%=Globals.ERROR_KEY%>">
              <tr><td colspan="3"><br><b><vkc:errors/></b></td></tr>
              </logic:present>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td width="1%" align="right" valign="top">
      <!-- Suchen -->
      <table cellspacing="0" border="0">
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="1" border="0"/></td></tr>
        <logic:equal name="form" property="searchCategories" value="true">
        <tr>
          <td>
            <table align="left"  cellspacing="5" border="0" class="color_toolbar">
           	  <tr>
           	    <td nowrap="nowrap">
                  <table align="left"  cellspacing="5" border="0">
                    <tr>
                      <td nowrap="nowrap">
                        <button type="button" onClick="javascript:changeSearch(this);" title="<vkc:message key='vkc.tooltip.gotodocumentsearch'/>">
                          <vkc:img page="/templates/${template.name}/gfx/folder.gif" border="0" titleKey="vkc.tooltip.gotodocumentsearch"/>			           			
                          <vkc:img page="/templates/${template.name}/gfx/arrow-down-small.gif" border="0" titleKey="vkc.tooltip.gotodocumentsearch"/>
                        </button>
                      </td>
                    </tr>
                  </table>
                </td>
                <td><vkc:text property="searchCategoryName" style="width:130px;" size="15" onclick="javascript:clearSearchCategory();" onkeypress="return preventSubmitByEnter();" onfocus="return showSearchCategoryHelpText();" onblur="return nd();"/></td>
                <td><vkc:button property="action.search.category" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="vkc.search.searchbutton"/></vkc:button></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="2">
                  <table cellpadding="0" cellspacing="0" border="0">
                    <tr>                  
                      <td><input type="checkbox" name="searchFromHere" value="<%=categoryId%>"></td>
                      <td nowrap="nowrap"><vkc:message key="vkc.search.fromHere"/></td>
                    </tr>
                  </table>
                </td>
              </tr>                 
            </table>
          </td>
        </tr>
        </logic:equal>
      
        <logic:equal name="form" property="searchCategories" value="false">      
        <tr>
          <td>
            <table align="left" cellspacing="5"  class="color_toolbar">           
              <tr>
                <td nowrap="nowrap">
                  <table align="left"  cellspacing="5" border="0">
                    <tr>
                      <td nowrap="nowrap">	           
                        <button type="button" onClick="javascript:changeSearch(this);" title="<vkc:message key='vkc.tooltip.gotocategorysearch'/>">
                          <vkc:img page="/templates/${template.name}/gfx/document.gif" border="0" titleKey="vkc.tooltip.gotocategorysearch" />		          				
                          <vkc:img page="/templates/${template.name}/gfx/arrow-down-small.gif" border="0" titleKey="vkc.tooltip.gotocategorysearch"/>
                        </button>
                      </td>
                    </tr>       		
                  </table>
                </td>
                <td><vkc:text property="searchFromHereText" style="width:130px;" size="15" onclick="javascript:clearSearch();" onkeypress="return preventSubmitByEnter();" onfocus="return showSearchHelpText();" onblur="return nd();"/></td>
                <td><vkc:button property="action.search" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="vkc.search.searchbutton"/></vkc:button></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="2">
                  <table cellpadding="0" cellspacing="0" border="0">
                    <tr>                  
                      <td><input type="checkbox" name="searchFromHere" value="<%=categoryId%>"></td>
                      <td nowrap="nowrap"><vkc:message key="vkc.search.fromHere"/></td>
                    </tr>
                  </table>
                </td>
              </tr>                 
            </table>
          </td>
        </tr>
        </logic:equal>    
      </table>   
    </td>
  </tr>
  </table>


<!-- Sortierung der Dokumente -->

<logic:equal name="form" property="hasDocuments" value="true">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <vkc:hline colspan="3" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
  <tr>
    <td width="100%"><vkc:link linkName="documentsortbar"/></td>
    <td nowrap="nowrap"><b><vkc:message key="vkc.document.sort"/>:</b>&nbsp;</td>
    <td>
      <html:select property="documentSortMode" onchange="changeDocumentSortMode();">
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_PUBLISHING_DATE_UP ) %>'><vkc:message key="vkc.document.sort.ascbypublishingdate"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_PUBLISHING_DATE_DOWN ) %>'><vkc:message key="vkc.document.sort.descbypublishingdate"/></html:option>
        <logic:equal name="categorySettings" property="showCreationDate" value="true">
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_CREATION_DATE_UP ) %>'><vkc:message key="vkc.document.sort.ascbycreationdate"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_CREATION_DATE_DOWN ) %>'><vkc:message key="vkc.document.sort.descbycreationdate"/></html:option>
        </logic:equal>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_TITLE_UP ) %>'><vkc:message key="vkc.document.sort.ascbytitle"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_TITLE_DOWN ) %>'><vkc:message key="vkc.document.sort.descbytitle"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_AUTHOR_UP ) %>'><vkc:message key="vkc.document.sort.ascbyauthor"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_AUTHOR_DOWN ) %>'><vkc:message key="vkc.document.sort.descbyauthor"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_PUBLISHER_UP ) %>'><vkc:message key="vkc.document.sort.ascbypublisher"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_PUBLISHER_DOWN ) %>'><vkc:message key="vkc.document.sort.descbypublisher"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_SIZE_UP ) %>'><vkc:message key="vkc.document.sort.ascbysize"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_SIZE_DOWN ) %>'><vkc:message key="vkc.document.sort.descbysize"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_TYPE_UP ) %>'><vkc:message key="vkc.document.sort.ascbytype"/></html:option>
        <html:option value='<%= String.valueOf( ShowCategoryForm.DOCUMENT_SORT_TYPE_DOWN ) %>'><vkc:message key="vkc.document.sort.descbytype"/></html:option>
      </html:select>
    </td>
  </tr>
  <vkc:hline colspan="3" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
</table>
</logic:equal>

<!-- Publizierte Dokumente -->
<bean:define id="documents" name="form" property="documents"/>
<table width="100%" cellspacing="1" cellpadding="0" border="0">
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="10" border="0"/></td></tr>
  <tr>
    <td>
      <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="1" border="0"/></td></tr>
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="5" border="0"/></td></tr>
        <logic:empty name="documents">
        <tr><td><b><vkc:message key="vkc.no_published_docs"/>.</b></td></tr>
        </logic:empty>
        <logic:notEmpty name="documents">
        <tr><td><b><vkc:message key="vkc.published_docs"/>:</b></td></tr>
        </logic:notEmpty>
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="5" border="0"/></td></tr>
      </table>
    </td>
  </tr>
</table>

<bean:define id="userDocumentViewSettings" name="documentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
<bean:define id="currentUser" name="form" property="user" type="vkc.db.entities.VKCUser" toScope="request"/>

<!-- Publizierte Dokumente -->
<logic:iterate id="doc" type="vkc.db.entities.VKCDocument" name="documents">

  <bean:define id="docId" name="doc" property="documentId" type="java.lang.Integer"/>
  <a name='doc<vkc:write name="doc" property="documentId"/>'></a>
  <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="10"/></td></tr>

    <tr>
      <td>
        <table width="100%" cellspacing="0" cellpadding="0" border="0" >
          <tr>
            <td>
              <table id='<%=docId+"a"%>' width="100%" cellspacing="0" cellpadding="0" border="0" >
                <tbody>
                  <tr class="color_doctitle">
                    <% toolbarBorder = false; %>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>

                    <logic:equal name="form" property='<%= "showDocDetails[" + docId + "]" %>' value="false">
                      <td><vkc:link href='<%= "javascript:showDocumentDetails(" + docId + ");" %>'><vkc:img page="/templates/${template.name}/gfx/plus.gif" border="0" titleKey="vkc.tooltip.show.document.details"/></vkc:link></td>
                    </logic:equal>
                    <logic:equal name="form" property='<%= "showDocDetails[" + docId + "]" %>' value="true">
                      <td><vkc:link href='<%= "javascript:hideDocumentDetails(" + docId + ");" %>'><vkc:img page="/templates/${template.name}/gfx/minus.gif" border="0" titleKey="vkc.tooltip.hide.document.details"/></vkc:link></td>
                    </logic:equal>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:img page='<%="/templates/" + template + doc.getDocumentIcon()%>' alt='' border='0'/></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>

                    <td width="100%" align="left"><b><vkc:write name="doc" property="header"/></b></td>

                    <!-- dokument link -->
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%="javascript:screenIt('" + DisplayUrlForm.DOCUMENT_LINK + "'," + docId + ");"%>'><vkc:img page="/templates/${template.name}/gfx/button-screenit-document.gif" border="0" titleKey="vkc.string.document.screenIt.display" onclick="this.blur();"/></vkc:link></td>

                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                    <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">

                    <!-- Publizierer ändern -->
                    <vkc:hasAdminPrivileges>
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:changeDocumentPublisher(" + docId + ");" %>'>
                        <vkc:img page="/templates/${template.name}/gfx/button-change-publisher.gif" border="0" titleKey="vkc.tooltip.changepublisher" onclick="this.blur();"/>
                      </vkc:link></td>
                    </vkc:hasAdminPrivileges>

                    <!-- Dokument bearbeiten -->
                    <vkc:hasPermission context="category" requiredPerm="w">
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:changeDocumentProperty(" + docId + ");" %>'>
                        <vkc:img page="/templates/${template.name}/gfx/button-editdocument.gif" border="0" titleKey="vkc.tooltip.editdocument" onclick="this.blur();"/>
                      </vkc:link></td>
                    </vkc:hasPermission>

                    <!-- Neue Version -->
                    <vkc:hasPermission context="category" requiredPerm="w">
                    <% toolbarBorder = true; %>
                    <bean:define id="lockUserInfo" name="form" property='<%="lockUserInfo(" + docId + ")"%>' type="java.lang.String"/>
                    <logic:notEqual name="lockUserInfo" value="">
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/document-locked.gif" border="0" title='<%= lockUserInfo %>'/></td>
                    </logic:notEqual>
                    <logic:equal name="lockUserInfo" value="">
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:newDocumentVersion(" + docId + ");" %>'>
                        <vkc:img page="/templates/${template.name}/gfx/button-newversion.gif" border="0" titleKey="vkc.tooltip.addversion" onclick="this.blur();"/>
                      </vkc:link></td>
                    </logic:equal>
                    </vkc:hasPermission>
                    </logic:notEqual>

                    <!-- Versionsübersicht -->
                    <logic:notEmpty name="doc" property="preDocId">
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link page="/showDocumentVersions.do" paramId="documentId" paramName="doc" paramProperty="documentId" onfocus="this.blur();">
                        <vkc:img page="/templates/${template.name}/gfx/button-showallversions.gif" border="0" titleKey="vkc.tooltip.showallversions"/>
                      </vkc:link></td>
                    </logic:notEmpty>

                    <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">

                    <!-- Löschen -->
                    <vkc:hasPermission context="category" requiredPerm="d">
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link page="/showCategory.do" name="doc" property="deleteLinkParams" onclick="return confirmDeleteDocument();">
                        <vkc:img page="/templates/${template.name}/gfx/button-deletedocument.gif" border="0" titleKey="vkc.tooltip.delete.this.doc"/>
                      </vkc:link></td>
                    </vkc:hasPermission>

                    </logic:notEqual>

                    <% if ( toolbarBorder ) { %>
                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                    <% } %>

                    <!-- Ähnliche Dokumente -->
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                     <td><vkc:link href='<%= "javascript:searchRelatedDocuments(" + docId + ");" %>'> 
                        <vkc:img page="/templates/${template.name}/gfx/button-relateddocs.gif" border="0" titleKey="vkc.tooltip.relateddocs"/>
                      </vkc:link></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                    <% toolbarBorder = false; %>

                    <logic:equal name="user" property="guestUser" value="false">
                    <!-- Dokument registrieren -->
                    <% toolbarBorder = true; %>
                                        
			 		<td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link page="/showCategory.do" property="registerLinkParams" name="doc" titleKey="vkc.tooltip.registerdoc">
                        <vkc:img page="/templates/${template.name}/gfx/button-registerdoc.gif" border="0" titleKey="vkc.tooltip.registerdoc"/>
                      </vkc:link></td>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:addToFavorite(" + docId + ");" %>'>                  
                        <vkc:img page="/templates/${template.name}/gfx/button-add-docfavorites.gif" border="0" titleKey="vkc.tooltip.vkcfavorites.adddocument"/>
                      </vkc:link></td>
                    </logic:equal>

                    <% if ( toolbarBorder ) { %>
                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                    <% } %>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><a href="#top" onclick="this.blur();" onfocus="this.blur();"><vkc:img page="/templates/${template.name}/gfx/button-top.gif" border="0" titleKey="vkc.tooltip.gototop"/></a></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>

          <bean:define id="document" name="doc" type="vkc.db.entities.VKCDocument" toScope="request" />
          <logic:equal name="form" property='<%= "showDocDetails[" + docId + "]" %>' value="true">
          <bean:define id="documentViewSettings" name="documentViewSettings" property="fullviewDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
          </logic:equal>
          <logic:equal name="form" property='<%= "showDocDetails[" + docId + "]" %>' value="false">
          <bean:define id="documentViewSettings" name="userDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
          </logic:equal>         
          <bean:define id="rowId" value="true" type="java.lang.String" toScope="request" />
          <jsp:include page='<%="/templates/" + template + "/common/DocumentView.jsp"%>'/>
      </table>
    </td>
  </tr>
</table>
</logic:iterate>

<logic:notEmpty name="form" property="virtualDocuments">
  <!-- virtual documents headline -->
  <table width="100%" cellspacing="1" cellpadding="0" border="0">
    <vkc:hline colspan="1" lineClass="hline" lineHeight="1" topSpace="0" bottomSpace="10"/>
    <tr><td><b><vkc:message key="vkc.virtual_docs"/>:</b></td></tr>
    <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="5" border="0"/></td></tr>
  </table>
  <!-- end virtual documents headline -->
  <!-- virtual documents -->
  <logic:iterate id="virtualDoc" type="vkc.db.entities.VKCDocument" name="form" property="virtualDocuments">
    <bean:define id="virtualDocId" name="virtualDoc" property="documentId" type="java.lang.Integer"/>
    <bean:define id="virtualDocument" name="virtualDoc" type="vkc.db.entities.VKCDocument" toScope="request" />
    <logic:equal name="form" property='<%= "showDocDetails[" + virtualDocId + "]" %>' value="true">
    <bean:define id="documentViewSettings" name="documentViewSettings" property="fullviewDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
    </logic:equal>
    <logic:equal name="form" property='<%= "showDocDetails[" + virtualDocId + "]" %>' value="false">
    <bean:define id="documentViewSettings" name="userDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
    </logic:equal>
    <bean:define id="rowId" value="true" type="java.lang.String" toScope="request" />
    <bean:define id="template" name="template" type="java.lang.String" toScope="request" />
    <jsp:include page='<%="/templates/" + template + "/common/VirtualDocumentView.jsp"%>'/>
  </logic:iterate>
</logic:notEmpty>
<!-- end of virtual documents -->

<!-- to be published documents headline -->
<logic:notEmpty name="form" property="toBePublishedDocuments">
<table width="100%" cellspacing="1" cellpadding="0" border="0">
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="10" border="0"/></td></tr>
  <tr>
    <td>
      <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <vkc:hline colspan="1" lineClass="hline" lineHeight="1" topSpace="0" bottomSpace="10"/>
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="1" border="0"/></td></tr>
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="5" border="0"/></td></tr>
        <tr><td><b><vkc:message key="vkc.tobepublished_docs"/>:</b></td></tr>
        <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="5" border="0"/></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- end to be published documents headline -->

<!-- to be published documents -->
<logic:iterate id="tbpDoc" name="form" property="toBePublishedDocuments" type="vkc.db.entities.VKCDocument">

  <bean:define id="tbpDocId" name="tbpDoc" property="documentId" type="java.lang.Integer"/>
  <a name='doc<vkc:write name="tbpDoc" property="documentId"/>'></a>
  <table width="100%" cellspacing="0" cellpadding="0" border="0" >
    <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="10" height="10"/></td></tr>
    <tr>
      <td>
        <table width="100%" cellspacing="0" cellpadding="0" border="0" >
          <tr>
            <td>
              <table id='<%=tbpDocId+"a"%>' width="100%" cellspacing="0" cellpadding="0" border="0"  >              
                <tbody>
                  <tr class="headerSelected">
                    <% toolbarBorder = false; %>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <logic:equal name="form" property='<%= "showDocDetails[" + tbpDocId + "]" %>' value="false">
                      <td><vkc:link href='<%= "javascript:showDocumentDetails(" + tbpDocId + ");" %>'><vkc:img page="/templates/${template.name}/gfx/plus.gif" border="0" titleKey="vkc.tooltip.show.document.details"/></vkc:link></td>
                    </logic:equal>
                    <logic:equal name="form" property='<%= "showDocDetails[" + tbpDocId + "]" %>' value="true">
                      <td><vkc:link href='<%= "javascript:hideDocumentDetails(" + tbpDocId + ");" %>'><vkc:img page="/templates/${template.name}/gfx/minus.gif" border="0" titleKey="vkc.tooltip.hide.document.details"/></vkc:link></td>
                    </logic:equal>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:img page='<%="/templates/" + template + tbpDoc.getDocumentIcon()%>' alt='' border='0'/></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>

                    <td width="100%" align="left"><b><vkc:write name="tbpDoc" property="header"/></b></td>

                    <!-- dokument link -->
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%="javascript:screenIt('" + DisplayUrlForm.DOCUMENT_LINK + "'," + tbpDocId + ");"%>'><vkc:img page="/templates/${template.name}/gfx/button-screenit-document.gif" border="0" titleKey="vkc.string.document.screenIt.display" onclick="this.blur();"/></vkc:link></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>

                    <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">

                    <!-- Dokument bearbeiten -->
                    <vkc:hasPermission context="category" requiredPerm="w">
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:changeDocumentProperty(" + tbpDocId + ");" %>'>
                        <vkc:img page="/templates/${template.name}/gfx/button-editdocument.gif" border="0" titleKey="vkc.tooltip.editdocument" onclick="this.blur();"/>
                      </vkc:link></td>
                    </vkc:hasPermission>

                    <!-- Neue Version -->
                    <vkc:hasPermission context="category" requiredPerm="w">
                    <% toolbarBorder = true; %>
                    <bean:define id="lockUserInfo" name="form" property='<%="lockUserInfo(" + tbpDocId + ")"%>' type="java.lang.String"/>
                    <logic:notEqual name="lockUserInfo" value="">
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/document-locked.gif" border="0" title='<%= lockUserInfo %>'/></td>
                    </logic:notEqual>
                    <logic:equal name="lockUserInfo" value="">
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:newDocumentVersion(" + tbpDocId + ");" %>'>
                        <vkc:img page="/templates/${template.name}/gfx/button-newversion.gif" border="0" titleKey="vkc.tooltip.addversion" onclick="this.blur();"/>
                      </vkc:link></td>
                    </logic:equal>
                    </vkc:hasPermission>

                    </logic:notEqual>

                    <!-- Versionsübersicht -->
                    <logic:notEmpty name="tbpDoc" property="preDocId">
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link page="/showDocumentVersions.do" paramId="documentId" paramName="tbpDoc" paramProperty="documentId" onfocus="this.blur();">
                        <vkc:img page="/templates/${template.name}/gfx/button-showallversions.gif" border="0" titleKey="vkc.tooltip.showallversions"/>
                      </vkc:link></td>
                    </logic:notEmpty>

                    <logic:notEqual value="<%=VKCCategory.FLAG_CLOSED.toString()%>" name="form" property="category.flag">

                    <!-- Löschen -->
                    <vkc:hasPermission context="category" requiredPerm="d">
                    <% toolbarBorder = true; %>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link page="/showCategory.do" name="tbpDoc" property="deleteLinkParams" onclick="return confirmDeleteDocument();">
                        <vkc:img page="/templates/${template.name}/gfx/button-deletedocument.gif" border="0" titleKey="vkc.tooltip.delete.this.doc"/>
                      </vkc:link></td>
                    </vkc:hasPermission>

                    </logic:notEqual>

                    <% if ( toolbarBorder ) { %>
                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                    <% } %>

                    <!-- Ähnliche Dokumente -->
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                      <td><vkc:link href='<%= "javascript:searchRelatedDocuments(" + tbpDocId + ");" %>'> 
                        <vkc:img page="/templates/${template.name}/gfx/button-relateddocs.gif" border="0" titleKey="vkc.tooltip.relateddocs"/>
                      </vkc:link></td>

                    <td width="5" align="right"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="10"/></td>
                    <td width="2" align="right"><vkc:img page="/templates/${template.name}/gfx/border.gif" alt="|" width="2" height="24"/></td>
                    <% toolbarBorder = false; %>

                    <logic:equal name="user" property="guestUser" value="false">
                    <!-- Dokument registrieren -->  
			 		<td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link page="/showCategory.do" property="registerLinkParams" name="tbpDoc" titleKey="vkc.tooltip.registerdoc">
                        <vkc:img page="/templates/${template.name}/gfx/button-registerdoc.gif" border="0" titleKey="vkc.tooltip.registerdoc"/>
                      </vkc:link></td>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><vkc:link href='<%= "javascript:addToFavorite(" + tbpDocId + ");" %>'> 
                        <vkc:img page="/templates/${template.name}/gfx/button-add-docfavorites.gif" border="0" titleKey="vkc.tooltip.vkcfavorites.adddocument"/>
                      </vkc:link></td>
                    </logic:equal>

                    <% if ( toolbarBorder ) { %>
                    <td><vkc:img page="/templates/${template.name}/gfx/crumb-spacer-right.gif" alt="|"/></td>
                    <% } %>

                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                    <td><a href="#top" onclick="this.blur();" onfocus="this.blur();"><vkc:img page="/templates/${template.name}/gfx/button-top.gif" border="0" titleKey="vkc.tooltip.gototop"/></a></td>
                    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>

          <bean:define id="document" name="tbpDoc" type="vkc.db.entities.VKCDocument" toScope="request" />
          <logic:equal name="form" property='<%= "showDocDetails[" + tbpDocId + "]" %>' value="true">
          <bean:define id="documentViewSettings" name="documentViewSettings" property="fullviewDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
          </logic:equal>
          <logic:equal name="form" property='<%= "showDocDetails[" + tbpDocId + "]" %>' value="false">
          <bean:define id="documentViewSettings" name="userDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
          </logic:equal>          
          <bean:define id="rowId" value="true" type="java.lang.String" toScope="request" />
    	  <jsp:include page='<%="/templates/" + template + "/common/DocumentView.jsp"%>'/>
      </table>
    </td>
  </tr>
</table>
</logic:iterate>

</logic:notEmpty>
<!-- end of to be published documents -->

<script type="text/javascript">
	var markedDoc = 0;

    function init() {
        var treeView = getTreeView();
        var tabView = getTabView();
        var showTree = '<vkc:write name="user" property="showTree"/>';
         
		if (showTree == "true" && !treeView) {		
			toggleNavigator();				
	    }

        if ((((!window.opera && parent == self) || parent.name != 'MAINFRAMESET') || ((window.opera && top == self) || parent.name != 'MAINFRAMESET')) && !treeView) {
            // Tabs nachladen, ABER NUR WENN DER TREEVIEW NICHT ANGEZEIGT WIRD!!!
            <bean:parameter id="anchor" name="anchor" value=""/>           
            <logic:notEqual name="anchor" value="">            	
              this.location.replace('<%=ctxPath%>/templates/<%=template%>/MainFrameset.jsp?categoryId=<vkc:write name="categoryId"/>&anchor=<vkc:write name="anchor"/>');
            </logic:notEqual>
            <logic:equal name="anchor" value="">
              this.location.replace('<%=ctxPath%>/templates/<%=template%>/MainFrameset.jsp?categoryId=<vkc:write name="categoryId"/>');
            </logic:equal>
            return;
        }		
        
        if (tabView && tabView.selectedTabId == associatedTabId) {
            tabView.lastCategoryId = '<vkc:write name="form" property="categoryId"/>';
            var tabViewForm = tabView.document.forms[0];
            tabViewForm.lastCategoryId.value = tabView.lastCategoryId;
            
            if (tabView.systemviewtype != "categoryview") {
                tabView.location.replace("<%=ctxPath%>/vkcTabView.do?selectedTabId=<%=TabId.DOCUMENT_TAB%>"
          						       + "&lastCategoryId=" + tabViewForm.lastCategoryId.value
          						       + "&lastFunctionalId=" + tabViewForm.lastFunctionalId.value
          						       + "&lastProjectId=" + tabViewForm.lastProjectId.value);
            }
        }

        if (tabView && tabView.selectedTabId != associatedTabId) {
            tabView.lastCategoryId = '<vkc:write name="form" property="categoryId"/>';
            var tabViewForm = tabView.document.forms[0];
            tabViewForm.lastCategoryId.value = tabView.lastCategoryId;
            tabView.location.replace("<%=ctxPath%>/vkcTabView.do?selectedTabId=<%=TabId.DOCUMENT_TAB%>"
          						   + "&lastCategoryId=" + tabViewForm.lastCategoryId.value
          						   + "&lastFunctionalId=" + tabViewForm.lastFunctionalId.value
          						   + "&lastProjectId=" + tabViewForm.lastProjectId.value);
        }

        if (treeView) {
        	<logic:present name="<%=TreeView.TREE_KEY%>" scope="session">
       	    var update = '<%=categoryId.toString().equals(((TreeView)session.getAttribute(TreeView.TREE_KEY)).getActiveNode()) ? "false" : "true"%>';
            
            if (update == 'true') {
                treeView.location.replace('<%=ctxPath%>/treeview.do?Nodes=<vkc:write name="<%=TreeView.TREE_KEY%>" property="nodeString" filter="false" ignore="true"/>&selNode=<%=categoryId%>&activeNode=<%=categoryId%>&expand=true&anchor=<%=categoryId%>');
            }
        	</logic:present>
        }

        <logic:present parameter="refreshTreeView">
        if (treeView) {
            treeView.location.replace('<%=ctxPath%>/treeview.do?Nodes=<vkc:write name="<%=TreeView.TREE_KEY%>" property="nodeString" filter="false" ignore="true"/>&selNode=<%=categoryId%>&activeNode=<%=categoryId%>&expand=true&anchor=<%=categoryId%>');
        }
        </logic:present>
		
        <logic:present name="<%=WebShare.INFO_KEY%>" scope="request">
            <bean:define id="msg" type="java.lang.String" name="<%=WebShare.INFO_KEY%>" scope="request"/>
            alert('<vkc:message javascript="true" filter="false" key="<%=msg%>"/>');
        </logic:present>
        
        <logic:present name="<%=WebShare.MESSAGE_KEY%>" scope="request">
          <bean:define id="message" type="java.lang.String" scope="request" name="<%=WebShare.MESSAGE_KEY%>"/>
          alert( '<vkc:write name="message" javascript="true" filter="false"/>' );
        </logic:present>
        
        <logic:present parameter="openSearchCategoriesView">
          searchCategory();
        </logic:present>

        setAnchor();
    }

    function setAnchor() {
        <logic:present parameter="anchor">
        <bean:parameter id="anchor2" name="anchor"/>
        this.location.hash = '<%=anchor2%>';
        Mark("#" + '<%=anchor2%>');
        </logic:present>
        
        <logic:notPresent parameter="anchor">
        var anchorValue = this.location.hash;  

        if (anchorValue != '') {
            Mark(anchorValue);
        }
        </logic:notPresent>
    }

    function screenIt(linkType, objectId) {
        var wnd = window.open('<vkc:rewrite page="/displayUrl.do"/>?linkType=' + linkType +  '&objectId=' + objectId, "SYSLINKVIEW", "width=850,height=230,status=no,resizable=no,scrollbars=no,toolbar=no, location=no, directories=no, menubar=no");
		wnd.focus();
    }
    
    function addCategoryToFavorites() {
        if (window.external && document.all && !window.opera) {
            var url = '<%=vkc.view.WebShare.getRootURL() + ctxPath%><vkc:write name="category" property="categorySysLink" filter="false"/>';
            var pageName = '<vkc:message key="vkc.category" javascript="true" filter="false"/>' + ' = ' + '<vkc:write name="category" property="name" javascript="true" filter="false"/>';
            window.external.AddFavorite(url, pageName);
        }
    }

    function confirmDeleteCategory() {
        return confirm('<vkc:message javascript="true" filter="false" key="vkc.string.confirm.delete.category"/>');
    }

    function confirmDeleteDocument() {
        return confirm('<vkc:message javascript="true" filter="false" key="vkc.string.confirm.delete.document"/>');
    }

    function confirmDeletion(elem) {
        var form  = document.forms[0];
        var action = document.showCategoryForm.clipboardAction.value;
        
        if (action == "delete") {
            if (!confirm('<vkc:message javascript="true" filter="false" key="vkc.string.confirm.delete.selection"/>')) {
                return;
            }
        }

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.clipboard=true";
        } else {
          form.action = form.action + "&action.clipboard=true";
        }

        disableAllButtons(elem);            
        form.submit();
    }

    function openUserInfoWindow(id) {
        var w = 800;
        var h = 600;
        var leftPosition = screen.width/2  - w/2;
        var topPosition  = screen.height/2 - h/2;
        var settings ='height=' + h + ', width=' + w + ', top=' + topPosition + ', left=' + leftPosition;
        settings += ',scrollbars=yes,resizable';
        settings += ',toolbar=no, location=no, directories=no, status=true, menubar=no';
        var win = window.open('<vkc:rewrite page="/displayUserInfo.do"/>?userId=' + id, 'USERINFO_MAINVIEW', settings);
        win.focus();
    }

    function checkAll(mForm) {
        for (var i=0 ; i<mForm.elements.length ; i++) {
            var elem = mForm.elements[i];
            
            if (elem.name != 'allItems' && elem.name != 'searchFromHere') {
                elem.checked = mForm.allItems.checked;
            }
        }
    }

    function toggleNavigator() {
        var mainView = getMainView()

        if (!mainView) {
            return;
        }
		
		<logic:present parameter="anchor">                             
            mainView.location.replace('<%=ctxPath%>/templates/<%=template%>/common/NavigatorFrameset.jsp?categoryId=<vkc:write name="category" property="categoryId"/>&anchor=<%=request.getParameter("anchor")%>');
        </logic:present>
        <%-- Navigator einblenden --%>
        <logic:notPresent parameter="anchor">
            mainView.location.replace('<%=ctxPath%>/templates/<%=template%>/common/NavigatorFrameset.jsp?categoryId=<vkc:write name="category" property="categoryId"/>');
    	</logic:notPresent>

        this.document.images['navigatorImage'].src = '<%=ctxPath + "/templates/" + template + "/gfx/trans.gif"%>';
    }

    function showDocumentDetails(id) {
        var form = document.forms[0];
        form.selectedId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.show.document.details=true";
        } else {
          form.action = form.action + "&action.show.document.details=true";
        }

        form.submit();
    }

    function hideDocumentDetails(id) {
        var form = document.forms[0];
        form.selectedId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.hide.document.details=true";
        } else {
          form.action = form.action + "&action.hide.document.details=true";
        }

        form.submit();
    }

    function showAllDocumentDetails() {
        var form = document.forms[0];

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.show.all.document.details=true";
        } else {
          form.action = form.action + "&action.show.all.document.details=true";
        }

        form.submit();
    }

    function hideAllDocumentDetails() {
        var form = document.forms[0];

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.hide.all.document.details=true";
        } else {
          form.action = form.action + "&action.hide.all.document.details=true";
        }

        form.submit();
    }

    function changeCategorySortMode(id) {
        var form = document.forms[0];
        form.categorySortMode.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.change.category.sortmode=true";
        } else {
          form.action = form.action + "&action.change.category.sortmode=true";
        }

        form.submit();
    }

    function changeDocumentSortMode() {
        var form = document.forms[0];

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.change.document.sortmode=true";
        } else {
          form.action = form.action + "&action.change.document.sortmode=true";
        }

        form.submit();
    }
    
    function changeDocumentProperty(id) {
        var form = document.forms[0];
        form.documentId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.change.document.property=true";
        } else {
          form.action = form.action + "&action.change.document.property=true";
        }

        form.submit();
    }
    
    function changeDocumentPublisher(id) {    
        var form = document.forms[0];
        form.documentId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.change.document.publisher=true";
        } else {
          form.action = form.action + "&action.change.document.publisher=true";
        }

        form.submit();
    }
    
    function newDocumentVersion(id) {    
        var form = document.forms[0];
        form.documentId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.new.document.version=true";
        } else {
          form.action = form.action + "&action.new.document.version=true";
        }

        form.submit();
	}
	
	function addToFavorite(id) {    
        var form = document.forms[0];
        form.documentId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.addtofavorites-document=true";
        } else {
          form.action = form.action + "&action.addtofavorites-document=true";
        }

        form.submit();
	}
	
	function searchRelatedDocuments(id) {    
        var form = document.forms[0];
        form.documentId.value = id;

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.search.related-documents=true";
        } else {
          form.action = form.action + "&action.search.related-documents=true";
        }

        form.submit();
	}
	
	function archiveCategory() {    
        var form = document.forms[0];        

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.archive.category=true";
        } else {
          form.action = form.action + "&action.archive.category=true";
        }

        form.submit();
	}
	
	function clusterCategory() {    
        var form = document.forms[0];        

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.cluster.category=true";
        } else {
          form.action = form.action + "&action.cluster.category=true";
        }

        form.submit();
	}
	
	function editCategory() {    
        var form = document.forms[0];        

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.edit.category=true";
        } else {
          form.action = form.action + "&action.edit.category=true";
        }

        form.submit();
	}
	
	function editCategoryAcl() {    
        var form = document.forms[0];        

        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.edit.category.acl=true";
        } else {
          form.action = form.action + "&action.edit.category.acl=true";
        }

        form.submit();
	}
	
	function Mark(id) {
		var c1 = null;
		var c2 = null;
		var c3 = null;

		if (markedDoc != 0) {
			if (markedDoc.substring(1,4) == "doc") {
				c1 = document.getElementById(markedDoc.substring(4));
				c2 = document.getElementById(markedDoc.substring(4) + "a");
				c3 = document.getElementById(markedDoc.substring(4) + "alt");

				if (c1) {
				    c1.className = "unselecteddocument";	
				}
				
				if (c2) {
				    c2.className = "unselecteddocumentheader";
				}
				
				if (c3) {
				    c3.className = "unselecteddocumentalternate";
				}
			}
			
			if (markedDoc.substring(1,4) == "tbp") {
				c1 = document.getElementById(markedDoc.substring(4));
				c2 = document.getElementById(markedDoc.substring(4) + "a");
				c3 = document.getElementById(markedDoc.substring(4) + "alt");

				if (c1) {
				    c1.className = "unselecteddocument";	
				}
				
				if (c2) {
				    c2.className = "unselecteddocumentheader";
				}
				
				if (c3) {
				    c3.className = "unselecteddocumentalternate";
				}
			}
		}
		
		if (id != "#top") {
			markedDoc = id;

			c1 = document.getElementById(markedDoc.substring(4));
			c2 = document.getElementById(markedDoc.substring(4) + "a");
			c3 = document.getElementById(markedDoc.substring(4) + "alt");

			if (c1) {
			    c1.className = "selecteddocument";	
			}
			
			if (c2) {
			    c2.className = "selecteddocumentheader";
			}
			
			if (c3) {
			    c3.className = "selecteddocumentalternate";
			}
		}
	}

    function searchCategory() {
        var w = 850;
        var h = 230;
        var leftPosition = screen.width/2  - w/2;
        var topPosition  = screen.height/2 - h/2;
        var settings ='height=' + h + ', width=' + w + ', top=' + topPosition + ', left=' + leftPosition;
        settings += ',scrollbars=yes,resizable';
        settings += ',toolbar=no, location=no, directories=no, status=true, menubar=no';
        
        var path = '<vkc:rewrite page="/searchCategory.do"/>?decodeSearchQuery=true&searchQuery=<vkc:write name="form" property="encodedSearchCategoryQuery" javascript="true" filter="false"/>';
        
        <logic:present parameter="searchCategoryId">
          <bean:parameter id="searchCategoryId" name="searchCategoryId" value='<%=String.valueOf(VKCCategory.ROOT_CATEGORY_ID)%>'/>
          path += '&categoryId=<vkc:write name="searchCategoryId" javascript="true" filter="false"/>';
        </logic:present>
        
        var wnd = window.open(path, "SEARCHCATEGORIESVIEW", settings);
        wnd.focus();
    }

    function clearSearchCategory() {
        var form  = document.forms[0];
        var field = form.searchCategoryName;
        var value = field.value;

        if (value == '<vkc:message javascript="true" filter="false"  key="vkc.search.searchFieldText"/>') {
            field.value = '';
        }
    }
  
    function clearSearch() {
        var form  = document.forms[0];
        var field = form.searchFromHereText;
        var value = field.value;

        if (value == '<vkc:message javascript="true" filter="false"  key="vkc.search.searchFieldText"/>') {
            field.value = '';
        }
    }

	function changeSearch(elem){
		var form = document.forms[0];		
		
        <logic:equal name="form" property="searchCategories" value="true">
        form.searchCategories.value="false";
        </logic:equal>						
        <logic:equal name="form" property="searchCategories" value="false">		    		
        form.searchCategories.value="true";							
        </logic:equal>
	    
        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?refresh=true"   
        } else {
          form.action = form.action + "&refresh=true"   
        }

        disableAllButtons(elem);
        form.submit();
    }

    function showSearchHelpText() {
        var text = '<vkc:message javascript="true" filter="false" key="vkc.search.document.help"/>';

        return overlib( text, STICKY, MOUSEOFF, WIDTH, 200, OFFSETX, -50, OFFSETY, 100, CENTER );
    }

    function showSearchCategoryHelpText() {
        var text = '<vkc:message javascript="true" filter="false" key="vkc.search.category.help"/>';

        return overlib( text, STICKY, MOUSEOFF, WIDTH, 200, OFFSETX, -50, OFFSETY, 100, CENTER );
    }
    </script>
</logic:notEmpty>
</html:form>
</body>
</html:html>