<?php
include_once("../include/main.inc.php");
include_once("../ajax_functions.php");
check_session('MyCpanel','index.php');

################ Paging Starts From Here ##################
@extract($_REQUEST);
$start = (intval($start)==0 or $start=="")?$start=0:$start;
$pagesize = intval($pagesize)==0?$pagesize=10:$pagesize;

$heading="Manage Members";
$record_type="Member";
$script_name="manage_members.php";
$table_name="member_tbl";

if ($_POST['action_register']=="save") {
	@extract($_POST);	
  //checkHTTPREFERER();
  $all_categories="";
  for ($i=0; $i<count($industryType); $i++) {
	  $catids=getCategoryHierarchy($industryType[$i]);
	  $all_categories.=$catids;
  }
  $all_categories=substr($all_categories,0,-1);
  $tmp=explode("^",$all_categories);
  asort($tmp);
  $tmp=array_unique($tmp);
  $all_categories=implode("^",$tmp);
  $allCategories="^".$all_categories."^";		
  
  if (count($industryType) > 1) {
	  $industryType1=implode("^",$industryType);
	  $industryType2="^".$industryType1."^";
  }
  else {
	  $industryType2="^".$industryType[0]."^";
  }
if($_FILES[companyLogo][name]!="") {

					$filenm1=SITE_DIR_PATH."/uploaded_files/company_logos/".$memberRes[companyLogo];
					if(file_exists($filenm1)) {
						unlink($filenm1);
					}
					$img_name="logo_".date("Y_m_d_H_i_s");
					$company_logo=upload_file($img_name,"companyLogo","uploaded_files/company_logos");
					updateTable("member_tbl"," companyLogo='$company_logo' where memberID='$memID'");					
				}

				if($_FILES[companyVideo][name]!="") {

					

					$filenm1=SITE_DIR_PATH."/uploaded_files/company_videos/".$memberRes[companyVideo];

					if(file_exists($filenm1)) {

						unlink($filenm1);

					}

					$folder="uploaded_files/company_videos";

					$company_video=upload_video("companyVideo",$folder);

					updateTable("member_tbl"," companyVideo='$company_video' where memberID='$memID'");					

				}

			$businessType[]=$_REQUEST['$businessType'];

			for ($x=0; $x < sizeof($_POST[businessType]); $x++){

				$arr=$_POST[businessType];

			}

			$businessType1=implode("^", $arr);

				IF($companyName!='') {

				updateTable("member_tbl"," companyName='$companyName', ownerName='$ownerName', ownershipType='$ownershipType', yoe='$yoe', mainMarket='$mainMarket', companySize='$companySize', annualTurnover='$annualTurnover', businessNature='$businessNature', businessType='$businessType1',  companyDescription='$companyDescription', offertosell='$companyDescription', offertobuy='$importDescription', aboutUs='$aboutDescription', website='$website', updDate=now() where memberID='$memID'");
}

IF($email!='') {

				updateTable("member_tbl"," email='$email', nameTitle='$nameTitle', memberName='$memberName',address='$address', city='$city', state='$state', zipcode='$zipcode', country='$country', countryCodePhone='$countryCodePhone', areaCodePhone='$areaCodePhone', phone='$phone / $phone2', countryCodeFax='$countryCodeFax', areaCodeFax='$areaCodeFax', fax='$fax', mobileNo='$mobile', mobileNo2='$mobile2',alternateEmail='$alternateEmail', jobTitle='$jobTitle', updDate=now() where memberID='$memID'");
}
			

				$_SESSION[message]="Account Details Has Been Updated Successfully";
	
	adminheader_popup("Edit Member Details");
	echo "<br/><br/><center>Member Details has been updated successfully</center><br/><br/>";
	adminfooter_popup();
	exit;
}

if($id=="edit"){
	adminheader_popup("Edit Member Details");
	echo addEditMember($recordID);
	adminfooter_popup();
	exit;
}

if($id=="setpremium"){
	adminheader_popup("Set Preminum Member");
	echo addEditMember($recordID);
	adminfooter_popup();
	exit;
}

if($id=="contact"){
	adminheader_popup("Edit Contact Details");
	echo addEditcontacts($recordID);
	adminfooter_popup();
	exit;
}

