<?
	include("include/common.php");
?>
<?
	$id = $_REQUEST['id'];
	ob_start();
		$gallery = mysql_fetch_object( mysql_query("SELECT * FROM gallery WHERE id='$id'") );
?>
		<h3>Image Gallery: <?=$gallery->name?></h3>
		<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td>
<?
				$sql = "SELECT images.* FROM gitem,images WHERE images.id=gitem.image AND gid='".$gallery->id."'";
				$qr1 = mysql_query($sql);
				$rowcount = mysql_num_rows($qr1);
				$domCount = 0;
				while( $a = mysql_fetch_object($qr1) ){
					$filen = $siteurl."/".str_replace('./', '', $att_path)."/".$a->filename;
					$filen = str_replace('http://','%%',$filen);
					$filen = str_replace('//','/',$filen);
					$filen = str_replace('%%','http://',$filen);
					if( file_exists($att_path."/".$a->filename)	){
						echo "<a href='$filen' target='_new'><img src='$filen' width=100 height=100 border=0></a><br>";
					}else{
						echo "no image found<br>";
					}
				}
?>
			</td>
		</tr>
		</table>
<?
	$output = ob_get_contents();
	ob_end_clean();
	$output = str_replace("'", "", $output);
	$output = str_replace("\r", "", $output);
	$output = str_replace("\n", "", $output);
	print "document.write('$output');";
?>
