<?php
session_start();
ob_start();
include_once("dbconnect.php");
//echo "select * from products where pid =".$_GET['product_id'];exit;
 $prores = mysql_fetch_array(mysql_query("select * from products where pid =".$_GET['prodid']));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: Welcome to SIR BOX and PLASTICS ::</title>



<script type="text/JavaScript">

<!--

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}

//-->
function val()
{
if(document.getElementById("qty").value=="")
{
alert("please Enter Quantity");
return false;
}
return true;

}


</script>
<script language="JavaScript1.2">mmLoadMenus();</script>
<script language="javascript">
	function changeimg(key){
		var number= key.title;
		
		document.getElementById("big").src = "images/products/<?=$prores['pid']; ?>-"+number+".jpg";
	}
</script>


<style type="text/css">
<!--
body, td, th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #333;
}
body {
	background-image: url(images/all_bg.jpg);
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #fff;
	background-repeat: repeat-x;
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
	color: #CCCCCC
}
.style2 {
	font-size: 12px;
	color: #FFFFFF;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
</head>
<body>
<? include_once("header.php"); ?>
              <tr>
                <td align="left" valign="top" height="5"></td>
              </tr>
              <tr>
                <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="260" align="left" valign="top"><? include_once("left_links.php"); ?></td>
                      <td align="right" valign="top"><table width="99%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td align="left" valign="top"><table width="99%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td align="left" valign="top">
                                
                              <?php  $getProd_details = mysql_fetch_array(mysql_query("select * from products where pid = ".$_GET['product_id'])); ?>

                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
								   <?php 
					  if($_GET['category_id']!="" && $_GET['subcat_id']!="" && $_GET['product_id']!="" ) {
					  $get_catname = mysql_fetch_array(mysql_query("select categoryname from tblcategories where category_id=".$_GET['category_id'])); 
					  $get_subcatname = mysql_fetch_array(mysql_query("select subcat_name from tblsubcategories where subcat_id =".$_GET['subcat_id']));
					  
					   $getpname = mysql_fetch_array(mysql_query("select pname from products where pid =".$_GET['product_id']));
					  }
							 
							 ?>
                                    <td align="left" valign="top"><img src="images/pl1.gif" width="10" height="47" alt="" /></td>
                                    <td align="left" background="images/pc1.gif" class="header2" style="padding-left:15px;"><a href="index.php" class="header2">Home</a> &gt;&gt;  <a href="subcategories.php?category_id=<?=$_GET['category_id']?>" class="header2"><?=$get_catname[categoryname]?></a> &gt;&gt; <span class="white_h"><?=$get_subcatname[subcat_name]?>&gt;&gt;<a href="products.php?subcat_id=<?=$_GET['subcat_id']?>" class="header2"><?=$get_catname[categoryname]?></a> &gt;&gt;  &gt;&gt; <span class="white_h"><?=$getpname[pname]?></span></td>
                                    <td align="left" valign="top"><img src="images/pr1.gif" width="10" height="47" alt="" /></td>
                                  </tr>
                                  <tr>
                                    <td align="left" valign="top" bgcolor="#E1EAF6" >&nbsp;</td>
                                    <td align="left" valign="top" bgcolor="#E1EAF6">&nbsp;</td>
                                    <td align="left" valign="top" bgcolor="#E1EAF6">&nbsp;</td>
                                  </tr>
                                  <tr>
                                    <td width="10" align="left" valign="top" bgcolor="#E1EAF6" >&nbsp;</td>
                                    <td align="left" valign="top" bgcolor="#E1EAF6"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td height="20" colspan="2" align="left" valign="top" ><span class="header3">Products</span> <br /></td>
                                      </tr>
                                      <tr>
                                        <td height="7" colspan="2" align="left" valign="top"></td>
                                      </tr>
                                      <tr>
                                        <td align="left" valign="top">
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td width="8" align="left" valign="top"><img src="images/il1.gif" width="8" height="10" alt="" /></td>
                                            <td align="left" valign="top" background="images/it1.gif"></td>
                                            <td width="8" align="left" valign="top"><img src="images/ir1.gif" width="8" height="10" alt="" /></td>
                                          </tr>
                                          <tr>
                                            <td align="left" valign="top" background="images/il2.gif">&nbsp;</td>
                                            <td height="100" align="left" valign="top" bgcolor="#FFFFFF">
                                            <form action="addtocart.php" method="post" name="proddetail" onsubmit="return val();">
                                            <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#92B3DE">
                                              <tr bgcolor="#FFFFFF">
                                                <td valign="top">
                                                <img src="images/products/<?=$_GET['product_id']?>-1.jpg" id="big" />
                                               </td>
                                                <td valign="top"><p><strong><?=$getProd_details[pname]?><input type="hidden" name="itemno" value="<?=$getProd_details[itemno]?>" /></strong></p>
                                                  <table width="155" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#9DBAE1">
                                                    <tbody>
                                                      <tr>
                                                        <td colspan="2" bgcolor="#E1EAF6"><strong>Item Number</strong></td>
                                                      </tr>
                                                      <tr bgcolor="#F3F7FC">
                                                       
                                                        <td width="65">
                                                          <?=$getProd_details[itemno]?></td>
                                                          
                                                         
                                                      </tr>
                                                    </tbody>
                                                  </table><br />
                                                  <table width="155" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#9DBAE1">
                                                    <tbody>
                                                      <tr bgcolor="#9DBAE1">
                                                        <td colspan="2" bgcolor="#E1EAF6"><strong>Our Price</strong></td>
                                                      </tr>
                                                      <tr bgcolor="#E1EAF6">
                                                       <? if($getProd_details['mini']!="" and $getProd_details['maxi']!="" ) { ?> <td width="65" align="right" bgcolor="#F3F7FC">Unit</td><? } ?>
                                                        <td width="60" align="center" bgcolor="#F3F7FC">Price</td>
                                                      </tr>
                                                      <? 
													 
													$size=$getProd_details['unitsprice']; 
													$str2=explode(',',$size);
													 $mini=$getProd_details['mini']; 
													$strmin=explode(',',$mini);
													 $maxi=$getProd_details['maxi']; 
													$strmax=explode(',',$maxi);
													$cnt=count($str2);
																			
										for( $j=0;$j<$cnt;$j++)
                                                     { 
														$str2[$j] = $str2[$j] - ($str2[$j]*$getProd_details['discount']/100) ;
														if($_SESSION['sirboxid']!="") { 
														?>
                                                      <tr align="center" bgcolor="#ffffff">
                                                        <? if($strmax[$j]!="" ) { ?><td width="65" align="right" bgcolor="#F3F7FC"><? if($strmin[$j]=="" ) { ?> ><? } else { ?><?=$strmin[$j] ?>-<? } ?><?=$strmax[$j]?></td><? } ?>
                                                        <td width="60" align="center" bgcolor="#F3F7FC">$<?=number_format($str2[$j],2);?></td>
                                                      </tr>
                                                      <? } } ?> 
                                                      
                    <input type="hidden" name="price" id="price" value="<?=$getProd_details[unitsprice];?>" />
                    <input type="hidden" name="mini" id="mini" value="<?=$getProd_details[mini];?>" />
                    <input type="hidden" name="maxi" id="maxi" value="<?=$getProd_details[maxi];?>" />
                     <? if($_SESSION['sirboxid']=="") { ?>
                                                      
                                                       <tr align="center" bgcolor="#ffffff">
                                                        
                                                        <td width="60" align="center" bgcolor="#F3F7FC" colspan="2">Login to See Prices</td>
                                                      </tr>
                                                      <? } ?>
                                                    </tbody>
                                                  </table>
                                                  <br />
                                                  
                                                  <table width="155" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#9DBAE1">
                                                    <tbody>
                                                      <tr>
                                                        <td colspan="2" bgcolor="#E1EAF6" align="center"><strong>Available Color</strong></td>
                                                      </tr>
                                                      <tr bgcolor="#FFFFFF">
                                                        <? $expl_col = explode(',',$getProd_details[colors]); 
													     $cnt=1;
													     for($pri_col=0;$pri_col<count($expl_col);$pri_col++)
														 { 
														 
														 ?>
                                                        <td width="100%" align="center"><input name="ProductColor" value="<?=$expl_col[$pri_col]?>" type="radio" <? if($pri_col==0) { ?> checked="checked" <? } ?> />
                                                            <?php echo $expl_col[$pri_col]?></td>
                                                        <?
														  $cnt++;
														  if($cnt==10) { echo "</tr><tr bgcolor='#F3F7FC'>"; $cnt=1; }
														  
														  } ?>
                                                      </tr>
                                                    </tbody>
                                                  </table>
                                                  <br />
												   <table width="155" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#9DBAE1">
                                                    
                                                      <tr>
                                                        <td colspan="3" bgcolor="#E1EAF6"><strong> Sizes</strong></td>
                                                      </tr><? $expl_co55 = explode(',',$getProd_details[sizes]); 
													     $cnt55=1;
													     for($pri_co55=0;$pri_co55<count($expl_co55);$pri_co55++)
														 { 
														 
														 ?>
                                                      <tr bgcolor="#F3F7FC" >
                                                       
                                                        
                                                        
                                                        <td width="70">
                                                          <?=htmlspecialchars(trim($expl_co55[$pri_co55]))?></td>
                                                          
                                                       
                                                      </tr>   <?
														 
														  
														  } ?>
                                                   
                                                  </table>
                                                   <br />

                                                   <table width="155" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#9DBAE1">
                                                     <tbody>
                                                       <tr>
                                                         <td colspan="2" bgcolor="#E1EAF6" align="center"><strong>Min.Quantity</strong></td>
                                                         
                                                       </tr>
                                                      
                                                       <tr bgcolor="#F3F7FC" >
                                                         <td colspan="2"><?php echo $getProd_details['mini'];?></td>
                                                         
                                                       </tr>
                                                       
                                                     </tbody>
                                                   </table>
                                                   <br />
                                                   

                                                   <?php
														if($prores['Print']=="imprint") {
														?>
                                                        
                                                        
                                                        
                                                        
                                                        
                                                           <table width="155" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#9DBAE1">
                                                             <tbody>
                                                               <tr>
                                                                 <td colspan="3" bgcolor="#E1EAF6" align="center"><strong>imprint</strong></td>
                                                               </tr>
                                                               <tr bgcolor="#F3F7FC">
                                                                 <td >Yes
                                                                   <input type="radio" name="print" value="<?php if($prores['Print']=="imprint") { ?>"  checked="checked" <? }else {?>disabled="disabled"   <?php }?>></td>
                                                                 <td colspan="2" >No
                                                                   <input type="radio" name="print" value="<?php if($prores['Print']=="noprint"){ ?> " checked="checked" <? }else {?>  disabled="disabled"   <?php }?>/>	
