<?
session_start();
$selelag = $HTTP_SESSION_VARS["SelLanguage"];
if (empty($selelag)) header("location:../break.php");
require("../config/".$selelag);
require("../_ConnectString.php");       //--連接參數設定值
require("../_function.php");
require("../_image.php");
require("../_search/_mail_search.php");
require("../_search/_datamining.php");
require("../_read_source/_reject.php");
require("../_read_source/_attachment.php");
require_once("../cd_pos.php");

$_SearchPath = "../_search/mail_search_list.php";
$_DELETE_DIGITAL_PATH = "../remove/";
$Host_ip = $HTTP_SERVER_VARS["HTTP_HOST"];

if ((isset($HTTP_SESSION_VARS["LoginID_Sess"])) && (isset($HTTP_SESSION_VARS["OperateRole_Sess"])) && (isset($HTTP_SESSION_VARS["GroupNo_Sess"]))){
	$strSQL="Select 0 from IMAP";
	$Result=mysql_query($strSQL);
	if(!$Result){
		print "<html><title></title><head>";
		print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
		print "<center><b><font size=\"10\" color=\"red\"><span title=\"".$L_BREAK."\">Your ISO image version  is old,<BR>there is no IMAP data!</span></font></b></center>";
		print "</head></html>";
		exit();
	}
	$QUERY_IP					= $HTTP_POST_VARS["QUERY_IP"];
	$QUERY_IP_1					= $HTTP_POST_VARS["QUERY_IP_1"];
	$QUERY_START_DATETIME		= $HTTP_POST_VARS["QUERY_START_DATETIME"];  
	$QUERY_END_DATETIME			= $HTTP_POST_VARS["QUERY_END_DATETIME"];
	$QUERY_SUBJECT				= $HTTP_POST_VARS["QUERY_SUBJECT"];  
	$QUERY_FROM					= $HTTP_POST_VARS["QUERY_FROM"];  
	$QUERY_TO					= $HTTP_POST_VARS["QUERY_TO"];  
	$QUERY_CC					= $HTTP_POST_VARS["QUERY_CC"]; 
	$QUERY_ID					= $HTTP_POST_VARS["QUERY_ID"];     //--資料庫流水號
	$QUERY_ACCOUNT				= $HTTP_POST_VARS["QUERY_ACCOUNT"];     //--資料庫流水號

	$sizepage					= $HTTP_POST_VARS["sizepage"];      //--每頁筆數
	$DELIGNORE					= $HTTP_POST_VARS["DELIGNORE"];		//--忽略並刪除
	$RunAs						= $HTTP_POST_VARS["RunAs"];			//--刪除 或 忽略
	$Checked					= $HTTP_POST_VARS["Checked"];
	$SortField					= $HTTP_POST_VARS["SortField"];     //--排序欄位
	$SortType					= $HTTP_POST_VARS["SortType"];      //--排序方式

	$strWhere					= $HTTP_POST_VARS["strWhere"];		//--search all
	$IMAP						= $HTTP_POST_VARS['IMAP'];			//--全文檢索 -auto 值
	$mime						= $HTTP_POST_VARS['mime'];			//--全文檢索 flag
	$digital					= $HTTP_POST_VARS['digital'];	    //--數位資產 flag
    $to_page					= $HTTP_POST_VARS['to_page']; 

	//相關變數初始化 
	if (!isset($to_page) || empty($to_page)){
		$to_page = 1;
	}//End : if (相關變數初始化)
	if (!isset($sizepage) || empty($sizepage)){
		$sizepage = $HTTP_SESSION_VARS["size_page"];
	}

	$ErrorMsg = "";
	$_Disabled = "";
	//$bgcolorCol = "bgcolor=\"#A0C6E5\"";
	//--畫面設定排序時使用
	if ($SortField == "") $SortField="_AUTO";
	include($_SORT_PATH);

	//判斷每頁秀的資料筆數
	if ($RunAs == 'UpdatePageSize'){
		if ($sizepage){ 
			$HTTP_SESSION_VARS["size_page"] = $sizepage;
		}//End : if()
	}//End : if(判斷每頁秀的資料筆數)	

	
	//--刪除資料
	if($RunAs == "Delete"){
		$_FILE = "IMAP_".date("Y-m-d")."_".date("H:i:s");
		$TMP_FILE = "/tmp/".$_FILE;
		if ((fn_digital_asset()==1)||(fn_data_mining()==1)) $fp = fopen($TMP_FILE,"w+");
		if ($DELIGNORE == "") $flag = 0;
		for($i=0; $i<count($chkbox); $i++){
			$strSQL = "Select * from IMAP where _AUTO ='".$chkbox[$i]."'";
			$intSQL = mysql_query($strSQL);
			$rowSQL = mysql_fetch_array($intSQL);
			$DelFilePath = "/datas/".$rowSQL["_DBTAG"]."/".$rowSQL["_BODY_NAME"];
			if (file_exists($DelFilePath)){
				system("echo rm -f $DelFilePath  >> /tmp/dc.cmd");
			}
			$strDEL = "Delete from IMAP where _AUTO = '".$chkbox[$i]."'";
			$intDEL = mysql_query($strDEL);
			if ((fn_digital_asset()==1)||(fn_data_mining()==1)) fputs($fp,"IMAP.".$chkbox[$i]."\n");
			if (!$intDEL) $flag = 1;

				//Delete the attachment 
				$strSQL = "Select * From ATTACHMENT  where _NEWIDX  ='".$chkbox[$i]."' and _TYPE ='4'";
				$intSQL = mysql_query($strSQL);
				while($rowSQL = mysql_fetch_array($intSQL)){							 												  	    
					$DelAttPath="/datas/".$rowSQL["_DBTAG"]."/".$rowSQL["_DB_NAME"];
						if (file_exists($DelAttPath)){
							system("echo rm -f $DelAttPath >> /tmp/dc.cmd");
						}		
				}
				$strDEL = "Delete from ATTACHMENT where _NEWIDX ='".$chkbox[$i]."' and  _TYPE ='4'";
				$intDEL = mysql_query($strDEL);
				if (!$intDEL) $flag = 1;
		}
        if ((fn_digital_asset()==1)||(fn_data_mining()==1)) fclose($fp);

		if ($flag){
			if ($DELIGNORE == "Delete_Ignore"){
				$ErrorMsg = $IMAPM_IGNDELFAIL;
			}else{
				$ErrorMsg = $IMAPM_DELFAIL;
			}
			if ((fn_digital_asset()==1)||(fn_data_mining()==1)) unlink($TMP_FILE);
		}
		else{
			mysql_query("OPTIMIZE TABLE IMAP");
			mysql_query("OPTIMIZE TABLE ATTACHMENT");
			if ($DELIGNORE == "Delete_Ignore"){
				$ErrorMsg = $IMAPM_IGNDELSUCCESS; 
			}else{
				$ErrorMsg = $IMAPM_DELSUCCESS;
			}
			if ((fn_digital_asset()==1)||(fn_data_mining()==1)){
				copy($TMP_FILE,$_DELETE_DIGITAL_PATH.$_FILE);
				unlink($TMP_FILE);
			}
		}
	}
    
	
	//-- System super user(PROGRAM ENTRY PLACE)
	$strSQL = "Select count(*) From IMAP";
	
	if ($mime == 1)
	{
		$strSQL = $strSQL." Where _AUTO in (".$IMAP.")";
	}
	else{
		$strSQL = $strSQL." Where _VISIABLE  <>'1'";
		if(fn_NotShowIP()!="''")$strSQL = $strSQL." and _SIP not in (".fn_NotShowIP().")";

		if ($HTTP_SESSION_VARS['GroupNo_Sess']!=0){
			$strSQL = $strSQL." and  _SIP in (".fn_IPcontrol($HTTP_SESSION_VARS['GroupNo_Sess']).")";
		}//End : if()
		if($strWhere["IMAP"] != "") $strSQL = $strSQL.stripcslashes($strWhere["IMAP"]);
	}

    $condition = fn_SearchMail($QUERY_START_DATETIME,$QUERY_END_DATETIME,reconvert($QUERY_FROM),reconvert($QUERY_TO),$QUERY_CC,'',reconvert($QUERY_SUBJECT),'',$QUERY_IP,$QUERY_IP_1,$QUERY_ID,$QUERY_ACCOUNT,'imap');
	$strSQL = $strSQL.$condition;
	
	//計算符合文章總數 & 初始化分頁變數
    include($_PAGE_PATH);
   
	//為了畫面排序的sql語法
	$strSQL = "Select _AUTO,_SIP,_FROM,_TO,_CC,_SUBJECT,_SIZE,_DBTAG,_BODY_NAME,_NUM_ATTACH,_DB_DATETIME,_ACCOUNT From IMAP ";
	if ($mime == 1)
	{
		$strSQL = $strSQL.fn_Datamining($IMAP,"_AUTO",$m,$n,$to_page);
		$m = 0;
	}
	else{
		$strSQL = $strSQL." Where _VISIABLE <>'1'";
		if(fn_NotShowIP()!="''")$strSQL = $strSQL." and _SIP not in (".fn_NotShowIP().")";

		if ($HTTP_SESSION_VARS['GroupNo_Sess']!=0){
			$strSQL = $strSQL." and _SIP in (".fn_IPcontrol($HTTP_SESSION_VARS['GroupNo_Sess']).")";
		}//End : if()
		if($strWhere["IMAP"] != "") $strSQL = $strSQL.stripcslashes($strWhere["IMAP"]);
	}

	$strSQL = $strSQL.$condition;

	$strSQL = $strSQL." Order by ".$SortField." ".$SortType." limit ".$m.", ".$n;

	$intResult = mysql_query($strSQL);
	//print $strSQL;
	//<--組show畫面字串
	if (mysql_num_rows($intResult) == 0){
		$IMAPList = "<tr class=\"NoData\"><td colspan=\"";
		if (($HTTP_SESSION_VARS["OperateRole_Sess"]=="Super")&&($HTTP_SESSION_VARS["GroupNo_Sess"]=='0')){
			if(fn_ad()) $IMAPList.="10"; else $IMAPList.="9";
		}else{
			if(fn_ad()) $IMAPList.="9"; else $IMAPList.="8";
		}
		include("../no_data.php");
		$IMAPList.="\"".$NoDataList;
		$_Disabled = "disabled";
	}
	else{
		$IMAPList = "";
		$chkCount = ($to_page-1)*$sizepage+1; 
		while ($row=mysql_fetch_array($intResult)){

			$_SUBJECT  =   convert(trim($row["_SUBJECT"]));
			if (ereg("\n$",$_SUBJECT)){
				if (strlen($_SUBJECT)>3){
					$CUT_SUBJECT = $_SUBJECT = substr($_SUBJECT,0,strlen($_SUBJECT)-2);
				}
				elseif (strlen($_SUBJECT==2)){
					$CUT_SUBJECT = $IMAP_NONE;
					$_SUBJECT = $IMAP_NONE;
				}//End : if()
			}//End : if()

			if (($_SUBJECT=='(null)')||($_SUBJECT=='')||(empty($_SUBJECT))){
				$CUT_SUBJECT = $IMAP_NONE;
			}
			elseif (strlen($_SUBJECT)>36){    
				$CUT_SUBJECT=substr($_SUBJECT,0,36)."..."; 
			}else {
				$CUT_SUBJECT = $_SUBJECT;
			}//End : if()


			$_FROM  =  convert(trim($row["_FROM"]));
			if (ereg("\n$",$_FROM)){
				if (strlen($_FROM)>3){
					$CUT_FROM = $_FROM = substr($_FROM,0,strlen($_FROM)-2);
				}
				elseif (strlen($_FROM)==2){
					$CUT_FROM = "&nbsp;";
					$_FROM ="&nbsp;";
				}//End : if()
			}//End : if()

			if (($_FROM=='(null)')||($_FROM=='')||(empty($_FROM))){
				$CUT_FROM = "&nbsp;";
			}
			elseif (strlen($_FROM)>26){    
				$CUT_FROM=substr($_FROM,0,26)."..."; 
			}
			else {
				$CUT_FROM = $_FROM;
			}//End : if()

			$_TO      =    convert(trim($row["_TO"]));
			if (ereg("\n$",$_TO)){
				if (strlen($_TO)>3){
					$CUT_TO = $_TO = substr($_TO,0,strlen($_TO)-2);
				}
				elseif (strlen($_TO)==2){
					$CUT_TO = "&nbsp;";
					$_TO ="&nbsp;";
				}//End : if()
			}//End : if()

			if (($_TO=='(null)')||($_TO=='')||(empty($_TO))){
				$CUT_TO = "&nbsp;";
			}
			elseif (strlen($_TO)>25){    
				$CUT_TO=substr($_TO,0,25)."..."; 
			}
			else {
				$CUT_TO = $_TO;
			}//End : if()

			$_CC      =   trim($row["_CC"]);
			if (ereg("\n$",$_CC)){
				if (strlen($_CC)>3){
					$CUT_CC = $_CC = substr($_CC,0,strlen($_CC)-2);
				}
				elseif (strlen($_CC)==2){
					$CUT_CC = "&nbsp;";
					$_CC ="&nbsp;";
				}//End : if()
			}//End : if()

			//如果_CC無值，塞none
			if (($_CC=='(null)')||($_CC=='')||(empty($_CC))){
				$CUT_CC = "&nbsp;";
			}
			elseif (strlen($_CC)>10){    
				$CUT_CC=substr($_CC,0,10)."..."; 
			}
			else {
				$CUT_CC = $_CC;
			}//End : if(如果_CC無值，塞none)

			$_SIZE				= $row["_SIZE"]; 
			$_DBTAG				= $row["_DBTAG"]; 
			$_BODY_NAME			= $row["_BODY_NAME"]; 

			if ($chkCount%2 == 1){
				$IMAPList.= "<tr  class=\"Tr_Do\" onmouseover=\"this.className='Tr_Do_Out'\" onmouseout=\"this.className='Tr_Do_Over'\">";
			}else{
				$IMAPList.= "<tr class=\"Tr_De\" onmouseover=\"this.className='Tr_De_Out'\" onmouseout=\"this.className='Tr_De_Over'\">";
			}
			
			$IMAPList.="<td align=\"center\" title=\"".$row[_AUTO]."\">".$chkCount.".</td>\n";


			//--attachement
			$IMAPList.="<td align=\"center\">\n";
			if($row["_NUM_ATTACH"] == 0){
				$IMAPList.="&nbsp;</td>\n";
			}
			else {
				$IMAPList.="<img  src=\"../".$DIR_IMAGE.$IMAPP_ATTACH."\"></td>\n";
			}//End : if(attachement)

			//--datetime 
			$IMAPList.="<td align=\"center\"><a href=\"#\" onClick=\"ChangeCondition('_DB_DATETIME','".$row["_DB_DATETIME"]."');\">".fn_DateTime($row["_DB_DATETIME"])."</a></td>\n";

			//--from
			$IMAPList.="<td nowrap><p title=\"".$_FROM."\"><a href=\"#\" onClick=\"ChangeCondition('_FROM','".$_FROM."')\">".$CUT_FROM."</a></p></td>\n";

			//--TO
			$IMAPList.="<td nowrap>\n";

			$IMAPList.="<p title=\"".$_TO."\"><img src=\"../".$DIR_IMAGE.$IMAPP_IP."\" alt=\"".$row["_SIP"]."\"><br>\n";
			$IMAPList = $IMAPList."<a href=\"#\" onClick=\"ChangeCondition('_TO','".$_TO."')\">".$CUT_TO."</a></p></td>\n";
			
			//--cc
			$IMAPList.="<td align=\"center\"><p title=\"".$_CC."\"><a href=\"#\" onClick=\"ChangeCondition('_CC','".$_CC."')\">".$CUT_CC."</a></p></td>\n";			
			//--轉換 DBTAG 的格式
			$_DBTAG ='';
			$_DBTAG =str_replace("-","_",$row["_DBTAG"]);
			$_DBTAG =str_replace(":","_",$_DBTAG);
			//--檢查subject是否有檔，有檔才有連結
			if (file_exists($CD_DIR.":\\".$_DBTAG."/".$row["_BODY_NAME"])){

			//download
			$IMAPList.="<td><span title=\"".$Download."".$_SUBJECT."\"><a href=\"../download.php?file=".$CD_DIR.":\\".$_DBTAG."\\".$row["_BODY_NAME"]."\" target=\"_blank\"><img src=\"../".$DIR_IMAGE.$PIC_SORT."\" border=\"0\"></a></span>&nbsp";
			//isubject
			$IMAPList.="<span title=\"".$_SUBJECT."\"><a href=\"javascript:for_xp_sp2('".$_DBTAG."','".$row["_BODY_NAME"]."')\">".$CUT_SUBJECT."</a></span></td>\n";
			}
			else{
				$IMAPList.="<td>\n";
				$IMAPList.="<p title=\"".$_SUBJECT."\">".$CUT_SUBJECT."</p></td>\n";		
			}//End : if(檢查subject是否有檔，有檔才有連結)

			if (fn_ad()){
				$IMAPList .= "<td align=\"center\"><a href=\"#\" onClick=\"ChangeCondition('_ACCOUNT','".$row["_ACCOUNT"]."')\">".$row["_ACCOUNT"]."</a></td>\n";
            }
  
			$IMAPList .="<td align=\"right\">\n";
			//判斷檔案大小的單位
			if ($_SIZE<1000){
				$IMAPList .=$_SIZE."B";
			}
			elseif (($_SIZE)<1000000&&($_SIZE)>=1000){
				$IMAPList .=(round($_SIZE/100)/10)."K";
			}
			else{
				$IMAPList .=(round($_SIZE/100000)/10)."M";
			}//End : if(判斷檔案大小的單位)
			$IMAPList .="</td>\n";
			$IMAPList .="</a></tr>\n";
			$chkCount++;
		}//End : while(組show畫面字串)
	}
}
else{
	include("../no_privilege.php");
}
?>
<html><head><title></title>
<link href="../Display/display.css" type="text/css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<SCRIPT language=JavaScript src="../inc/fun.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">

