<?
	require_once('control/include/user.php');
	require_once('control/include/mysql.php');
	require_once('control/include/functions.php');
	require_once('control/include/fb.php');
	
	ob_start();
	session_start();
	
	// SETUP MYSQL HANDLERS
	$mysqldb1 = new mysql($host, $user, $pswd, $db); $mysqldb1->connect(); $mysqldb1->select();
?>
<?
	$query = "
	SELECT 
		t1.* 
	FROM 
		file AS t1
	WHERE 
		t1.status='enabled' AND 
		t1.record_id=(SELECT id FROM ".$_GET['table']." WHERE link_name='".$_GET['link_name']."' LIMIT 1) AND 
		t1.source='".$_GET['table']."' AND
		t1.type='image' 
	ORDER BY 
		t1.sequence ASC";
	//fb($query);
	$mysqldb1->query($query);
?>
<? if ($mysqldb1->affectedRows() > 0) { ?>
<div class="column_module">
<div class="column_module_heading">Photos</div>
<div class="column_module_body">
<?
	while ($image = $mysqldb1->fetchArray()) { ?> 
    	<div class="image"><a href="/<? print $largeDIR.$image['name']; ?>" title="<? print $image['description']; ?>" rel="shadowbox['photos']" class="popup"><img src="/<? print $smallDIR.$image['name']; ?>" alt="<? print $image['name']; ?>" title="<? print $image['description']; ?>" border="0"/></a></div>
	<? } ?>
</div>
</div>
<? } ?>
<?
	$mysqldb1->close();
?>