!if $module = home
  !! use scripts/adm/oneitem.phtml
  !set w_path = ./adm/
!else
  !! use html/oneitem.phtml
  !set w_path = $empty
!endif
!read themes/$wims_theme/local.phtml
!set wims_rm_0=!append line $wims_rm_0 to $wims_local_menu_items

!!read themes/_procs/homemenu.proc
!if $wims_homeref_n0=1 and itemsep isin $wims_rm_0
  !set wims_homeref_n0=0
!endif
!!delete a line itemsep,0 at the beginning without third argument
!set wims_rm_0=!nonempty line $wims_rm_0
!set tmp_=!line 1 of $wims_rm_0
!if itemsep isitemof $(tmp_[1]) and $(tmp_[3])=$empty
  !set wims_rm_0=!line 2 to -1 of $wims_rm_0
!endif
!set tmp_=!line -1 of $wims_rm_0
!if (itemsep isitemof $(tmp_[1]) or $(tmp_[1])=$empty) and $(tmp_[3])=$empty
  !set wims_rm_0=!line 1 to -2 of $wims_rm_0
!endif
!set wims_homeref_n0=!linecnt $wims_rm_0
!if $wims_homeref_n0+$wims_homeref_n4 + $wims_homeref_n5 >0
  <!-- _widgets/menumodubox.phtml -->
  <nav id="wimsmenumodubox">
  <div class="modubox_content">
  !if $wims_homeref_n0>0
    !set started=0
    !for i_=1 to $wims_homeref_n0
      !set 1_=!line $i_ of $wims_rm_0
      !if $(1_[1])$(1_[2]) != $empty
        !set is_link=!item 2 of $1_
        !if $is_link!=0
          !if $started=0
            <$div0 class="wimsmenu menu homeref_n0">
            !set started=1
          !endif
          !set wims_ref_class = !item 1 of $1_
          !set wims_ref_class = !word 1 of $wims_ref_class
          !if " isin $wims_ref_class
            !reset wims_ref_class
          !endif
          <$div1 class="menuitem $wims_ref_class">
            !read $(w_path)oneitem.phtml $1_
          </$div1>
          !reset wims_ref_class
        !else
          !if $started=1
            </$div0>
          !endif
          !set item_text = !item 3 of $1_
          !if $item_text notsametext $empty
            <h2 class="menu_title"><span>
              !read $(w_path)oneitem.phtml $1_
            </span></h2>
          !endif
          <$div0 class="wimsmenu menu homeref_n0">
          !set started=1
        !endif
      !endif
   !next i_
    </$div0><!--wimsmenu-->
  !endif wims_homeref_n0

  !if $wims_homeref_n5>0
    <$div0 class="wimsmenu menu homeref_n5">
    !for i_=1 to $wims_homeref_n5
      !if $div0=ul
        <li class="menuitem">
      !endif
      !set 1_=!line $i_ of $wims_rm_5
      !read $(w_path)oneitem.phtml $1_
      !if $div0=ul
        </li>
      !endif
    !next i_
    </$div0><!--wimsmenu-->
  !endif wims_homeref_n5

  !if $wims_homeref_n4>0
    <$div0 class="wimsmenu menu homeref_n4">
    !for i_=1 to $wims_homeref_n4
      !set 1_=!line $i_ of $wims_rm_4
      !set wims_ref_class = !item 1 of $1_
      !if " isin $wims_ref_class
        !reset wims_ref_class
      !endif
      <$div1 class="menuitem $wims_ref_class">
        !read $(w_path)oneitem.phtml $1_
      </$div1>
      !reset wims_ref_class
    !next i_
    </$div0><!--wimsmenu-->
  !endif wims_homeref_n4
  </div>
  </nav> <!--/wimsmenumodubox -->
  <!-- end _widgets/menumodubox.phtml -->
!endif wims_homeref_n0+wims_homeref_n4+$wims_homeref_n5
