<?php
include "./includes/session.php";
include "./includes/config.php";
include "./includes/function.php";
$templateid = $_GET['id'];
$qry = "select t.ntemplate_mast,t.vtype,c.ncat_id,c.vcat_name,c.vcat_desc from tbl_template_mast t 
        left join tbl_template_category c on t.ncat_id=c.ncat_id where t.ntemplate_mast='" . addslashes($templateid) . "'";
$rs = mysql_query($qry);
$row = mysql_fetch_array($rs);
?>
 <a href="javascript:void(0);" onclick="closePopup('300');">X</a>

 <div>
     <a href="javascript:void(0);" onclick="changethemeimage(<?php echo $templateid; ?>,'image_theme_1.jpg');">blue</a>
     | <a href="javascript:void(0);" onclick="changethemeimage(<?php echo $templateid; ?>,'image_theme_2.jpg');">green</a> 
     | <a href="javascript:void(0);" onclick="changethemeimage(<?php echo $templateid; ?>,'image_theme_3.jpg');">red</a>
 </div>


 <div style="height:500px;overflow:auto;">
      <table  align=center>
         <tr>
             <td>
                 <table width="60%" border=0 align=center>
                     <tr>
                         <td class=maintext width="30%">Template Category</td>
                         <td class=maintext><?php echo $row['vcat_name']; ?></td>
                     </tr>
                     <tr>
                         <td class=maintext width="30%">Category description</td>
                         <td class=maintext><?php echo $row['vcat_desc']; ?></td>
                     </tr>
                     <tr>
                         <td class=maintext width="30%">Template type</td>
                         <td class=maintext><?php echo $row['vtype']; ?></td>
                     </tr>
                 </table>
             </td>
         </tr>
         
         <tr>
            <td> 
                 <table width="100%" border=0 align=center>
                     <tr><td>&nbsp;</td></tr>
                     <?php
                     $sql_template_theme = "SELECT * FROM  tbl_template_themes  WHERE temp_id=".$templateid." AND theme_status='1' ORDER BY theme_id";
                     $res_template_theme = mysql_query($sql_template_theme);
                     if (mysql_num_rows($res_template_theme) > 0) {
                        $cnt=1;
                        while ($row_template_theme = mysql_fetch_array($res_template_theme)) {?>
                            <tr>
                                <?php
                                //$pichome = "showtemplateimage.php?type=home&tmpid=" . $templateid . "&";
                                $pichome = "showtemplateimage.php?type=home&tmpid=" . $templateid . "&imgname=".$row_template_theme['theme_image_home'];
                                ?> 
                                <td align=center id="div_home_<?php echo $row_template_theme['theme_id']?>" class="jThemeDisplay" <?php if($cnt!=1){?> style="display:none"<?php }?>><img id="themeimage" src="<?php echo $pichome; ?>"></td>
                            </tr>
                       <?php
                       $cnt++;
                        }
                     }?>
                     <tr><td>&nbsp;</td></tr>		
                 </table>
             </td>
         </tr>
             
         <tr>
             <td>
                 Sub page 
                 <table width="100%" border=0 align=center>
                     <tr><td>&nbsp;</td></tr> 
                     <!--<tr>
                         <?php
                         $picsub = "showtemplateimage.php?type=sub&tmpid=" . $templateid . "&";
                         ?> 
                         <td align=center><img src="<?php echo $picsub; ?>"></td>
                     </tr>-->
                     <?php
                     //$sql_template_theme = "SELECT * FROM  tbl_template_themes  WHERE temp_id=".$templateid." AND theme_status='1' ORDER BY theme_id";
                     $res_template_theme = mysql_query($sql_template_theme);
                     if (mysql_num_rows($res_template_theme) > 0) {
                        $cnt=1;
                        while ($row_template_theme = mysql_fetch_array($res_template_theme)) {?>
                            <tr>
                                <?php
                                //$pichome = "showtemplateimage.php?type=home&tmpid=" . $templateid . "&";
                                $pichome = "showtemplateimage.php?type=sub&tmpid=" . $templateid . "&imgname=".$row_template_theme['theme_image_sub'];
                                ?> 
                                <td align=center id="div_sub_<?php echo $row_template_theme['theme_id']?>" class="jThemeDisplay" <?php if($cnt!=1){?> style="display:none"<?php }?>><img id="themeimage" src="<?php echo $pichome; ?>"></td>
                            </tr>
                       <?php
                       $cnt++;
                        }
                     }?>
                     <tr><td>&nbsp;</td></tr>		
                 </table>
                     
             </td>
         </tr>
     </table>
</div>