<?php session_start();  //Developed by ITechScripts
require 'include/configurations.php'; // ITECHBIDS Configuration File
$cat_id=$_GET['id'];
$mode=$_GET['mode'];
?>
<html>
<body>
><?php
require 'include/header.php';
?>
<p>&nbsp;</p>
<table width="80%" border="0" cellpadding="5" cellspacing="1" class="ft" align="center">
<form name="country" method="post" action="addcountry.php">
         <tr  class="ct">
        <td width="25%"><div align="center"><span height="25"><b>Country</b> </span></div></td>
		
        <td width="27%"><div align="center"><span height="25"><b>Edit</b></span></div></td>
        <td width="22%" height="25"><div align="center"><b>Delete</b></div></td>
		</tr>
<?
if($mode=='delete')
{
$sql1="delete from site_countries where country_id='$cat_id'";
$del=mysql_query($sql1);
if($del)
$message="Country Deleted Sucessfully";
else
$message="Country not deleted";
}
$mode='';
 if(!empty($message))
{
echo "<font size=3 color=red><tr><td align=center>$messages</td></tr></font>";
}
if($mode=='edit')
{
}
$sql="select * from site_countries order by country_id desc";
$res=mysql_query($sql);
$row=mysql_fetch_array($res);
//print_r($row);
$countryid=$row['country_id'];
?><?php
	$total_records=mysql_num_rows($res);
	$curpage=$_GET['curpage'];
	if(strlen($_GET['curpage']) == 0) $curpage=1;
	$start=($curpage-1) * 10;
	$end=10;
	if($curpage==''|| $curpage==1)
	$i=1;
	else $i=$_GET['sno']+1;
	$sql.=" limit $start,$end";
	$res=mysql_query($sql);
 ?>


        <tr> 
          <td align="right" colspan="5"> 
            <?php
	     if($curpage!=1) 
	     {
         ?>
            <a href="country.php?mode=<?=$mode; ?>&curpage=<?=($curpage-1);?>" id="link2">Prev</a> 
            | 
            <?php
            }
           ?>
            <?php
           if($total_records > ($start + $end)) 
		   {
           ?>
            <a href="country.php?mode=<?=$mode; ?>&curpage=<?=($curpage+1);?>" id="link2">Next</a> 
            <?php
            }
            ?>
          </td>
        </tr>

        <?php
         while($row=mysql_fetch_array($res))
        {
        ?>		
	   <tr >
       	   <td height="41" align="center"><?= $row['country'];?></td>
	   	   <td><div align="center" class="style3">
	    <a href="addcountry.php?id=<?=$row['country_id']; ?>&mode=edit" style="text-decoration:none" id="link1">Edit</a></div></td>
	   <td><div align="center" class="style3">
	   <a href="country.php?id=<?=$row['country_id']; ?>&mode=delete"  id="link1" style="text-decoration:none" onClick="javascript:return condelete();">Delete</a></div></td>
	   </tr>
	   <?
         }
       ?>	
	<tr>
    <tr><td>

</td></tr>
	<td  align="center" colspan="3">
	
	<input type="submit" class="button"   name="add" value="Add" ></div>
	</td>
	
  </form>
  

<?
	require 'include/footer.php';
?>
</td>
	</tr>
</table>
</body></html>
<script language="JavaScript">
function condelete()
{
var confrm;
confrm=window.confirm("Are You sure you want to delete this country");
return confrm;
}
function itechitems_11()
{
document.country.action="change_display_order.php";
document.country.submit();
}

</script>