#* define navigation constants *#
#macro (defineNavigationConstants)
  #* Constants for layout orientation *#	
  #set($LEFT_TO_RIGHT = "LeftToRight")
  #set($RIGHT_TO_LEFT = "RightToLeft")
  #set($TOP_TO_BOTTOM = "TopToBottom")
  #set($BOTTOM_TO_TOP = "BottomToTop")
#end

#* include potentially nested links navigation component *#
#macro (includeNestedLinksWithIconNavigation $_nodeSet $_nodePrefix $_orientation)
  <div>
  #foreach($node in $_nodeSet.iterator()) 
    #if($_orientation == $TOP_TO_BOTTOM)
      #if($node.type == ".ds")
        <div class="pagetitle" title="$node.getTitle($preferedLocale)">${node.getShortTitle($preferedLocale)}</div>
      #else
        <div>
      #end
    #end

    #if($node.type == ".psml")
      <a href="$jetspeed.getAbsoluteUrl($node.url)" class="LinkPage" title="$node.getTitle($preferedLocale)">$node.getShortTitle($preferedLocale)</a>	
    #elseif($node.type == ".link")
      <a href="$node.url" target="$node.target" class="Link" title="$node.getTitle($preferedLocale)">$node.getShortTitle($preferedLocale)</a>	
    #elseif($node.type == "folder")
      <a href="$jetspeed.getAbsoluteUrl($node.url)" class="LinkFolder" title="$node.getTitle($preferedLocale)">$node.getShortTitle($preferedLocale)</a>	
    #elseif($node.type == ".ds")
      #set($__nodePrefix = "${_nodePrefix}${node.url}")
      #set($__nodeSet = $site.getDocumentSetNodes($__nodePrefix))
      #includeNestedLinksWithIconNavigation($__nodeSet $__nodePrefix $_orientation)
    #else
      <a href="$node.url" title="$node.getTitle()">$node.getShortTitle()</a>	
    #end

    #if($_orientation == $TOP_TO_BOTTOM)
      #if($node.type != ".ds")
        </div>
      #end
    #end
  #end
  </div>
#end
#macro (includeLinksWithIconNavigation $_nodeSet $_orientation)
  #includeNestedLinksWithIconNavigation($_nodeSet "" $_orientation)
#end

#* include folders navigation component *#
#macro (includeFoldersNavigation $_nodeSet $_orientation)
  <div class="FolderList">
  #foreach($childFolder in $_nodeSet.iterator())
    #if($_orientation == $LEFT_TO_RIGHT)
      <span>
    #elseif($_orientation == $TOP_TO_BOTTOM)
      <div>
    #end

    <a href="$jetspeed.getAbsoluteUrl($childFolder.url)" class="FolderLink" title="$childFolder.getTitle($preferedLocale)">$childFolder.getShortTitle($preferedLocale)</a>		

    #if($_orientation == $LEFT_TO_RIGHT)
      </span>
    #elseif($_orientation == $TOP_TO_BOTTOM)
      </div>
    #end
  #end
  </div>
#end

#* include tabs navigation component *#
#macro (includeTabsNavigation $_nodeSet $_orientation)
  <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    #foreach($childPage in $_nodeSet.iterator())
      #set($tabTitle = $childPage.getTitle($preferedLocale))
      #set($tabName = $childPage.getShortTitle($preferedLocale))

      #if($_orientation == $LEFT_TO_RIGHT)
        #if($jetspeed.page.id == $childPage.id)
          <td class="LTabLeft" nowrap="true">&nbsp;</td>
          <td class="LTab" align="center" valign="middle" nowrap="true" title="$tabTitle">${tabName}</td>
          <td class="LTabRight"  nowrap="true">&nbsp;</td>
        #else
          <td class="LTabLeftLow"  nowrap="true">&nbsp;</td>
          <td class="LTabLow" align="center" valign="middle" nowrap="true" title="$tabTitle"><a href="$jetspeed.getAbsoluteUrl($childPage.url)">${tabName}</a></td>
          <td class="LTabRightLow"  nowrap="true">&nbsp;</td>
        #end
      #end
    #end
    </tr>
  </table>
#end