function for_xp_sp2(DBTAG,FILENAME){
	var URL = "FOR_XP_SP2.php?_DBTAG="+DBTAG+"&_FILENAME="+FILENAME;
	var Features = "scrollbars=yes,width=800,height=600,left=100,top=25";
	window.open(URL,'DC',Features);
}

function get_nva(auto){
	 var objnav=window.navigator;
	 var nav=objnav.browserLanguage;
	 var value   = new Array("GB18030","GB2312","BIG5","HZ","ISO-8859-1");
	 var display =new Array("zh-ch","zh-sg","zh-tw","zh-hk","en");
	 for (var i=0;i< value.length;i++){
		 if(display[i]==nav){
			 var nav_post=value[i];
		 }
	 }
	 fn_OpenWin('sub_con.php?TYPE=IMAP&_CHARSET='+nav_post+'&_AUTO='+auto,'','width=500,height=200,left=225,top=200,menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no');
}

function fn_Conversion(){
	 document.frm.RunAs.value="Conversion";
	 document.frm.submit();
}
//--Check input pagesize num	
function ChangePageSize(){
	var flag = "";
	switch(CheckNum(document.frm.sizepage)){
		case "1":
			alert("<?echo $NUMBERM_INPUTISNULL;?>");
			flag = "1";
		break;
		case "2":
			alert("<?echo $NUMBERM_INPUTISZERO;?>");
			flag = "1";
		break;
		case "3":
			alert("<?echo $NUMBERM_INPUTBIG100;?>");
			flag = "1";
		break;
		case "4":
			alert("<?echo $NUMBERM_INPUTNOTNUM;?>");
			flag = "1";
		break;
	}
	
	if (flag == 1){
		document.frm.sizepage.focus();
		return;
	}
		document.frm.RunAs.value = "UpdatePageSize";
		document.frm.submit();
}

