<style type="text/css">
ul.pagination {
	font-family: "Arial", "Helvetica", sans-serif;
	font-size: 13px;
	height: 100%;
	list-style-type: none;
	margin: 20px 0;
	overflow: hidden;
	padding: 0;
}
ul.pagination li.details {
	background-color: white;
	border-color: #C8D5E0;
	border-image: none;
	border-style: solid;
	border-width: 1px 1px 2px;
	color: #1E598E;
	font-weight: bold;
	padding: 8px 10px;
	text-decoration: none;
}
ul.pagination li.dot {
	padding: 3px 0;
}
ul.pagination li {
	float: left;
	list-style-type: none;
	margin: 0 3px 0 0;
}
ul.pagination li:first-child {
	margin-left: 0;
}
ul.pagination li a {
	color: black;
	display: block;
	padding: 7px 10px;
	text-decoration: none;
}
ul.pagination li a img {
	border: medium none;
}
ul.pagination li a.current {
	background-color: white;
	border-radius: 0 0 0 0;
	color: #333333;
}
ul.pagination li a.current:hover {
	background-color: white;
}
ul.pagination li a:hover {
	background-color: #C8D5E0;
}
ul.pagination li a {
	background-color: #F6F6F6;
	border-color: #C8D5E0;
	border-image: none;
	border-style: solid;
	border-width: 1px 1px 2px;
	color: #1E598E;
	display: block;
	font-weight: bold;
	padding: 8px 10px;
	text-decoration: none;
}
</style>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<?php
if($_REQUEST['Delete'])
{

  for($i=0;$i<count($_REQUEST['leadid']);$i++)
  {
    $condition="id='".$_REQUEST['leadid'][$i]."'";
    $s->DeleteRecord('awd_member_assmnt_topic', $condition);
    //$condition="id='".$_REQUEST['leadid'][$i]."'";
    //$s->DeleteRecord('spare_part_kits', $condition);
  }
  //$s->pageLocation("index.php?route=HRModule/holidays");
}

function pagination($per_page=10, $page, $url = '', $total){    
        
        $adjacents = "1";
		if($page==1)
		{
        $records=$page*10;
		$startrecords=1;
		}
		else
		{
		$records=($page*10);
		$startrecords=(1+$records)-10;
		}
        $page = ($page == 0 ? 1 : $page); 
        $start = ($page - 1) * $per_page;                              
         
        $prev = $page - 1;                         
        $next = $page + 1;
	
         $lastpage = ceil($total/$per_page);
        $lpm1 = $lastpage - 1;
         
        $pagination = "";
        if($lastpage > 1)
        {  
            $pagination .= "<ul class='pagination'>";
                    $pagination .= "<li class='details'>Page $page of $lastpage</li>";
					 $pagination .= "<li class='details'>Showing Records of $startrecords to  $records from  $total</li>";
            if ($lastpage < 7 + ($adjacents * 2))
            {  
                for ($counter = 1; $counter <= $lastpage; $counter++)
                {
                    if ($counter == $page)
                         $pagination.= "<li><a class='current'>$counter</a></li>";
                    else
                         $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                }
            }
            elseif($lastpage > 5 + ($adjacents * 2))
            {
                if($page < 1 + ($adjacents * 2))    
                {
                    for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
                    {
					
                        if ($counter == $page)
                            $pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                    }
                    $pagination.= "<li class='dot'>...</li>";
                    $pagination.= "<li><a href='{$url}$lpm1'>$lpm1</a></li>";
                    $pagination.= "<li><a href='{$url}$lastpage'>$lastpage</a></li>";     
                }
                elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
                {
                    $pagination.= "<li><a href='{$url}1'>1</a></li>";
                    $pagination.= "<li><a href='{$url}2'>2</a></li>";
                    $pagination.= "<li class='dot'>...</li>";
                    for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
                    {
                        if ($counter == $page)
                            $pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                    }
                    $pagination.= "<li class='dot'>..</li>";
                    $pagination.= "<li><a href='{$url}$lpm1'>$lpm1</a></li>";
                    $pagination.= "<li><a href='{$url}$lastpage'>$lastpage</a></li>";     
                }
                else
                {
                    $pagination.= "<li><a href='{$url}1'>1</a></li>";
                    $pagination.= "<li><a href='{$url}2'>2</a></li>";
                    $pagination.= "<li class='dot'>..</li>";
                    for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
                    {
                        if ($counter == $page)
                            $pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                    }
                }
            }
             
            if ($page < $counter - 1){
                $pagination.= "<li><a href='{$url}$next'>Next</a></li>";
               // $pagination.= "<li><a href='{$url}$lastpage'>Last</a></li>";
            }else{
                //$pagination.= "<li><a class='current'>Next</a></li>";
               // $pagination.= "<li><a class='current'>Last</a></li>";
            }
            $pagination.= "</ul>\n";     
        }          
        return $pagination;
    } 	


  
	  if(!isset($_REQUEST['page']))
		{
		$page=10;
		$start=0;
		}
		 else
		 {
		 if($_REQUEST['page']==1)
		 {
	     $page =10;
		 $start =0;
		 }
		 else
		 {
		 $page=25;
	     $start =($_REQUEST['page']*10)-10;
		 }
		 }
		
		
	//$GetRecord1 = "Select * from $table where fin_year_id=".$_SESSION['financialYrId']." and assmnt_ctgries_id in (".$_SESSION['AssmntCategoryIds'].") order by id";

  $GetRecord1 = "Select * from $table  order by id";
   $ResultData1 = DB_query($GetRecord1,$db);
   $total_pages1= DB_num_rows($ResultData1);
	
  
