<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
//$cols = 3;

?>

<div class="air"></div>
<?php
$n_img = sizeof($gis);
if ($n_img > 0){
?>
	<table class="media_grid" cellspacing="1">
		<?php
		for ($i = 0; $i < $n_img; $i++) {
			if ($i % $cols == 0) {
				echo '<tr>';
			}
		?>
			<td width="<?php echo intval(100 / $cols); ?>%">
				<a href="index.php?<?php echo Html::xuriquery('mod_gallery_item', 'gi_content', array('gi_id' => $gis[$i]->id)); ?>" ><img border="0" src="<?php echo $gis[$i]->feature_thumb;?>" class="media_thumb" /></a>
				<br />
				<span class="small">
				<?php echo $gis[$i]->title;?>
				</span>
			</td>
		<?php
			if (($i % $cols) == ($cols - 1)) {
				echo '</tr>';
			}
		}
		if ($i % $cols != 0) {
			for ($j = 0; $j < ($cols - $i); $j++) {
				echo '<td width="'.intval(100 / $cols).'%">&nbsp;</td>';
			}
			echo '</tr>';
		}
		?>
	</table>
<?php } ?>

<?php
include_once(P_TPL.'/common/pager.php');
?>