</td>
                                                               </tr>
                                                             </tbody>
                                                           </table>
                                                           
                                                           
                                                           
                                                           
                                                           
                                                           
                                                           
                                                           
                                                           
                                                         <?php } ?>
                                                     
                                                   <br />
                                                  <table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                      <td>Qty
                                                        <input name="qty" id="qty" type="text" size="5" value="" />
                                                        <input type="hidden" name="prodid" id="prodid" value="<?=$_GET['product_id']?>" /><input type="hidden" name="prodname" id="prodname" value="<?=$getProd_details[pname]?>" />
														<input type="hidden" name="weight" id="weight" value="<?=$getProd_details[weight]?>" />
                                                        <input type="hidden" name="size" value="<?=$getProd_details[sizes]?>"/>
                                                        <input type="hidden" name="itemno" value="<?=$getProd_details[itemno]?>" />
                                                        </td>
                                                      <td><input type="image" name="submit" src="images/buy.gif" alt="" width="77" height="20" border="0" onclick="return val();" /></td>
                                                    </tr>
                                                  </table></td>
                                              </tr>
                                              <tr bgcolor="#FFFFFF">
                                                <td colspan="2" align="center" valign="top">
                                                <? if($getProd_details[image1]!="") { ?>
                                             <img src="thumbimages.php?imgid=<?=$getProd_details[pid]?>-1.jpg" border="0" title="1" onclick="changeimg(this);"/><? } ?>
											   <? if($getProd_details[image2]!="") { ?>
                                             <img src="thumbimages.php?imgid=<?=$getProd_details[pid]?>-2.jpg" border="0" title="2" onclick="changeimg(this);"/><? } ?>
											   <? if($getProd_details[image3]!="") { ?>
                                             <img src="thumbimages.php?imgid=<?=$getProd_details[pid]?>-3.jpg" border="0" title="3" onclick="changeimg(this);"/><? } ?>
                                             		   <? if($getProd_details[image4]!="") { ?>
                                             <img src="thumbimages.php?imgid=<?=$getProd_details[pid]?>-4.jpg" border="0" title="4" onclick="changeimg(this);"/><? } ?>
                                             
                                             <? if($getProd_details[image5]!="") { ?>
                                             <img src="thumbimages.php?imgid=<?=$getProd_details[pid]?>-5.jpg" border="0" title="5" onclick="changeimg(this);"/><? } ?>
											   
                                               
                                                 </td>
                                              </tr>
											   <tr bgcolor="#FFFFFF">
                                                <td colspan="2" valign="top" bgcolor="#E1EAF6"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                                                  <tr>
                                                    <td height="25" colspan="2" bgcolor="#FFFFFF"><strong>Description :</strong></td>
                                                  </tr>
                                                  <tr>
                                                    <td colspan="2" bgcolor="#FFFFFF" align="left"><?php echo $getProd_details[description]?></td>
                                                  </tr>
                                                </table></td>
                                              </tr>
                                              <tr bgcolor="#FFFFFF">
                                                <td colspan="2" valign="top" bgcolor="#E1EAF6"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                                                  <tr>
                                                    <td height="25" colspan="2" bgcolor="#FFFFFF"><strong>Related Products :</strong></td>
                                                  </tr>
                                                  <? 
												  if($getProd_details[relatedprods]!="")
												  {
												  $get_related = explode(',',$getProd_details[relatedprods]);
												  
												     
												     if(count($get_related)>=4)
													 {
														 $rel_count = 4;
													 }
													 else
													 {
														 $rel_count = 1;
													 }
												     for($rel=0;$rel<$rel_count;$rel++)
													 {
														 
														 $getpro_data = mysql_fetch_array(mysql_query("select * from products where pid = ".$get_related[$rel]));
												  ?>
                                                  <tr>
                                                    <td width="24%" bgcolor="#FFFFFF" align="center"><a href="product_details.php?product_id=<?=$getpro_data[pid]?>&category_id=<?=$getpro_data[catid] ?>&subcat_id=<?=$getpro_data[subcat_id] ?>" ><img src="thumbimages.php?imgid=<?=$getpro_data[pid]?>-1.jpg&rel=true" alt=""  border="0"/></a></td>
                                                    <td width="76%" valign="top" bgcolor="#FFFFFF"><strong><?=$getpro_data[pname]?></strong><br /><?=$getpro_data[description]?>
                                                      </td>
                                                  </tr>
                                                  <? } } else { ?>
                                                   <tr>
                                                    <td colspan="2" align="center" bgcolor="#FFFFFF"><strong>No Related Products Found</strong><br />                                                    </td>
                                                    </tr>
                                                  <? } ?>
                                                </table></td>
                                              </tr>
                                            </table>
                                            </form>
                                            </td>
                                            <td align="left" valign="top" background="images/ir2.gif">&nbsp;</td>
                                          </tr>
                                          <tr>
                                            <td width="8" align="left" valign="top"><img src="images/il3.gif" width="8" height="10" alt="" /></td>
                                            <td align="left" valign="top" background="images/ib1.gif"></td>
                                            <td align="left" valign="top"><img src="images/ir3.gif" width="8" height="10" alt="" /></td>
                                          </tr>
                                        </table></td>
                                      </tr>
                                    </table></td>
                                    <td align="left" valign="top" bgcolor="#E1EAF6">&nbsp;</td>
                                  </tr>
                                  <tr>
                                    <td width="10" align="left" valign="top"><img src="images/l3.gif" width="10" height="10" alt="" /></td>
                                    <td align="left" valign="top" bgcolor="#E1EAF6"></td>
                                    <td width="10" align="left" valign="top"><img src="images/r3.gif" width="10" height="10" alt="" /></td>
                                  </tr>
                                </table>
                                
                                </td>
                              </tr>
                            </table></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td height="6" align="left" valign="top"></td>
              </tr>
              <? include_once("footer.php"); ?>
              <tr>
                <td height="10" align="left" valign="top"></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>