<!-- tt2.splash.tabset (selected: [% select %]) -->
[%
  # splash/tabset: a row of tabs
  # ARGS:
  #	tabs	    # list of { text => '...', link => '...' } hashes
  #     select      # number of tab to select (1 - n, 0: none)
  #     invert      # flag to invert tabs (hang down)
  #     limit       # maximum number before scrolling
  # 	valign      # vertical alignment of tabs
    SET default = splash.style.default;
    DEFAULT 
	style = default
        limit = style.tab.limit or default.tab.limit
    ;
-%]
<table border=0 cellpadding=0 cellspacing=0>
<tr>
[%- IF tabs.size > limit;
	FOREACH tab = tabs;
	    IF select == loop.count or select == tab.text;
		IF loop.prev;
		    INCLUDE tabtext 
                        left  = 1
			tab   = loop.prev 
			link  = loop.prev.link
			style = splash.style.default
		    WRAPPER html/cell width=0;
		END;

		INCLUDE tabtext
			style = splash.style.select
		WRAPPER html/cell width=0;

		IF loop.next;
		    INCLUDE tabtext 
			right = 1
			tab   = loop.next
			link  = loop.next.link
			style = splash.style.default
		    WRAPPER html/cell width=0;
		END;

		LAST;
	    END;
	END;
    ELSE;
	FOREACH tab = tabs;
    	    WRAPPER html/cell width=0;
    		style  = (select == loop.count or select == tab.text) 
    		       ? splash.style.select : splash.style.default;
    		content = INCLUDE splash/text 
    				  content=tab.text 
    				  link=tab.link;
    		INCLUDE splash/tab 
    			link    = tab.link
    			width   = '';
    	    END;
    	END;
    END;

    BLOCK tabtext;
	content = INCLUDE splash/text 
    	        content = tab.text 
    		link    = tab.link;

	IF left;
	    content = WRAPPER html/table + html/row 
			      valign='middle' width=0
			      pad=0 space=0 border=0;
		WRAPPER html/cell width=0;
		    INCLUDE splash/icon img='left';
		    '&nbsp;';
		END;
		INCLUDE html/cell width=0;  # previous content
	    END;
	ELSIF right;
	    content = WRAPPER html/table + html/row
			      valign='middle' width=0
			      pad=0 space=0 border=0;
		INCLUDE html/cell width=0;  # previous content
		WRAPPER html/cell width=0;
		    '&nbsp;';
		    INCLUDE splash/icon img='right';
		END;
	    END;
	END;

	INCLUDE splash/tab 
	        link  = tab.link
    		width = '';
    END;


%]
</tr>
</table>
<!-- /tt2.splash.tabset -->