//--DELETE DATA
function checkDEL(){
<?if ($_Disabled == ""){?>
	if (!MainCheck()){
		alert("<?echo $IMAPM_NOTSELECT;?>");
		return;
	}

	if (confirm("<?echo $IMAPM_CHECKDEL;?>")){
		document.frm.RunAs.value = "Delete";
		document.frm.submit();
	}
<?}?>
}

//--igone
function checkIGNORE(value){
<?if($_Disabled == ""){?>
	if (!MainCheck()){		fn_OpenWin('ignorelist.php','NewWin','width=900,height=590,left=60,top=50,menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=yes,resizable=no,fullscreen=no');
	return;
	}
<?}else{?>
	fn_OpenWin('ignorelist.php','NewWin','width=900,height=590,left=60,top=50,menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=yes,resizable=no,fullscreen=no');
	return;
<?}?>
	
	if (value == 2){
		if (confirm("<?echo $IMAPM_IGNOREDEL;?>")){
			document.frm.RunAs.value = "Ignore";
			document.frm.DELIGNORE.value="Delete_Ignore";
			document.frm.submit();
		}
	}
	else{
		document.frm.RunAs.value = "Ignore";
		document.frm.submit();
	}
}

<?if ($ErrorMsg != ""){?>
	fn_ErrorMsg('<?echo $ErrorMsg?>')
	<?if(($flag != 1 && $RunAs != "Delete") || ($DELIGNORE == "Delete_Ignore" && $flag != 1)){?>
		fn_OpenWin('ignorelist.php','NewWin','width=900,height=590,left=60,top=50,menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=yes,resizable=no,fullscreen=no');
	<?}?>
<?}?>
</SCRIPT>
</head>
<body onLoad="fix();" onScroll="fix();" onResize="fix();">  
<!-- search result-->
<form name="frm" action="imap.php" method="post">
<input type="hidden" name="strWhere[IMAP]" value="<?echo stripcslashes($strWhere["IMAP"]);?>">
<input type="hidden" name="DELIGNORE" value="">
<input type="hidden" name="RunAs" value="">
<input type="hidden" name="SortField" value="<? echo $SortField ?>">
<input type="hidden" name="SortType" value="<? echo  $SortType ?>">
<input type="hidden" name="Checked" value="<? echo $Checked?>">
<input type="hidden" name="QUERY_START_DATETIME" value="<?echo $QUERY_START_DATETIME;?>">
<input type="hidden" name="QUERY_END_DATETIME" value="<?echo $QUERY_END_DATETIME;?>">
<input type="hidden" name="QUERY_SUBJECT" value="<?echo $QUERY_SUBJECT;?>">
<input type="hidden" name="QUERY_FROM" value="<?echo ($QUERY_FROM);?>">
<input type="hidden" name="QUERY_TO" value="<?echo $QUERY_TO;?>">
<input type="hidden" name="QUERY_CC" value="<?echo $QUERY_CC;?>">
<input type="hidden" name="QUERY_IP" value="<?echo $QUERY_IP;?>">
<input type="hidden" name="QUERY_IP_1" value="<?echo $QUERY_IP_1;?>">
<input type="hidden" name="QUERY_ACCOUNT" value="<?echo $QUERY_ACCOUNT;?>">
<input type="hidden" name="to_page" value="<?echo $to_page;?>"><!--current page-->
<input type="hidden" name="mime" value="<?echo $mime;?>">
<input type="hidden" name="IMAP" value="<?echo $IMAP;?>">
<input type="hidden" name="digital" value="<?echo $digital;?>">
<input type="hidden" name="str1" value="<?echo $digital;?>">
<input type="hidden" name="str2" value="<?echo $digital;?>">
<input type="hidden" name="str3" value="<?echo $digital;?>">

