<?php

	/*
		==================================================================
			expects
			$pages
			$num_results
			$all_media = array of media post ids 
		==================================================================  */
		

?>

	<table cellpadding = "0" cellspacing = "0" width = "100%" >
		<tr>
			<td width = "50%" ><p>Number of results: <?php echo count($all_media); ?></p></td>
			<td align = "center" ><?php print $this->build_pagenation(count($all_media),$disp_num_results,$page);?></td>
		</tr>
	</table>
	<div style = "text-align: center;">
	<?php
	if (is_array($all_media) && count($all_media) > 0)
	{
	$all_media = array_splice($all_media,(($page * $disp_num_results) + ($page > 0? -1:0)),($disp_num_results));
	
		foreach($all_media as $media_id)
		{
			
			$media = $this->get_img($media_id->ID);
			
			?>
			<div class = "gsaltimg-mediacell" role = "<?php echo $media_id->ID;?>">
				<p class ="gsaltimg-title"><small title = "<?php echo htmlentities(html_entity_decode($media->title)); ?>"><?php echo (strlen($media->title) > 16? substr($media->title,0,14).'&#8230;' : $media->title); ?></small></p>
				<?php echo $media->html; ?>
			</div>
	<?php
			
		}
	print '<p style = "text-align: center;">Click images to add to image panel</p>';
	}
	
	else { print '<p>No media match that criterea</p>'; }
	
	?>

		<div class = "clear"></div>
	</div>
		