<?
session_start();

include('_db.connection.php');
$setup_result = mysql_query("SELECT title,url FROM setup WHERE setup_id = 1", $db);
$setup = mysql_fetch_object($setup_result);

switch($pmode){
	case "build":
		$imgarray = "";
		session_register("imgarray");
		session_register("ss_count");
		session_register("site_name");
	
		$site_name = $sid;			
		$imgarray[] = "";

		$ss_result = mysql_query("SELECT image_id FROM images WHERE fid = '$fid'", $db);
		$ss_count = mysql_num_rows($ss_result);
		while($ss = mysql_fetch_object($ss_result)){
			$imgarray[] = $ss->image_id;
		}
		header("location: ss.window.php");
		exit;
	break;
	default:
	
		if($i == ""){
		$i = 1;
		}
?>
<title><? echo $setup->title; ?></title>
<body bgcolor="#eeeeee" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0"> 
	<table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0">
		<tr>
			<td height="100%" align="center" valign="middle"><?php echo "<img src=\"is.php?i=$imgarray[$i]\" style=\"border: 1px solid #000000;\">"; ?></td>
		</tr>
		<tr>
			<td height="20">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td align="left" height="20" background="./images/ss.bg.gif"><?
							if($i > 1){
								echo "<a href=\"ss.window.php?i=" . ($i - 1) . "\"><img src=\"images/ss.left_off.gif\" border=\"0\" onmouseover=\"left.src='./images/ss.left_on.gif'\" onmouseout=\"left.src='./images/ss.left_off.gif'\" name=\"left\"></a>";
							}
						?></td>
						<td height="20" background="./images/ss.bg.gif"><a href="javascript:window.close();"><img src="images/ss.close.gif" border="0"></a></td>
						<td width="100%" background="./images/ss.bg.gif" valign="middle" align="middle"><b><font face="verdana" size="1" color="#D0D7E2">Slideshow by <a href="<? echo $setup->url; ?>" target="_new"><font face="verdana" size="1" color="#D0D7E2"><? echo $setup->title; ?></a></td>
						<td height="20" align="right" background="./images/ss.bg.gif"><?
							if($i < $ss_count){
								echo "<a href=\"ss.window.php?i=" . ($i + 1) . "\"><img src=\"images/ss.right_off.gif\" border=\"0\" onmouseover=\"right.src='./images/ss.right_on.gif'\" onmouseout=\"right.src='./images/ss.right_off.gif'\" name=\"right\"></a>";
							}
						?></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</body>
<?
	break;
}
?>