<span id="bar" style="position:absolute;z-index:2;  width:100%; height:100%" align="center">
<table  width="100%" cellSpacing="0" cellPadding="0" border="0">
  <tr  id="Tr_F">
    <td>
	  &nbsp;&nbsp;<a href="imap.php"  title="<?echo $IMAP_IMAP;?>"><img src="../<?echo $DIR_IMAGE.$IMAPP_IMAP;?>" border="0" align="top"> <?echo $IMAP_IMAP_SHOW;?></a> |
	  
<!-- Ignore& Ignore and Delete -->
    <?if (($HTTP_SESSION_VARS["OperateRole_Sess"]=="Super")&&($HTTP_SESSION_VARS["GroupNo_Sess"]=='0')){?>
		<a href="javascript:checkDEL();"  title="<?echo $IMAP_DEL;?>"><img src="../<?echo $DIR_IMAGE.$IMAPP_DEL;?>" border="0" align="top"> <?echo $IMAP_DEL_SHOW;?></a> |
		<!--  
		<a href="javascript:checkIGNORE('1');"    title="<?echo $IMAP_IGNORE;?>"><img src="../<?echo $DIR_IMAGE.$IMAPP_IGNORE?>" border="0" align="middle"> <?echo $IMAP_IGNORE_SHOW;?></a> | <a href="javascript:checkIGNORE('2');"   title="<?echo $IMAP_IGNOREDEL;?>"><img src="../<?echo $DIR_IMAGE.$IMAPP_IGNOREDEL?>" border="0" align="middle"> <?echo $IMAP_IGNOREDEL_SHOW;?></a> | 
		-->
	<?}?>
