<?php if (!$configObj->isAjaxSet) { ?>
    <script type="text/javascript" src="html/js/highslide/highslide-with-html.js"></script>
    <link rel="stylesheet" type="text/css" href="html/js/highslide/highslide.css" />
    <script type="text/javascript">
        hs.graphicsDir = 'html/js/highslide/graphics/';
        hs.outlineType = 'rounded-white';
        hs.showCredits = false;
        hs.wrapperClassName = 'draggable-header';
    </script>
    <script type="text/javascript">
        function verify()
        {
            SendGridBindRequestDeleteHistory('<?= $historyObj->urlwithpara ?>','gridbody','chkgrow','Y');
        }

        function SendGridBindRequestDeleteHistory(url,targetdiv,chkidfordelete,historyflag)
        {
            xmlHttp = GetXmlHttpObject();

            if(xmlHttp != null)
            {
                xmlHttp.onreadystatechange = function()
                {
                    if(xmlHttp.readyState==1)
                    {
                        SetBackground();
                    }

                    if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
                    {
                        var str =  xmlHttp.responseText;
                        document.getElementById(targetdiv).innerHTML = '';
                        document.getElementById(targetdiv).innerHTML = str;
                        UnsetBackground();
                        alert('The record(s) has been succesfully deleted.');
                    }
                };

                var appendurl = '';
                var chkelements = document.getElementsByName(chkidfordelete);
                var ids = "";
                var countChecked = 0;
                for(var i = 0; i < chkelements.length; i++)
                {
                    if(chkelements.item(i).checked == true)
                    {
                        countChecked++;
                        if(ids != "")
                            ids += ",";
                        ids += chkelements.item(i).value;
                    }
                }
                if(countChecked == 0)
                {
                    alert("Please select atleast one record for delete.");
                    return false;
                }
                if(!confirm('This will delete the selected records. Are you sure you want to continue?'))
                {
                    return false;
                }
//                alert(ids);
                if(historyflag=='Y')
                {
                    var totalpagerecords = document.getElementById('ptrecords').value;

                    appendurl = '&type=delete&ptotalr='+totalpagerecords+'&historyid='+ids;
                }
                else
                {
                    appendurl = '&history_action=delete&recordid='+ids;
                }
                xmlHttp.open('GET', url + '&ajax=Y'+appendurl, true);
                xmlHttp.send(null);
            }
            else
            {
                alert("Your browser does not support HTTP request.");
            }
            return true;
        }

    </script>
    
    <div class="web-booking-main">

        <?php
        
        if ($_REQUEST['type'] == 'P') {
            $title = "Photo";
        } else {
            $title = "Document";
        }
        
        if ($_REQUEST['view'] == 'homebanner') {
            $view = $_REQUEST['view'];
        }
        if ($_REQUEST['module'] == 'photogallery' || $_REQUEST['module'] == 'videogallery' ) {
            if ($_REQUEST['module'] == 'photogallery') {
                $objects = $photogalleryObj;
                $title = $title;
            } else {
                $objects = $videogalleryObj;
                $title = "Video";
            }
        
            if($_REQUEST['custom'] == 'Y') { ?>
                <div class="breadcrumbs">
                    <a href="index.php">&nbsp;&nbsp;Home </a>&nbsp;>&nbsp;&nbsp; 
                    <?php if ($_REQUEST['id'] != '1') { ?><a href="index.php?module=<?php echo $objects->modulename('8') ?>&view=module&pageid=<?php echo $_REQUEST['mid'] ?>"><?php echo 'Manage' . ' ' . ucfirst($objects->custome_modulename($_REQUEST['mid'])) ?> </a> &nbsp;>&nbsp;&nbsp;<?php } ?>
                    <a href="index.php?module=<?php echo $_REQUEST['module'] ?>&mid=<?php echo $_REQUEST['mid'] ?>&id=<?php echo $_REQUEST['id'] ?>&type=<?php echo $_REQUEST['type'] ?>&custom=Y&back_url_string=<?php echo $_REQUEST['back_url_string'] ?>">Manage <?= $title; ?> Gallery </a>&nbsp;>&nbsp;
                    <span class="current"><?=$title; ?> Gallery History</span>  
                </div>
            <?php } else if ($_REQUEST['mid'] == '12' && !isset($_REQUEST['custom'])) { ?>
            
                <div class="breadcrumbs"><a href="index.php">&nbsp;&nbsp;Home </a>&nbsp;>&nbsp;&nbsp; <a href="index.php?module=<?php echo $_REQUEST['module'] ?>&mid=<?php echo $_REQUEST['mid'] ?>&id=<?php echo $_REQUEST['id'] ?>&type=<?php echo $_REQUEST['type'] ?>&back_url_string=<?php echo $_REQUEST['back_url_string'] ?>">Manage <?= $title; ?> Gallery </a> &nbsp;>&nbsp;<span class="current"><?= $title; ?> Gallery History</span> </div>
            
                     
                    <?php } else { ?>
                
                <div class="breadcrumbs">
                    <a href="index.php">&nbsp;&nbsp;Home </a>&nbsp;>&nbsp;&nbsp; 
                    <a href="index.php?module=<?php echo $objects->modulename($_REQUEST['mid']) ?>">
                    <?php echo 'Manage' . ' ' . ucfirst($objects->modulename_pro($_REQUEST['mid'])) ?> </a>&nbsp;>&nbsp;&nbsp; <a href="index.php?module=<?php echo $_REQUEST['module'] ?>&mid=<?php echo $_REQUEST['mid'] ?>&id=<?php echo $_REQUEST['id'] ?>&type=<?php echo $_REQUEST['type'] ?>&back_url_string=<?php echo $_REQUEST['back_url_string'] ?>">Manage <?= $title; ?> Gallery </a> &nbsp;>&nbsp;<span class="current"><?= $title; ?> Gallery History</span> </div>
                    <?php } ?>
                <?php } else if ($_REQUEST['module'] == "custom" && $_REQUEST['view'] == "module") { 
                    if($_REQUEST['pageid']!='' && !isset($_REQUEST['pageid'])) { ?>
            <div class="breadcrumbs"><a href="index.php">&nbsp;Home</a>&nbsp;>&nbsp;<a href="index.php?module=<?php echo $_REQUEST['module'] ?>&view=<?php echo $_REQUEST['view'] ?>&pageid=<?php echo $_REQUEST['pageid'] ?>">Manage1 <?php echo $historyObj->modulename($_REQUEST['module']) ?> </a> &nbsp;>&nbsp;<span class="current"><?php echo $historyObj->modulename($_REQUEST['module']) ?> History</span> </div>
            
               
                
                <?php } else { 
                $modulenamecustom= $historyObj->Custom_modulename($_REQUEST['pageid']);
                ?>
            <div class="breadcrumbs"><a href="index.php">&nbsp;Home</a>&nbsp;>&nbsp;<a href="index.php?module=<?php echo $_REQUEST['module'] ?>&view=<?php echo $_REQUEST['view'] ?>&pageid=<?php echo $_REQUEST['pageid'] ?>">Manage1 <?php echo $modulenamecustom; ?> </a> &nbsp;>&nbsp;<span class="current"><?php echo $modulenamecustom; ?> History</span> </div>
        <?php } }  else if ($_REQUEST['module'] == 'teamcategory') { ?>
            
                <div class="breadcrumbs"><a href="index.php">&nbsp;Home </a>>&nbsp;<a href="index.php?module=<?php echo $_REQUEST['module'] ?>&mid=<?php echo $_REQUEST['mid'] ?>&id=<?php echo $_REQUEST['id'] ?>&type=<?php echo $_REQUEST['type'] ?>&back_url_string=<?php echo $_REQUEST['back_url_string'] ?>">Manage Designations / Departments </a> &nbsp;>&nbsp;<span class="current">Designation / Department History</span> </div>
          
                 <?php
        } else { 
            if($_REQUEST['module']=="advertisebanners"){
                $module = "Advertise";
                $module1 = "Advertises";
            }
            else{
                $module = $historyObj->modulename($_REQUEST['module']);
                $module1 = $historyObj->modulename($_REQUEST['module']);
            }
            
            
            ?>
            <div class="breadcrumbs"><a href="index.php">&nbsp;Home</a>&nbsp;>&nbsp;<a href="index.php?module=<?php echo $_REQUEST['module'] ?>&id=<?php echo $_REQUEST['id'] ?>&view=<?= $view ?>&mid=<?php echo $_REQUEST['mid'] ?>&type=<?php echo $_REQUEST['type'] ?>">Manage <?php echo $module1 ?> </a> &nbsp;>&nbsp;<span class="current"><?php echo $module ?> History</span> </div>
        <?php } ?>
        
            
            
        <div class="clear"></div>
        <?=$messagebox; ?>
        <?=$headerpanel; ?>
        <!-- IsAjax completed -->
    <?php } ?>
    <div  id="gridbody">
        <?= $pagingTop; ?>
        <?php
        $date_news = DEFAULT_DATEFORMAT;
        if ($date_news == "%d/%m/%Y") {
            $date_news1 = "d/m/Y H:i:s";
        }
        if ($date_news == "%m/%d/%Y") {
            $date_news1 = "m/d/Y H:i:s";
        }
        if ($date_news == "%Y/%m/%d") {
            $date_news1 = "Y/m/d H:i:s";
        }
        if ($date_news == "%Y/%d/%m") {
            $date_news1 = "Y/d/m H:i:s";
        }
        ?>
        <br class="clear" />
        <div class="grid-list-subtitle-bg" style="margin-top:10px;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="2%" align="left" valign="middle" 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="39%" align="left" valign="middle" class="grid-td-top">
                        <a href="javascript:;" onclick="SendGridBindRequest('<?= $historyObj->urlwithoutsort ?>&orderby=<?= $fieldlist[$searchfield['0']] ?>&sorting=Y&view=<?= $_REQUEST['view'] ?>','gridbody','ST')">
                          <? //echo $fieldlist[$searchfield['0']] ?>
                            <?= $searchfield['0'] ?>
                            <?= ${"setsortimg" . $fieldlist[$searchfield['0']]} ?>
                        </a>
                    </td>
                    <td width="10%" align="left" valign="middle" class="grid-td-top">
                        <a href="javascript:;" onclick="SendGridBindRequest('<?= $historyObj->urlwithoutsort ?>&orderby=<?= $fieldlist[$searchfield['1']] ?>&sorting=Y&view=<?= $_REQUEST['view'] ?>','gridbody','ST')">
                            <?= $searchfield['1'] ?>
                            <?= ${"setsortimg" . $fieldlist[$searchfield['1']]} ?>
                        </a>
                    </td>
                    <td width="9%" align="left" valign="middle" class="grid-td-top">
                        <a href="javascript:;" onclick="SendGridBindRequest('<?= $historyObj->urlwithoutsort ?>&orderby=<?= $fieldlist[$searchfield['2']] ?>&sorting=Y&view=<?= $_REQUEST['view'] ?>','gridbody','ST')">
                            <?= $searchfield['2'] ?>
                            <?= ${"setsortimg" . $fieldlist[$searchfield['2']]} ?>
                        </a>
                    </td>
                    <td width="6%" align="left" valign="middle" class="grid-td-top">
                        <a href="javascript:;" onclick="SendGridBindRequest('<?= $historyObj->urlwithoutsort ?>&orderby=action&sorting=Y&view=<?= $_REQUEST['view'] ?>','gridbody','ST')">Action</a>
                        <?= $searchfield['3'] ?>
                        <?= ${"setsortimg" . "action"} ?>
                    </td>
                    <td width="14%" align="left" valign="middle" class="grid-td-top">
                        <a href="javascript:;" onclick="SendGridBindRequest('<?= $historyObj->urlwithoutsort ?>&orderby=actiondate&sorting=Y&view=<?= $_REQUEST['view'] ?>','gridbody','ST')">Action Date</a>
                        <?= $searchfield['4'] ?>
                        <?= ${"setsortimg" . 'actiondate'} ?>
                    </td>
                    <?php
                    if ($historyObj->configObj->glSessionObj->value('admin_id') == '1' || $historyObj->configObj->glSessionObj->value('admin_id') == '2') {
                        ?>
                        <td width="15%" align="left" valign="middle" class="grid-td-top">
                            <a href="javascript:;" onclick="SendGridBindRequest('<?= $historyObj->urlwithoutsort ?>&orderby=user_id&sorting=Y&view=<?= $_REQUEST['view'] ?>','gridbody','ST')">Update By </a>
                            <?= $searchfield['5'] ?>
                            <?= ${"setsortimg" . 'user_id'} ?>
                        </td>
                        <?php
                    }
                    ?>
       <!-- <td width="5%" align="left" valign="middle" class="grid-td-top"><a href="#">Status</a></td>-->
                </tr>
            </table>
        </div>
        <div class="information-white-bg" id="dvpersonalinformation" >
            <div class="clear"></div>
            <div class="grid-list-inner-table-text">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <?php
                    if ($historyObj->numofrows > 0) {
                        $rowcount = 0;
                        foreach ($resultArray as $i => $result) {
                            $clsname = ($result['chr_read'] == 'N') ? "grid-list-inner-table-text-active-history" : "grid-list-inner-table-text-history";
                            $starimg = ($row['chr_star'] == 'Y') ? "gstar.png" : "gstar-disable.png"; // Displaying the stat and unstart image

                            $tickimg = ($result['chr_publish'] == 'Y') ? "tick.png" : "tick_cross.png"; // Displaying the stat and unstart image

                            if ($result['action'] == 'I')
                                $action = "Add";
                            else if ($result['action'] == 'U')
                                $action = "Update";
                            else if ($result['action'] == 'D')
                                $action = "Delete";

                            if ($result['chr_approve'] == 'Y')
                                $approve_imagename = '_tick.png';
                            else
                                $approve_imagename = '_tick_cross.png';

                            if ($result['chr_read'] == 'N')
                                $rowcolor = "#F6CEE3;";
                            else
                                $rowcolor = "transparent;";
                            ?>
                            <tr id="gtr-<?= $row['int_glcode'] ?>"  style="background-color: transparent;"  class="<?= $clsname ?>" onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'" >
                                <td width="2%" align="left" valign="middle" class="grid-td-left">
                                    <input name="chkgrow" id="chkgrow" type="checkbox" value="<?= $result['history_id'] ?>" /></td>

                                <td width="3%" align="center" valign="middle" class="grid-left1">&nbsp;</td>
                                <td width="39%" align="left" valign="middle" class="grid-td-top">
                                    <span>
                                        <a href="#" onclick="return hs.htmlExpand(this,{headingText:'History - Details',width:500,height:600})">
                                            <?= stripcslashes($result[$fieldlist[$searchfield['0']]]); ?>
                                        </a>
                                        <div class="highslide-maincontent">
                                            <table cellpadding="2" cellspacing="2">
                                                <?php
                                                foreach ($detailfieldlistdetails as $dkey => $dvalue) {
                                                    if ($dvalue != '') {
                                                        if ($dvalue == 'File') { ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <?php if($result[$dkey] != '') {?>
                                                                <td valign="top"><a href="download.php?f=../upimages/<?= $_REQUEST['module'] ?>/documents/<?= $result[$dkey] ?>&module=<?= $_REQUEST['module'] ?>">Download</a></td>
                                                                <?php } else { ?>
                                                                <td valign="top">N/A</td>
                                                                <?php } ?>
                                                            </tr>
                                                            <?php
                                                        } else if ($dvalue == 'Image') { ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <td valign="top">
                                                                <?php                                                                 
                                                                 if($_REQUEST['module']=='ourteam' || $_REQUEST['module']=='show' || $_REQUEST['module']=='advertisebanners' || $_REQUEST['module']=='news') { 
                                                                     if($result[$dkey] != '') { ?>
                                                                    <a onClick="return hs.expand(this);" href="../upimages/<?=$_REQUEST['module'] ?>/images/thumb_<?= $result[$dkey] ?>">View</a></td>
                                                                <?php } else { ?>
                                                                    N/A</td>
                                                                <?php } } else {
                                                                if($result[$dkey] != '') { ?>
                                                                    <a onClick="return hs.expand(this);" href="../upimages/<?=$_REQUEST['module'] ?>/images/main/<?= $result[$dkey] ?>">View</a></td>
                                                                <?php } else { ?>
                                                                    N/A</td>
`                                                               <?php } } ?>
                                                            </tr>		
                                                            <?php
                                                        } else if ($dvalue == 'Cropped Image' && $result[$dkey] != '') {
                                                            ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <td valign="top">
                                                                    <a onClick="return hs.expand(this);" href="modules/<?= $_REQUEST['module'] ?>/html/uploads/images/<?= $result[$dkey] ?>">View</a></td>
                                                            </tr>		
                                                            <?php
                                                        } else if ($dvalue == 'Start Date' && $result[$dkey] != '') {
                                                            if (DEFAULT_DATEFORMAT == '%d/%m/%Y') {
                                                                $startdate = date('d/m/Y', strtotime($result[$dkey]));
                                                            }
                                                            if (DEFAULT_DATEFORMAT == '%m/%d/%Y') {
                                                                $time = explode("/", $result[$dkey]);
                                                                krsort($time);
                                                                $startdate = implode("/", $time);
                                                            }
                                                            if (DEFAULT_DATEFORMAT == '%Y/%m/%d') {
                                                                $startdate = $result[$dkey];
                                                            }
                                                            if (DEFAULT_DATEFORMAT == '%Y/%d/%m') {
                                                                $time = explode("/", $result[$dkey]);
                                                                arsort($time);
                                                                $startdate = implode("/", $time);
                                                            }
                                                            ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <td valign="top"><? //=$startdate ?><?php echo $result[$dkey]; ?></td>
                                                            </tr>		
                                                            <?
                                                        } else if ($dvalue == 'End Date' && $result[$dkey] != '') {
                                                            if (DEFAULT_DATEFORMAT == '%d/%m/%Y') { //echo 'dfdf';
                                                                $dmy = date('d/m/Y', strtotime($result[$dkey]));
                                                            }
                                                            if (DEFAULT_DATEFORMAT == '%m/%d/%Y') {
                                                                $time = explode("/", $result[$dkey]);
                                                                krsort($time);
                                                                $dmy = implode("/", $time);
                                                                //$end_date = date('m/d/Y',strtotime($result[$dkey]));
                                                            }
                                                            if (DEFAULT_DATEFORMAT == '%Y/%m/%d') {
                                                                $dmy = $result[$dkey];
                                                            }
                                                            if (DEFAULT_DATEFORMAT == '%Y/%d/%m') {
                                                                $time = explode("/", $result[$dkey]);
                                                                arsort($time);
                                                                $dmy = implode("/", $time);
                                                            }
                                                            ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <td valign="top"><?
                                        if ($dmy == "00/00/0000" || $dmy == "0000/00/00") {
                                            echo 'N.A';
                                        } else {
                                            echo $dmy;
                                        }
                                        ?></td>
                                                            </tr>		
                                                            <?php
                                                        } else if ($dvalue == 'Video' && $result[$dkey] != '') {
                                                            ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <td valign="top">
                                                                    <?php
                                                                    $youtTudeid = $historyObj->configObj->glLibraryObj->getYTid($result[$dkey]);
                                                                    ?>
                                                                    <object width="300" height="225" type="application/x-shockwave-flash" data="http://www.youtube.com/v/<?= $youtTudeid ?>&amp;hl=nb_NO&amp;fs=1&amp;" id="hs-flash-id-3" style="visibility: visible;"><param name="allowfullscreen" value="true"><param name="wmode" value="transparent"></object>
                                                                </td>
                                                            </tr>		
                                                            <?php
                                                        } else {
                                                            ?>
                                                            <tr>
                                                                <td nowrap="nowrap" valign="top"><b><?= $dvalue ?></b></td>
                                                                <td valign="top"><?= stripcslashes($result[$dkey]); ?></td>
                                                            </tr>
                                                            <?php
                                                        }
                                                    }
                                                }
                                                ?>
                                            </table>
                                        </div></span>
                                </td>
                                <td nowrap="nowrap" width="10%" align="left" valign="middle" class="grid-td-top">
                                    <span><?= $result[$fieldlist[$searchfield['1']]] ?></span>
                                </td>
                                <td width="10%" align="left" valign="middle" class="grid-td-top">
                                    <span>
                                        <?php
                                        if ($result[$fieldlist[$searchfield['2']]] == '' && $fieldlist[$searchfield['2']] == 'dt_expiredate')
                                            echo "N/A";
                                        else
                                            echo $result[$fieldlist[$searchfield['2']]];
                                        ?>
                                    </span>
                                </td>
                                <td width="5%" align="left" valign="middle" class="grid-td-top">
                                    <span><?= $action ?></span></td>
        <?php $deleteddate = date($date_news1, strtotime($result['actiondate'])); ?>
                                <td width="15%" align="left" valign="middle" class="grid-td-top">
                                    <span><?= $deleteddate ?></span>
                                </td>
                                <?php
                                if ($historyObj->configObj->glSessionObj->value('admin_id') == '1' || $historyObj->configObj->glSessionObj->value('admin_id') == '2') {
                                    if (in_array($result['user_id'], array_keys($UserArray)))
                                        
                                        ?>
                                    <td width="15%" align="left" valign="middle" class="grid-td-top">
                                        <span>
                                    <?php echo $UserArray[$result['user_id']]; ?>
                                        </span>
                                    </td>
                                    <?php
                                }
                                ?>
                            </tr>
                            <?php
                            $rowcount++;
                        }
                    }
                    else {
                        ?>
                        <tr style="background-color: transparent;"  class="<?= $clsname ?>" onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'">
                            <td height="25" align="center" valign="middle" colspan="5" class="form_titles">No Records 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>
<?php if ($configObj->glSessionObj->value('group_id') == '1' || $configObj->glSessionObj->value('group_id') == '2') { ?>
<?php } ?>
        </div>
        <? } ?>
        <!-- gridbody div completed -->
    </div>

    <!-- frist div>-->
</div>