<?
session_start();

$document = array();
$script = "";
$init = "";

require "../lib/getnpost.php";
require "../lib/config.php";
require "../lib/dbconnect.php";
require "../lib/auth.php";
require "../lib/common.php";

require "products_config.php";
require "products_common.php";

function mkProdView(&$document, &$script, &$init, $pdid, $ptnum) {
	global $PsycheAdmin;
	global $ptnamearray;

	if (!$pdid) $pdid = 1;	// ¾îÈÖ¸¶¹ý»ç

	$result = mysql_query("select
pd.pdname, pd.pdtopbanner, pd.pdbanner, pd.pdboard,
pc.pcname, pc.pcsubtitle
from products as pd
left join prodcats as pc on pd.pcid = pc.pcid
where pdid = '$pdid'");

	list($pdname, $pdtopbanner, $pdbanner, $pdboard,
	$pcname, $pcsubtitle) = mysql_fetch_row($result);

	if (!$ptnum) $ptnum = 1;

	$pttabarray = array(
		1 => array("tap01.gif", "tap011.gif"),
		2 => array("tap02.gif", "tap021.gif"),
		3 => array("tap03.gif", "tap031.gif"),
		4 => array("tap04.gif", "tap041.gif")
	);

	for ($i = 1; $i <= 4; $i++) {
		if ($i == $ptnum) {
			$pttabimgstring[$i] = <<<EOS
<img src="/products/images/{$pttabarray[$i][1]}" width="90" height="21" border="0">
EOS;
		} else {
			$pttabimgstring[$i] = <<<EOS
<img src="/products/images/{$pttabarray[$i][0]}" width="90" height="21" border="0">
EOS;
		}
	}

	$document['main'] .= <<<EOS

            <table width="748" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td>&nbsp;</td>
              </tr>
            </table>
<a name="pt"></a> 
            <table width="748" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="360" height="55" background="/images/subtitlebox_pat.gif" style="padding-left:30px"><img src="/products/images/$pcsubtitle" ></td>
                <td width="388" background="/images/subtitlebox_pat.gif" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="30" align="right" style="padding-right:10px"><img src="/images/locationbar_title.gif" width="65" height="11" align="absmiddle"><font color="E25561">È¨ 
                        &gt; Á¦Ç°¼Ò°³&gt; $pcname &gt; $pdname </font></td>
                    </tr>
                  </table></td>
              </tr>
            </table> 
            <br>
            <table width="700" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="500" valign="top" background="/products/images/boxbar_pat.gif"><table width="490" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="/products/images/$pdtopbanner" width="490" height="168"></td>
                    </tr>
                  </table>
<br>
                  <table width="490" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="90"><a href="{$_SERVER['PHP_SELF']}?pdid=$pdid&ptnum=1#pt">{$pttabimgstring[1]}</a></td>
                      <td width="3" background="/products/images/tapbarup_pat.gif"></td>
                      <td width="90"><a href="{$_SERVER['PHP_SELF']}?pdid=$pdid&ptnum=2#pt">{$pttabimgstring[2]}</a></td>
                      <td width="3" background="/products/images/tapbarup_pat.gif"></td>
                      <td width="90"><a href="{$_SERVER['PHP_SELF']}?pdid=$pdid&ptnum=3#pt">{$pttabimgstring[3]}</a></td>
                      <td width="3" background="/products/images/tapbarup_pat.gif"></td>
                      <td width="90"><a href="{$_SERVER['PHP_SELF']}?pdid=$pdid&ptnum=4#pt">{$pttabimgstring[4]}</a></td>
                      <td width="121">&nbsp;</td>
                    </tr>
                  </table>
                  <table width="490" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td height="9" background="/products/images/tapbardn_pat.gif"></td>
                    </tr>
                  </table>
                  <table width="490" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td align="center" background="/products/images/tapbox_pat.gif"><br>
<!-- Product Text -->
<table style="width: 470px; height: 300px;">
<tr>
<td style="vertical-align: top;">

EOS;

	if ($PsycheAdmin) {
		$document['main'] .= <<<EOS
<form>
<input type="button" value="³»¿ë ¼öÁ¤" style="width: 80px;"
 onclick="modProdText($ptnum)">
</form>
<br />

EOS;

		$script .= <<<EOS
function modProdText(n) {
	open("/admin/prodtextmod.php?pdid=$pdid&ptnum=" + n, "ProdTextMod", "width=500,height=450,status=yes");
}

EOS;
	}

	$result = mysql_query("select $ptnamearray[$ptnum] from
products
where pdid = '$pdid'");

	list($prodtext) = mysql_fetch_row($result); 

	$document['main'] .= $prodtext;

	$document['main'] .= <<<EOS
</td>
</tr>
</table>

<!-- <iframe id="pdtext" name="pdtext" style="width:470px;height:300px;" scrolling=auto border=0 FRAMEborder=0 FRAMESPACING=0 MARGINHEIGHT=0  src="prodtext.php?pdid=$pdid&ptnum=1"></iframe> -->
                      </td>
                    </tr>
                  </table>
                  <table width="490" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td><img src="/products/images/tapbox_dn.gif" width="490" height="17"></td>
                    </tr>
                  </table>
                 
                </td>
                <td width="200" align="right" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0">
<tr>
                      <td><img src="/products/images/$pdbanner" width="191" height="204"></td>
                    </tr>
                  </table>
                  <br>
                  <table width="190" border="0" cellspacing="0" cellpadding="0">
<tr> 
                      <td height="25" style="padding-left:10px"><img src="/products/images/title_link.gif" width="89" height="14"></td>
                    </tr>
                    <tr> 
                      <td height="9"  background="/products/images/titlebar_pat.gif"></td>
                    </tr>
					 <tr> 
                      <td height="7" ></td>
                    </tr>
                  </table> 
                  <table width="190" border="0" cellspacing="0" cellpadding="2">
                    <tr> 
                      <td width="10" height="0" align="center">&nbsp;</td>
                      <td width="180"><img src="/images/ball_black.gif" width="3" height="11"> 
<a href="/community/list.php?bdid=$pdboard">Á¦Ç° °Ô½ÃÆÇ</a>
</td>
                    </tr>
                    <tr> 
                      <td height="0" align="center">&nbsp;</td>
                      <td><img src="/images/ball_black.gif" width="3" height="11"> 
<a href="/download/downlist.php?dlid=2">Á¦Ç° µ¿¿µ»ó ¸Å´º¾ó</a></td>
                    </tr>
                    <tr> 
                      <td height="0" align="center">&nbsp;</td>
                      <td><img src="/images/ball_black.gif" width="3" height="11"> 
<a href="/community/list.php?bdid=8">Á¦Ç° È°¿ëÆÁ/»ç¿ë±â</a></td>
                    </tr>
<!--
                    <tr> 
                      <td align="center">&nbsp;</td>
                      <td><img src="/images/ball_black.gif" width="3" height="11"> 
                        Á¦Ç° ±×¸² È°¿ë ¿¹Á¦</td>
                    </tr>
-->
                  </table> 
<!--
                  <table width="190" border="0" cellspacing="0" cellpadding="0">
                   <tr> 
                      <td height="5" ></td>
                    </tr>
					<tr> 
                      <td height="1" bgcolor="#E5E5E5"></td>
                    </tr>
                    
                    <tr> 
                      <td height="5" ></td>
                    </tr>
                  </table>
                  <table width="190" border="0" cellspacing="0" cellpadding="2">
                    <tr> 
                      <td width="10" height="0" align="center">&nbsp;</td>
                      <td width="180"><img src="/images/ball_black.gif" width="3" height="11"> 
                        Á¦Ç° »ç¿ë±â</td>
                    </tr>
                    <tr> 
                      <td height="0" align="center">&nbsp;</td>
                      <td><img src="/images/ball_black.gif" width="3" height="11"> 
                        Á¦Ç° ÇÐ½ÀÀÚ·á</td>
                    </tr>
                  </table>
-->
                  <table width="190" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="5" ></td>
                    </tr>
                    <tr> 
                      <td height="1" bgcolor="#E5E5E5"></td>
                    </tr>
                    <tr> 
                      <td height="5" ></td>
                    </tr>
                  </table>
                  <table width="190" border="0" cellspacing="0" cellpadding="2">
                    <tr> 
                      <td width="10" height="0" align="center">&nbsp;</td>
                      <td width="180"><img src="/images/ball_black.gif" width="3" height="11"> 
<a href="/download/downlist.php?dlid=1">µ¥¸ð¹öÀü ´Ù¿î·Îµå</a></td>
                    </tr>
                    <tr> 
                      <td height="0" align="center">&nbsp;</td>
                      <td><img src="/images/ball_black.gif" width="3" height="11"> 
<a href="/shop/shopmain.php">ÃÖ½Å¹öÀü ±¸¸Å</a></td>
                    </tr>
                  </table>
                  <br>
<!--
                  <table width="190" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="25" style="padding-left:10px"><img src="/products/images/title_same.gif" width="89" height="14"></td>
                    </tr>
                    <tr> 
                      <td height="9"  background="/products/images/titlebar_pat.gif"></td>
                    </tr>
                    <tr> 
                      <td height="7" ></td>
                    </tr>
                  </table>
                  <table width="190" border="0" cellspacing="0" cellpadding="2">
                    <tr> 
                      <td width="10" height="0" align="center">&nbsp;</td>
                      <td width="180"><img src="/images/ball_black.gif" width="3" height="11"> 
                        PDA ¾îÈÖ¸¶¹ý»ç</td>
                    </tr>
                    <tr> 
                      <td width="10" height="0" align="center">&nbsp;</td>
                      <td width="180"><img src="/images/ball_black.gif" width="3" height="11"> 
                        L/C¸¶¹ý»ç</td>
                    </tr>
                    <tr> 
                      <td width="10" height="0" align="center">&nbsp;</td>
                      <td width="180"><img src="/images/ball_black.gif" width="3" height="11"> 
                        ¾Ï±â¸¶¹ý»ç</td>
                    </tr>
                  </table> 
-->
                </td>
              </tr>
            </table>

EOS;
}

## Start

mkProdView($document, $script, $init, $pdid, $ptnum);

require "products_template.php";
?>