if($id=="View"){
	adminheader_popup("View Member Details");
	echo view_member_details($recordID);
	adminfooter_popup();
	exit;
}

if($_POST[action]=="Delete"){
	if(sizeof($_POST[cid])==0) {
		$_SESSION[session_message]='Please select a record first.';
		header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize);
		exit;
	}
	for ($x=0; $x < sizeof($_POST[cid]); $x++){
		$dataRes=$_POST[cid];
		updateTable($table_name," status='D', premiumMember='N' where memberID='$dataRes[$x]'");		
	}
	$_SESSION[session_message]='Record has been deleted from the admin panel.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize);
	exit;
}

if($_POST[action]=="Activate"){
	
}

if($_POST[action]=="Deactivate"){
	if(sizeof($_POST[cid])==0) {
		$_SESSION[session_message]='Please select a record first.';
		header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=$start&pagesize=$pagesize");
		exit;
	}
	for ($x=0; $x < sizeof($_POST[cid]); $x++){
		$dataRes=$_POST[cid];
		updateTable($table_name," status='N', premiumMember='N' where memberID='$dataRes[$x]'");
	}
	$_SESSION[session_message]='Selected record(s) deactivated successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize);
	exit;
}

if($id=="deactivate") {
	updateTable($table_name," status='N', premiumMember='N' where memberID='$recordID' and status='Y' ");	
	$_SESSION[session_message]=$record_type.' has been deactivated successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize);
	exit;
}

if($id=="activate") {
	updateTable($table_name," status='Y' where memberID='$recordID' and status='N' ");
	$_SESSION[session_message]=$record_type.' has been activated successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize);
	exit;
}

if ($id=="delete") {
	updateTable($table_name," status='D', premiumMember='N' where memberID='$recordID'");
	$_SESSION[session_message]=$record_type.' has been deleted successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize);
	exit;
}

if($id=="set_premium_member") {
	updateTable($table_name, " premiumMember='Y', status='Y' where memberID='".$recordID."'");
	$_SESSION['session_message']=$record_type.' has been set as premium member successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize."&status=".$status);
	exit;
}

if($id=="unset_premium_member") {
	updateTable($table_name," premiumMember='N' where memberID='".$recordID."'");
	$_SESSION['session_message']=$record_type.' has been unset as premium member successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize."&status=".$status);
	exit;	
}

if($id=="set_verified_member") {
	updateTable($table_name, " verifiedMember='Y', status='Y' where memberID='".$recordID."'");
	$_SESSION['session_message']=$record_type.' has been set as verified member successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize."&status=".$status);
	exit;
}

if($id=="unset_verified_member") {
	updateTable($table_name," verifiedMember='N' where memberID='".$recordID."'");
	$_SESSION['session_message']=$record_type.' has been unset as verified member successfully.';
	header("Location: ".SITE_ADMIN_URL."/".$script_name."?start=".$start."&pagesize=".$pagesize."&status=".$status);
	exit;	
}
admin_header();
?>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" valign="top">
 <tr>
	<td align="left" width="50%" class="myTitle"><?=$heading;?></td>
	<td align="right">
	 <form name="pg_form" action="<?=$PHP_SELF?>" method="post" style="margin:0px;padding:0px;">
	 <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" valign="top">
	  <tr>
	   <td align="right">Records Per Page:
	    <select name="pagesize" onchange="this.form.submit();">
	     <option value="0">Select</option>
	     <?php
	     foreach($_GLOBALS['pgsize_arr'] as $val) {
		     if(trim($pagesize)==trim($val)) {
			     echo '<option value="'.$val.'" selected>'.$val.'</option>';
		     }
		     else{
			     echo '<option value="'.$val.'">'.$val.'</option>';
		     }
	     }
	     ?>
	    </select>
	    <input type="hidden" name="keyword" value="<?=$keyword;?>" />
	    <input type="hidden" name="status" value="<?=$status;?>" />
		 </td>
		</tr>
	 </table>
	 </form>
	</td>
 </tr>
</table>
<hr size="2" width="99%" color="#DA251C">

<?php
/*
if ($premiumMember!="") {
	if ($premiumMember=="Y") {
		updateTable($table_name," status='Y', premiumMember='$premiumMember' where memberID='$recordID'");
	}
	else {
		updateTable($table_name," premiumMember='$premiumMember' where memberID='$recordID'");
	}
}
*/

