<html>
<head>
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
<title>
<? 

echo"Viewing Image of Product";?></title>
	  <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
	  <link rel='stylesheet' href='../style.css' type='text/css'>
<script language="JavaScript">
function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
</script>
</head>
<body>
<?
include("./config.php");
/***************************************************************************
 *			images.php                   	                   *
 *                     	          				           *
 *   File Info:		  View Image/Information                           *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
$table= "stocks";
$conn = @mysql_connect($server,$user,$password)
	or die("Cannot connect to database");
$rs = @mysql_select_db($database,$conn) 
	or die("Unable to view product image");
$pid = getenv("QUERY_STRING");
$sql = "SELECT * from $table where pid = '$pid'";
$result = mysql_query($sql,$conn)
	or die("Cannot execute SQL query");
$nrow = 0;
while ($row = mysql_fetch_array($result))
{
	$pidme = $row["pid"];
	if ($pidme == $pid)
	{
		$images = $row["spic"];
		$scat = $row["scat"];
		$item = $row["sitem"];
		$stock = $row["stock"];
		$nrow = 1;
	}
}

if ($nrow == 0)
{
	if ($scat == NULL)
	$scat = "n/a";
	if ($item == NULL)
	$item = "n/a";
	if ($stock == 0 or $stock == NULL)
	$stock = "n/a";
	$images = "./images/nopic.jpg";
}
############ code to display enlarge image ################

echo "<center><img src=images/searchs1.gif border=0><font face=verdana size=3 color=navy> PRODUCT INFORMATION</font></center>";
if (fopen($images,"r") == NULL)
	$images = "./images/nopic.jpg";

if (strlen($images) >= 0) {
echo "<table align='center' width='100%'><tr><td align='center' valign='middle'><img src=$images><p>$image</p><p>
<img src =./images/search.gif><a href =  javascript:newWindow('./enlarge.php?$images','acePopup',480,500,'scrollbars=yes')>Enlarge Image</a>
<a href = javascript:history.back()>Previous Page</a></p></td></tr></table>";
echo("<center><br>Item: $item<br>Category: $scat<br>Stock: $stock<br></center>");

$filename = "$site_info_url";
$npid = ltrim($pid);
$filename.= "$npid.txt";

if (@fopen($filename,"r") != NULL)
{
	$filename = "$site_info_url/$npid.txt";
	$file =fopen($filename,"r");
	$filesize = filesize($filename);
	$text = fread($file,$filesize);
	fclose($file);
	echo "<br><center><TABLE cellSpacing=0 cellPadding=0 border=0><TR>
      <TD background=./images/border_cnr_tl.gif><IMG height=8 alt= src=./images/px.gif width=8 border=0></TD>
      <TD background=./images/border_top.gif><IMG height=8 alt= src=./images/px.gif width=120 border=0></TD>
      <TD background=./images/border_cnr_tr.gif><IMG height=8 alt= src=./images/px.gif width=8          border=0></TD></TR><TR><TD background=./images/border_left.gif>
       <IMG height=60 alt= src=./images/px.gif width=8 border=0></TD>
       <TD width=120>
       <TABLE cellSpacing=0 cellPadding=4 width=100% border=0>
       <TBODY>
       <TR>
       <TD><font face=verdana size=2><pre><b>$text</b></pre></font></td></tr>";
	echo "</TBODY></TABLE></TD><TD background=./images/border_right.gif>
      <IMG height=60 alt= src=./images/px.gif width=8 border=0></TD></TR>
      <TR><TD background=./images/border_cnr_bl.gif>
      <IMG height=8 alt= src=./images/px.gif width=8 border=0></TD>
      <TD background=./images/border_bottom.gif>
      <IMG height=8 alt= src=./images/px.gif width=121 border=0></TD>
      <TD background=./images/border_cnr_br.gif>
      <IMG height=8 alt= src=./images/px.gif 
      width=8 border=0></TD></TR></TABLE></center><br><br>";
}
else
{
	$filename = "$site_info_url/noinfo.txt";
	$file =fopen($filename,"r");
	$filesize = filesize($filename);
	$text = fread($file,$filesize);
	fclose($file);
	echo "<br><center><TABLE cellSpacing=0 cellPadding=0 border=0><TR>
      <TD background=./images/border_cnr_tl.gif><IMG height=8 alt= src=./images/px.gif width=8 border=0></TD>
      <TD background=./images/border_top.gif><IMG height=8 alt= src=./images/px.gif width=120 border=0></TD>
      <TD background=./images/border_cnr_tr.gif><IMG height=8 alt= src=./images/px.gif width=8          border=0></TD></TR><TR><TD background=./images/border_left.gif>
       <IMG height=60 alt= src=./images/px.gif width=8 border=0></TD>
       <TD width=120>
       <TABLE cellSpacing=0 cellPadding=4 width=100% border=0>
       <TBODY>
       <TR>
       <TD><font face=verdana size=2><pre><b>$text</b></pre></font></td></tr>";
	echo "</TBODY></TABLE></TD><TD background=./images/border_right.gif>
      <IMG height=60 alt= src=./images/px.gif width=8 border=0></TD></TR>
      <TR><TD background=./images/border_cnr_bl.gif>
      <IMG height=8 alt= src=./images/px.gif width=8 border=0></TD>
      <TD background=./images/border_bottom.gif>
      <IMG height=8 alt= src=./images/px.gif width=121 border=0></TD>
      <TD background=./images/border_cnr_br.gif>
      <IMG height=8 alt= src=./images/px.gif 
      width=8 border=0></TD></TR></TABLE></center><br><br>";
}
}

?>
</body>
</html>