$pagination .= "<div class='pagination'>";
if ($page > 1)
{
if($page<=$total_pages1)
$pagination.= "<a href='".$path."'> Next</a>";

}
?>
<TR>
<td colspan="4"><?php 
  $page1=ceil($total_pages1/2);	
if(isset($_GET['page']) && $_GET['page']!=''){
	$page1=$_GET['page'];
}	
else
{
$page1=1;
}
//echo pagination(10,$page1,'index.php?route=Award/Master/assessmt_cat_master&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].'&page=',$total_pages1); ?></td></TR>
	</table>  
<form method="post" action="" name="myform">
  <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; border-collapse:collapse;">
   <tr><td style="border:none"></td>
   <td style="border:none"> <?php if($_SESSION['frmDelete']=='1'){?>&nbsp;<input type="submit" name="Delete" value="Delete" class="search" onClick="return confirm('Are you sure you want to delete this Item record?');" /><?php } ?>
</td>
   </tr>
   <tr>
    <td width="2%"><input type="checkbox" id="selecctall"/></td>
   	<td width="4%">S. No.</td>
    <!--<th>Category</th>-->
    <td>Assessment Area</td>
    <td width="15%">Employee Type</td>
	  <td width="20%">Created By</td>
    <td width="7%">Created Date</td>
	  <td width="5%" style="text-align:center;">Edit</td>
    <!--<td width="5%" style="text-align:center;">Delete</td>-->
   </tr>
   <?php 
   $i=1;
  // $GetRecord = "Select * from $table  order by id limit ".$start." ,".$page."  ";
  // $GetRecord = "Select * from $table where fin_year_id=".$_SESSION['financialYrId']." and assmnt_ctgries_id in (".$_SESSION['AssmntCategoryIds'].") order by id";

   $GetRecord = "Select * from $table order by id";

   $ResultData = DB_query($GetRecord,$db);
   if(DB_num_rows($ResultData)==0)
   echo "<td colspan='4'>--No Record--</td>";
   
   while($RowData = DB_fetch_array($ResultData))
   {?>
 <tr bgcolor="#FFFFFF"> 
 <td><input name="leadid[]" type="checkbox" class="checkbox1" id="leadid_<?php echo $i+1; ?>" value="<?php echo $RowData['id']?>" /></td>
  <td><?php echo $i;?></td>
 <!-- <td><?php echo $s->GetFieldValue("awd_member_assmnt_ctgries","id='".$RowData['assmnt_ctgries_id']."'","name");?></td>-->
  <td><?php echo $s->GetFieldValue("awd_member_assmnt_area_dtls","id='".$RowData['assmnt_area_dtls_id']."'","area_name");?></td>
  <td><?php echo $RowData['emp_type'];?></td>
  <td><?php echo $s->GetFieldValue("www_users","id='".$RowData['Created_by']."'","realname");?> </td>	 
  <td><?php echo ConvertSQLDate($RowData['Created_date']);?></td>	   
  <td style="text-align:center;"><?php //if($_SESSION['frmEdit']=='1'){?><a href="index.php?route=HRModule/Master/assessmt_subcat_topic&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid']?>&action=Edit&id=<?php echo $RowData['id']; ?>"><img src="images/icon-edit.png" height="15" width="15" title="Edit Document" /></a><?php //}else{echo "No Permission";}?></td>
	<!--<td style="text-align:center;"><?php if($_SESSION['frmDelete']=='1'){?><a href="index.php?route=HRModule/Master/assessmt_subcat_topic&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid']?>&action=del&id=<?php echo $RowData['id']; ?>" onclick="return confirm('Do You Want To Delete This Record')"><img src='images/Icon_Delete.png' width="15" height="15" title="Delete Document" /></a><?php }else{ ?><img src='images/Icon_Delete.png' width="15" height="15" title="No Permission to Delete Document" style="opacity:0.5;" /><?php }?></td>	
  --></tr>
	<?php $i++;}?>  
   </table>

</form>
 <script type="text/javascript">
  function LeadData()
{ 
  myCheckboxArray = document.myform.elements["leadid[]"];
  var t=myCheckboxArray.length;
  //alert(myCheckboxArray);
  if(document.getElementById('leadid').checked==true)
  { 
  if(t==undefined)
  document.getElementById('leadid_'+1).checked=true;    
  for (var i = 1; i <= t; i++)
  {
  document.getElementById('leadid_'+i).checked=true;  
  } 
  }
  else
  {
  if(t==undefined)    
  document.getElementById('leadid_'+1).checked=false;   
  for (var i = 1; i <= t; i++)
  {
  document.getElementById('leadid_'+i).checked=false; 
  }
  }
}
$(document).ready(function() {
    $('#selecctall').click(function(event) {  //on click
        if(this.checked) { // check select status
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = true;  //select all checkboxes with class "checkbox1"              
            });
        }else{
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = false; //deselect all checkboxes with class "checkbox1"                      
            });        
        }
    });
   
});
</script>