if ($status!="") {
	$cond="where status='$status'";
	$link="&status=$status";
}
else {
	$cond="where 1";
}
$qry1="select * from $table_name $cond";
$keyword=trim($keyword);
if($keyword!=""){
  $qry1.=" and (email LIKE '%$keyword%' or memberName LIKE '%$keyword%' or companyName LIKE '%$keyword%' )"; 
}

if($_REQUEST[sortName]!=''){
	$qry1 .= " order by $_REQUEST[sortName] $_REQUEST[sortBy]";
}
else {
	$qry1 .= " order by memberID desc";
}

$reccnt = NumRows(db_query($qry1));
$qry1.=" limit $start, $pagesize";
#echo $qry1;
$qry= db_query($qry1);
echo pageNavigation($reccnt,$pagesize,$start,$link);
print_message(); 
?>

<table width="100%"  border="0" cellpadding="6" cellspacing="2" class="lightBorder">
 <tr>
  <td class="lightGrayBg" align="left"><b>Search Members</b><br>
  <form name="search2" method="POST" action="">
   Keyword: <input name="keyword" type="text" class="input" size="25" value="<?=$keyword;?>">
   <input type="hidden"  class="button" name="id" value="Search2">
   <input type="submit"  class="button" name="search" value="Search">	
  </form>
  </td>
  <td class="lightGrayBg">
  <b>Sort Members<b><br>
  <form name="search3" method="POST" action="">
   <select name="sortName" size=1>
    <option value=''>--------Select---------</option>
    <option value='recvDate' <?php if($sortName=="recvDate"){ echo "selected";}?>>Join Date</option>
    <option value='memberName' <?php if($sortName=="memberName"){ echo "selected";}?>>Member Name</option>
    <option value='email' <?php if($sortName=="email"){ echo "selected";}?>>Member Email</option>
   </select>
   <select name="sortBy">
    <option value=''>-----Sort By-----</option>
    <option value="asc" <?php if($sortBy=="asc"){ echo "selected";}?>>Ascending</option>
    <option value="desc" <?php if($sortBy=="desc"){ echo "selected";}?>>Descending</option>
   </select>
   <input type="hidden"  class="button" name="id" value="Search3">
   <input type="submit"  class="button" name="search" value="Sort">
  </form>
  </td>
  <td class="lightGrayBg">
   <b>Select Status</b><br/>
   <form name="sts_form" action="<?=$PHP_SELF?>" method="post" style="margin:0px;padding:0px;">
	 <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" valign="top">
	  <tr>
	   <td align="left">
	    <select name="status" onchange="this.form.submit();">
	     <option value="">All Members</option>
	     <option value="Y" <?php if($status=="Y"){ echo "selected";}?>>Active</option>
	     <option value="N" <?php if($status=="N"){ echo "selected";}?>>InActive</option>
	     <option value="D" <?php if($status=="D"){ echo "selected";}?>>Deleted</option>
	    </select>
	    <input type="hidden" name="keyword" value="<?=$keyword;?>" />
	    <input type="hidden" name="pagesize" value="<?=$pagesize;?>" />
		 </td>
		</tr>
	 </table>
	 </form>
	</td> 
 </tr>
</table><br />