<!-- Search  -->
	  <a href="javascript:fn_OpenWin('<?echo $_SearchPath;?>?Status=imap&digital=<?echo $digital;?>','NewWin','width=400,height=340,left=320,top=250,menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no');"  title="<?echo $IMAP_SEARCH;?>"><img src="../<?echo $DIR_IMAGE.$IMAPP_SEARCH;?>" align="top" border="0"> <?echo $IMAP_SEARCH_SHOW;?></a>
	</td>
	<td class="EveryPage"> 
	  <span title="<?echo $IMAP_PAGEVIEW;?>"><?echo $IMAP_PAGEVIEW_SHOW;?></span>
	  <input type="text"  name="sizepage" value="<?echo $sizepage?>" class="Text_P" > 
	  <input type="button" name="bntPageSize" value="<?echo $IMAPB_OK_SHOW;?>" onClick="ChangePageSize();" class="Btn_C" title="<?echo $IMAPB_OK;?>">&nbsp;
	</td>
  </tr>
</table>
<!--  blank TABLE-->
<table width="100%" class="BlankTb">
	<tr  height="24"><td ></td></tr>
</table>

<table class="TitleTb">
  <tr  id="Tr_T">
    <td width="3%"><span title="<?echo $IMAP_NO;?>"><?echo $IMAP_NO_SHOW;?></span></td>

    <td width="2%"><img src="../<?echo $DIR_IMAGE.$IMAPP_ATTACH;?>" alt="<?echo $IMAPA_ATTACH;?>"></td>
    <td width="9%" <?echo $colDate ;?>>
	  <a href="javascript:ChangeSort('_DB_DATETIME','<? echo $sortDate;?>');"  title="<?echo $IMAP_DATETIME;?>"><?echo $IMAP_DATETIME_SHOW;?><?echo $imgDate;?></a>
	</td>
    <td width="21%" <?echo $colFrom;?>>
	  <a href="javascript:ChangeSort('_FROM', '<?echo $sortFrom;?>');"  title="<?echo $IMAP_FROM;?>"><?echo $IMAP_FROM_SHOW;?><?echo $imgFrom;?>
	</td>
    <td width="18%" <?echo $colTO;?>>
	  <a href="javascript:ChangeSort('_TO', '<?echo $sortTO;?>');"  title="<?echo $IMAP_TO;?>"><?echo $IMAP_TO_SHOW;?><?echo $imgTO;?>
	</td>
    <td width="10%" <?echo $colCC;?>>
	  <a href="javascript:ChangeSort('_CC', '<?echo $sortCC;?>');"  title="<?echo $IMAP_CC;?>"><?echo $IMAP_CC_SHOW;?><?echo $imgCC;?>
	</td>
    <td><span title="<?echo $IMAP_SUBJECT;?>"><?echo $IMAP_SUBJECT_SHOW;?></span></td>
    <? if (fn_ad()){?>
		<td width="7%" <?echo $colAccount;?>>
			<a href="javascript:ChangeSort('_ACCOUNT', '<?echo $sortAccount;?>');"  title="<?echo $IMAP_ACCOUNT;?>"><?echo $IMAP_ACCOUNT_SHOW;?><?echo $imgAccount;?>
		</td>	
    <?}?>
    <td nowrap width="4%" align="right" <?echo $colSize;?>>
	  <a href="javascript:ChangeSort('_SIZE','<? echo $sortSize;?>');"  title="<?echo $IMAP_SIZE;?>"><? echo $imgSize;?><?echo $IMAP_SIZE_SHOW;?></a>
	</td>
  </tr>
  </table>
</span>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr id="Tr_F"><td height="24"></td></tr>
</table>

<table class="DataTb" >
  <tr class="Tr_Do">
    <td width="3%" height="24"></td>

    <td width="2%"></td>
    <td width="9%"></td>
    <td width="21%"></td>
    <td width="18%"></td>
    <td width="10%"></td>
    <td></td>
    <? if (fn_ad()){?>
		<td width="7%"></td>	
    <?}?>
    <td width="4%"></td>
  </tr>
 <!--show screen-->
  <? echo $IMAPList;?>
  <tr>
	<td colSpan="
	<?
		if (($HTTP_SESSION_VARS["OperateRole_Sess"]=="Super")&&($HTTP_SESSION_VARS["GroupNo_Sess"]=='0')){
			if(fn_ad()) echo "10"; else echo "9";
		}else{
			if(fn_ad()) echo "9"; else echo "8";
		}
	?>
	" align="center">
	  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr  id="Tr_P"><? include("../list_page.php");?></tr>
      </table>
	</td>
 </tr>
</table>

</form>
</body>	
</html>