<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery/external/jquery.bgiframe-2.1.1.js"></script>
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery/ui/minified/jquery.ui.mouse.min.js"></script>
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery/ui/minified/jquery.ui.draggable.min.js"></script>
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery/ui/minified/jquery.ui.resizable.min.js"></script>
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery/ui/minified/jquery.ui.dialog.min.js"></script>
<script type="text/javascript">
    function openLinksModel(id)
    {
        //alert(id);
        var response;
        $.ajax({
            type: "GET",
            url:"index.php" ,
            data: "module=settings&view=emails&action=openpopup&emailid="+id,
            async: false,
            success: function(data)
            {
                $('#links-modal').html(data);
                $('#links-modal').dialog({
                    autoOpen: false,
                    height: 'auto',
                    width: 'auto',
                    modal: true
                });
                $('#links-modal').dialog('open');
            }
        });
		
                
    }
</script>
<script type="text/javascript">
    function verify()
    {


    SendGridBindRequest('<?= $settingsObj->urlwithpara ?>','gridbody','D','chkgrow');
    }
</script>
<div id="links-modal" title="Details"></div>
<div class="web-booking-main" id="gridbody">
    <div class="breadcrumbs"><a href="index.php">Home </a>&nbsp;>&nbsp; <span class="current">Manage Emails</span></div>
    <div class="clear"></div>
    <?= $messagebox; ?>		
    <?php echo $headerpanel; ?>        
    <?php echo $pagingTop; ?>        

    <br class="clear" />

    <div class="grid-list-subtitle-bg" style="margin-top:10px;margin-right: 2px;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="3%" align="left" valign="top" class="grid-td-left"><input name="chkall" id="chkall" type="checkbox" onclick="checkall('chkgrow')"  /></td>
                <td width="3%" align="left" valign="top" class="grid-td-top">&nbsp;</td>
                <td width="20%" align="left" valign="top" class="grid-td-top">
                    <a href="javascript:;" onclick="SendGridBindRequest('<?= $settingsObj->urlwithoutsort ?>&orderby=var_type&sorting=Y','gridbody','ST')">Email Type<?= $setsortimgvar_type ?></a>
                </td>

                <td width="20%" align="left" valign="top" class="grid-td-top">
                    <a href="javascript:;" onclick="SendGridBindRequest('<?= $settingsObj->urlwithoutsort ?>&orderby=var_from&sorting=Y','gridbody','ST')">From Name<?= $setsortimgvar_from ?></a>
                </td>
                
                <td width="10%" align="left" valign="top"  class="grid-td-top">
                    Details 
                </td>
                <td width="12%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $settingsObj->urlwithoutsort ?>&orderby=dt_createdate&sorting=Y','gridbody','ST')">Date & Time<?= $setsortimgdt_createdate ?></a>
                </td>
               
              <!-- <td width="10%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?= $settingsObj->urlwithoutsort ?>&orderby=var_operation&sorting=Y','gridbody','ST')">Operation<?= $setsortimgvar_operation ?></a>
                </td>-->



            </tr>
        </table>
    </div>

    <div class="information-white-bg" id="dvpersonalinformation" style="margin-right: 2px;">
        <div class="clear"></div>

        <div class="grid-list-inner-table-text">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
            </table> 

            <table width="100%" border="0" cellspacing="0" cellpadding="0">

                <?php
                // echo $numofrows.'ss';
                if ($numofrows > 0) {

                    $rowcount = 0;
                    while ($row = $configObj->glDbObj->fetch_array($result)) {
//                        $clsname = ($row['chr_read'] == 'N') ? "grid-list-inner-table-text-active" : "grid-list-inner-table-text"; // For read unread class
                        //$clsname = 'grid-list-inner-table-text-active';

                        $starimg = ($row['chr_star'] == 'Y') ? "gstar.png" : "gstar-disable.png"; // Displaying the stat and unstart image
                        $tool = ($row['chr_star'] == 'Y') ? "Starred" : "Not starred";
                        ?>
                        <tr id="gtr-<?= $row['int_glcode'] ?>"  style="background-color: transparent;"   onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'" >

                            <td width="6%" align="left" valign="middle" class="grid-td-left"><input name="chkgrow" id="chkgrow" type="checkbox" value="<?php echo $row['int_glcode'] ?>" /></td>

        <?php if ($configObj->glSessionObj->value('admin_id') == '1') { ?>
                                <!--<td width="3%" align="center" valign="middle" class="grid-left1"><img id="star-<?= $row['int_glcode'] ?>" height="16" width="16" alt="remember me" title="<?php echo $tool; ?>" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?><?= $starimg ?>" style="vertical-align:middle;cursor:pointer;"onclick="UpdateStar('<?= DB_PREFIX ?>emails','chr_star','<?= $row['int_glcode'] ?>');"></td>-->
                            <?php } else { ?>
                                <td width="3%" align="center" valign="middle" class="grid-left1"></td>
                            <?php } ?>
                           
                            <td width="20%" align="left" valign="middle" class="grid-td-top">
                                 <span><?= $row['var_type']; ?></span>
                            </td>


                            <td width="20%" align="left" valign="middle" class="grid-td-top">
                            <?php echo $row['var_from']; ?></td>
                            
                            
                             
                            <td width="10%" align="left"  valign="middle" class="grid-td-top">
                                <img style="cursor:pointer;" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>preview.png" onclick="openLinksModel(<?= $row['int_glcode'] ?>);" />
                            <?php // echo $row['txt_body']; ?></td>
                            <td width="12%" align="left" valign="middle" class="grid-td-top">
                            <?php  echo $row["date"] . ' ' . $row["Time"]; ?></td>
                           
                            



                        </tr>
        <?php
        $rowcount++;
    }
} else {
    ?>
                    <tr style="background-color: transparent;"   onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'"> 
                        <td height="25" align="center" valign="middle" colspan="6" class="form_titles">No records are available.</td>
                    </tr>
                            <?
                        }
                        ?>
                <input type="hidden" name="ptrecords" id="ptrecords" value="<?= $rowcount ?>">      

            </table>
        </div>
    </div>



    <div class="clear"></div>

                <?php echo $pagingBottom; ?>
<?php if ($numofrows > 0) { ?>
        <div class="add-new-user-button"><a href="javascript:" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image47','','<?= GLOBAL_ADMIN_IMAGES_PATH ?>delete-button-hover.jpg',0)"><img src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>delete-button.jpg" alt="Delete" name="Image47" width="80" height="25" border="0" id="Image47" onclick="return verify();" /></a></div>
                <? } ?>

</div>