<?php
if($reccnt>0){
	?>
	<form name="formn" action="" method="POST">
	<input type="hidden" name="recordID" value="" />
	<input type="hidden" name="premiumMember" value="" />
	<table width="99%" border="0" cellpadding="2" cellspacing="2" class="lightBorder">
	 <tr height="25" bgcolor="#EAEAEA">
	  <td width="3%"><input type="checkbox" name="chk" onclick="CheckAll()" class="NoStyle"></td>
	  <td width="30%"><b>Member Details</b></td>
	  <td width=20%><b>Address Details</td>
	  <td width=14%><b>Membership Type</td>
	  <td width=10% align="center"><b>Join Date</b></td>
	  <td width=8% align="center"><b>Status</b></td>
	  <td width=15%><b>Options</b></td>
	 </tr>
	 <?php
	 $sl=$start+1;
	 while ($dataRes=mysql_fetch_array($qry)) {
		 $dataRes=ms_htmlentities_decode($dataRes);
		 if($sl%2!=0){
			 $color="#ffffff";
		 }
		 else {
			 $color="#f6f6f6";
		 }
		 if ($dataRes[expiryDate]!="0000-00-00") {
			 $expiryDate=$dataRes[expiryDate];
		 }
		 else {
			 $expiryDate="";
		 }
		 
		 $video_link="";
		 if($dataRes['companyVideo']!="") {
			 $video_link='&nbsp;<a onClick="window.open(\''.SITE_URL_PATH.'/view_video.php?video_name='.$dataRes['companyVideo'].'\',\'royale\', \'toolbar=no,width=450,height=340,left=275,top=225, screenX=250,screenY=150,status=no,scrollbars=no, resizable=no,\');return false" href="javascript:void(0);"><img src="'.SITE_URL_PATH.'/images/video-icon.gif" alt="View Video" border="0" /></a>';
		 }
		 ?>
		 <tr bgcolor="<?=$color;?>">
		  <td class="<?=$class?>" valign="top"><input type=checkbox name="cid[]" value="<?=$dataRes[memberID]?>" class="NoStyle"></td>
		  <td class="<?=$class?>" valign="top">
		   <b><?=$dataRes[nameTitle];?> <?=$dataRes[memberName];?></b>
		   <?php
		   if($dataRes[email]!=""){
			   ?>
			   <br /><b>Email</b>: <?=$dataRes[email];?>
			   <br /><b>Password</b>: <?php echo $dataRes[pwd];			   
		   }		   
		   ?>
		   <br/><b>Company Name</b>: <?php echo ucwords($dataRes[companyName]);?>
			 <br/><b>Job Title</b>: <?php echo ucwords($dataRes[jobTitle]);?>
			 <br/><b>Business Type</b>: <?php echo getBusinessType($dataRes[businessType]);?>
			 <br/><b>Business Nature</b>: <?php echo getBusinessNature($dataRes[businessNature]);
			 if ($dataRes['addedBy'] != "") {
				 ?>
				 <br/><b>Added By</b>: <?php echo getAdminStaffName($dataRes['addedBy']);
			 }
			 ?>
			 <!-- <br/><b>Establish Year</b>: <?php echo $dataRes[yoe];?> !-->
		  </td>
      <td valign='top' class="<?=$class?>">
			 <b>Address</b>: <?php echo ucwords($dataRes[address]);	 
			 if($dataRes[city]!=""){
				 ?>
				 <br /><b>City</b>: <?php echo ucwords($dataRes[city]);
			 }
			 if($dataRes[state]!=""){
				 ?>
				 <br /><b>State</b>: <?php echo ucwords($dataRes[state]);
			 }			 
			 if($dataRes[country]!="") {
				 ?>
				 <br /><b>Country</b>: <?php echo $dataRes[country];
			 }
			 if($dataRes[zipcode]!=""){
				 ?>
				 <br /><b>Zipcode</b>: <?php echo $dataRes[zipcode];				 
			 }
			 if($dataRes[mobileNo]!=""){
				 ?>
				 <br /><b>Mobile No</b>: <?php echo $dataRes[mobileNo];				 
			 }
			 if($dataRes[phone]!=""){
				 ?>
				 <br /><b>Phone</b>: <?php echo $dataRes[countryCodePhone]."-".$dataRes[phone];
			 }
			 if($dataRes[fax]!="") {
				 ?>
				 <br /><b>Fax</b>: <?php echo $dataRes[countryCodeFax]."-".$dataRes[fax];
			 }
			 ?>			 
           </td>
			<td valign='top' class="<?=$class?>">
			 <strong><?php echo getMembershipPlanName($dataRes[membershipType]);?></strong>
			 <?php
			 if ($expiryDate) {
				 ?>
				 <br/><br/><i>Activation Date</i>:<br/><strong><?=show_date($dataRes[activationDate])?></strong><br/><br/><i>Expiry Date</i>:<br/><strong><?=show_date($dataRes[expiryDate])?></strong>
				 <?php
			 }
			 ?>
			</td>
			<td class="<?=$class?>" valign='top' align="center"><?=show_date($dataRes[recvDate])?></td>
			<td valign='top' align="center">
		   <?php
		   if($dataRes[status]=='Y') {
			   ?>
			   <strong>Active</strong>
			   <?php
		   }
		   else if($dataRes[status]=='D') {
			   ?>
			   <strong>Deleted</strong>
			   <?php
		   }
		   else {
			   ?>
			   <strong>Inactive</strong>
			   <?php
		   }
		   if ($video_link != "") {
			   ?>
			   <br/><br/>
			   <?php
			   echo $video_link;
		   }
		   ?>		   
		  </td>
			<td class="<?=$class?>" valign='top'>
			 <?php
		   if($dataRes[status]=='Y') {
			   ?>
			   &nbsp;<a href="<?=SITE_ADMIN_URL?>/<?=$script_name;?>?id=deactivate&recordID=<?=$dataRes[memberID];?>&start=<?=$start;?>&pagesize=<?=$pagesize?>"><img src="<?=SITE_ADMIN_URL?>/images/active.gif" alt="Deactivate This <?=$record_type;?>" title="Deactivate This <?=$record_type;?>" border="0"></a>
			   <?php
		   }
		   if($dataRes[status]=='N') {
			   ?>
			   &nbsp;<a href="<?=SITE_ADMIN_URL?>/<?=$script_name;?>?id=activate&recordID=<?=$dataRes[memberID];?>&start=<?=$start;?>&pagesize=<?=$pagesize?>"><img src="<?=SITE_ADMIN_URL?>/images/deactive.gif" alt="Activate This <?=$record_type;?>" title="Activate This <?=$record_type;?>" border="0"></a>
			   <?php
		   }
		   ?>
		   &nbsp;<a href="javascript:void(0);" onclick="window.open('<?=SITE_ADMIN_URL?>/<?=$script_name;?>?id=View&recordID=<?=$dataRes[memberID]?>&start=<?=$start?>&pagesize=<?=$pagesize?>','pop','height=550,width=550,scrollbars=yes,resizable=yes');"><img src="<?=SITE_ADMIN_URL?>/images/preview.gif" alt="View This <?=$record_type;?> Details" title="View This <?=$record_type;?> Details" border="0"></a>
			 &nbsp;<a  href="javascript:void(0);" onclick="javascript:window.open('<?=$script_name;?>?id=edit&recordID=<?=$dataRes[memberID];?>&offset=<?=$offset;?>&pageno=<?=$pageno;?>&status=<?=$status;?>#bot','popup','scrollbars=yes,width=700,height=500')"><img src="<?=SITE_ADMIN_URL?>/images/edit.gif" alt="Edit This <?=$record_type;?>" title="Edit Company Profile<?=$record_type;?>" border="0"></a>
			 &nbsp;<a  href="javascript:void(0);" onclick="javascript:window.open('<?=$script_name;?>?id=contact&recordID=<?=$dataRes[memberID];?>&offset=<?=$offset;?>&pageno=<?=$pageno;?>&status=<?=$status;?>#bot','popup','scrollbars=yes,width=700,height=500')"><img src="<?=SITE_ADMIN_URL?>/images/edit.gif" alt="Edit This <?=$record_type;?>" title="Edit Contact Details<?=$record_type;?>" border="0"></a>
			 <?php if($dataRes[status]!='D') { ?>
			 &nbsp;<a href="<?=$script_name;?>?id=delete&recordID=<?=$dataRes[memberID]?>&start=<?=$start?>&pagesize=<?=$pagesize?>" onClick="return confirm('Are you sure you want to delete this record')"><img src="<?=SITE_ADMIN_URL?>/images/cancel.gif" alt="Delete This <?=$record_type;?>" title="Delete This <?=$record_type;?>" border="0"></a>
			 <?php }
			 /*
			 if ($dataRes['membershipType'] < 3 && $dataRes['businessNature'] == 2) {
				 ?>
				 <br/><br/><br/><br/>
			   <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" valign="top">
			    <tr>
			     <td align="center">
			      <select name="premiumMember<?=$dataRes[memberID];?>" onchange="return submit_form1(this.value,'<?=$dataRes[memberID];?>');">
			       <option value="">Set Member As</option>
			       <option value="Y" <?php if($dataRes[premiumMember]=="Y"){ echo "selected";}?>>Premium</option>
			       <option value="N">Unset Premium</option>
			      </select>			      
			     </td>
			    </tr>
			   </table>			   
			   <?php
		   }
		   */
		   ?>
		  
		   <br/><br/><i><u>Verified Member</u></i><br/>
			 <?php
			 if($dataRes['verifiedMember'] == "N") {
				 ?>
				 <strong>No</strong>&nbsp;&rarr;&nbsp;<a href="<?=SITE_ADMIN_URL?>/<?=$script_name;?>?id=set_verified_member&start=<?=$start;?>&pagesize=<?=$pagesize;?>&recordID=<?=$dataRes['memberID'];?>&status=<?=$status;?>"><strong>Set</strong></a>
				 <?php
			 }
			 if($dataRes['verifiedMember'] == "Y") {
				 ?>
				 <strong>Yes</strong>&nbsp;&rarr;&nbsp;<a href="<?=SITE_ADMIN_URL?>/<?=$script_name;?>?id=unset_verified_member&start=<?=$start;?>&pagesize=<?=$pagesize;?>&recordID=<?=$dataRes['memberID'];?>&status=<?=$status;?>"><strong>Unset</strong></a>
				 <?php
			 }
			 ?>
			 <br/><br/><i><u>Premium Member</u></i><br/>
			 <?php
			 if($dataRes['premiumMember'] == "N") {
				 ?>
				 <strong>No</strong>&nbsp;&rarr;&nbsp;<a  href="javascript:void(0);" onclick="javascript:window.open('<?=SITE_ADMIN_URL?>/setpremium.php?recordID=<?=$dataRes[memberID];?>&offset=<?=$offset;?>&pageno=<?=$pageno;?>&status=<?=$status;?>#bot','popup','scrollbars=yes,width=700,height=500')"><strong>Set</strong></a>
				 <?php
			 }
			 else {
				 ?>
				 <strong>Yes</strong>&nbsp;&rarr;&nbsp;<a href="<?=SITE_ADMIN_URL?>/<?=$script_name;?>?id=unset_premium_member&start=<?=$start;?>&pagesize=<?=$pagesize;?>&recordID=<?=$dataRes['memberID'];?>&status=<?=$status;?>"><strong>Unset</strong></a><a  href="javascript:void(0);" onclick="javascript:window.open('<?=SITE_ADMIN_URL?>/setpremium.php?recordID=<?=$dataRes[memberID];?>&offset=<?=$offset;?>&pageno=<?=$pageno;?>&status=<?=$status;?>#bot','popup','scrollbars=yes,width=700,height=500')"><img src="<?=SITE_ADMIN_URL?>/images/edit.gif" alt="Edit" title="Edit Preminum Member" border="0"></a>
				 <?php
			 }
			 ?>
			</td>
		 </tr>
		 <?php
		 $sl++;
	 }
	 ?>
	 <tr bgcolor="EAEAEA">
	  <td colspan="7">
	   <?php
	   if($status=="Y"){
		   ?>
		   <input type="submit" name="action" value="Delete"  onclick="return chkdelete();" class="button">
		   <input type="submit" name="action" value="Deactivate"  onclick="return chkactivate();" class="button">
		   <?php
	   }
	   else if ($status=="N"){
		   ?>
		   <input type="submit" name="action" value="Delete"  onclick="return chkdelete();" class="button">
		   <input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button">
		   <?php
	   }
	   else if ($status=="D"){
		   ?>
		   <input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button">
		   <?php
	   }
	   else {
		   ?>
		   <input type="submit" name="action" value="Delete"  onclick="return chkdelete();" class="button">
		   <input type="submit" name="action" value="Deactivate"  onclick="return chkactivate();" class="button">
		   <input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button">
		   <?php
	   }
	   ?>
	   <input name="start" type="hidden" value="<?=$start?>" />
	   <input name="pagesize" type="hidden" value="<?=$pagesize?>" />
	   <input name="status" type="hidden" value="<?=$status?>" />
	  </td>
	 </tr>
	</table><br>
	</form>
	<?php
}
else{
	?>
	<table width="100%"  border="0" cellpadding="6" cellspacing="2" class="lightBorder">
	 <tr><td><br /><b>No Record Found.............</b><br /><br /></td></tr>
	</table>
	<?php
}
?>



<?php
admin_footer();	
exit;
?>