<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');
?>
<script type="text/javascript">
function chk_valid_date() {
	if (document.bannerFrm.validFrom.value==0) {
		alert("Please select Validity Period");
		return false;
	}
	if (document.bannerFrm.validTo.value==0) {
		alert("Please select Validity Period");
		return false;
	}
}
</script>
<?php
################ Paging Starts From Here ##################
@extract($_REQUEST);
$start = (intval($start)<0 or $start=="")?0:$start;
$pagesize = intval($pagesize)==0?$pagesize=20:$pagesize;

$heading="Manage Newletter";
$record_type="mail";
$script_name="manage_emails.php";
$table_name="mailer_list";
$table_name1="member_tbl";
####################################################
if($id=="member_record" ) {

		updateTable($table_name1," mail_status='N' where mail_status='Y'");
	
		
			header('Location: manage-mails-active.php');
			exit;
	}


admin_header("");
?>
<h3>Manage Newletter - Active</h3>
<table width="100%"  border="0" cellpadding="0" cellspacing="2">
 <tr>
  <td align="center"><input type="button" class="button" value="Add New Mailers" onclick="window.location.href='add-new-mail.php';"></td><br><br><br>
 </tr>
</table><br />
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" valign="top">

	 <form name="pg_form" action="<?=$PHP_SELF?>" method="post" style="margin:0px;padding:0px;">

	   <?

	$urlqry=mysql_query("select * from mailer_list where status='Y' ORDER BY mailer_id");

    while($urlres=mysql_fetch_array($urlqry)) {
$mailer_id=$urlres[mailer_id];

$mailer_country=$urlres[country]; 
$member_Type=$urlres[memberType];
$keyword=$urlres[keyword];
	?>
<tr  bgcolor="#f9f9f9">
	  <td align="left"></td>
	  <td align="left" class="">
	   <b><?=$urlres['mailer_title'];?> - <?=$urlres['mailer_id'];?></b>
	   	  </td>
	 
	  <td class="" align="left">
	  
                   <a href="add-new-mail.php?id=delete_record&mailer_id=<?=$mailer_id;?>" onClick="return confirm('Are you sure to delete this mailer...');"><img src="images/cancel.gif" alt="Delete This Mailer" title="Delete This Category" border="0"></a>

        <?
       
 $allsqlpro=NumRows(db_query("select mailID from mass_mail where status='N' and mailerID='$mailer_id'"));
   
      if( $allsqlpro!='') {
        ?>       
	   | <a href="add-new-mail.php?id=inprocess_record&mailer_id=<?=$mailer_id;?>">Transfer to Inprocess (<?=$allsqlpro;?>)</a> 
	   <?
   }
      else {
	   ?>
	   |
	   <a  href="javascript:void(0);" onclick="javascript:window.open('<?=SITE_ADMIN_URL?>/allocate_data_mail.php?mailer_id=<?=$mailer_id;?>','popup','scrollbars=yes,width=700,height=500')">Allocate Database</a>
	   
	   <?   
	      
      }

   ?>
	 <a onclick="window.open('view-email-details.php?mailer_id=<?=$mailer_id;?>','royale', 'toolbar=no,width=500, height=540, left=250, top=100, screenX=250, screenY=150, status=no, scrollbars=no, resizable=no,');return false" href="javascript:void(0);">View Details</a> 
  
	  </td>
	 </tr>
	 
	 <?
 }
	//header('Refresh: 0.1');      

?>

<table width="100%"  border="0" cellpadding="0" cellspacing="2">
 <tr><br><br><br>
  <td align="center"><input type="button" class="button" value="Add New Mailers" onclick="window.location.href='add-new-mail.php';"></td>
 </tr>
</table><br />
	   
</table>

<?php

admin_footer();	

exit;

?>
