{{RunQuery ResultsVar=galleries q="SELECT Collection_80.* , Collection_81.* FROM Collection_81 INNER JOIN Collection_80 ON Collection_80_ID = Collection_81_5 WHERE Collection_80_1 IS NOT NULL AND Collection_80_4 IS NOT NULL AND Collection_80_3 = 'on' Group By Collection_80_ID Order By Collection_80_2 , Collection_81_6 , Collection_81_1 "}}
<div id="photo-module">{{assign var=tmp value="&qu"|concat:"ot;"}}
{{if $galleries|@count gt 0}}
{{assign var=morepages value=0}}
<div id="thumbs">
	<div class="thumb-section">
	{{foreach from=$galleries item=v kye=k name=n}}
		{{if $smarty.foreach.n.index gt 0 and $smarty.foreach.n.index % 9 eq 0}}{{assign var=morepages value=1}}</div><div class="thumb-section">{{/if}}
		<a href="{{$v.Collection_81_2}}" class="thumb" id="gallery-{{$v.Collection_80_ID}}">
          <img src="{{$v.Collection_80_4}}" alt="{{$v.Collection_80_1|replace:'"':$tmp}}">
          <div class="thumb-text">
            {{$v.Collection_80_1|replace:'"':$tmp}}
          </div><!-- div.thumb-text -->
        </a><!-- div.thumb -->
	{{/foreach}}
	<div class="clear"></div>
	</div>
</div>
{{if $morepages eq 1}}
<div id="thumbs-nav">
      <ul>
      </ul>
</div><!-- div#photo-module-nav -->	
{{/if}}
{{/if}}
<div class="clear">&nb{{**}}sp;</div>
</div>
<div class="clear"></div>