<?
	require_once('link.php');
	mysql_select_db($database,$connect);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>管理者-公告列表</title>
<style>
<!--
.style1 {font-size: 13px; color: #FFFFFF; }
BODY {
	SCROLLBAR-FACE-COLOR: #D4D0C8;
	SCROLLBAR-HIGHLIGHT-COLOR: #D4D0C8;
	SCROLLBAR-SHADOW-COLOR: #999999;
	SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
	SCROLLBAR-ARROW-COLOR:  #000000;
	SCROLLBAR-TRACK-COLOR: #E3E3E3;
	SCROLLBAR-DARKSHADOW-COLOR: #666666;
	background-image: url(img/bg1.png);
	background-color: #000000;
	background-attachment: fixed;
}
a:link {
	color: white;
	text-decoration: none;
}
a:visited {
	color: white;
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
body,td,th {
	color: #FFFFFF;
	font-family: Arial, Helvetica, sans-serif;
}
.style6 {font-size: small}
--></style>
</head>

<script  language="JavaScript">
function check()
{
	var r=confirm("是否刪除此文章?");
	if(r==true)
		return true;
	if(r==false);
		return false;
	
}
</script>

<body leftmargin=0 topmargin=0 bgproperties="fixed" rightmargin=0  bottommargin=0 marginwidth=0 marginheight=0>
<center>  <p>&nbsp;</p>
<?
	$query = "SELECT * FROM `Notice` ORDER BY `dateTime` DESC";
	$result = mysql_query($query,$connect);
	mysql_query('SET NAMES utf8');
	$num = mysql_num_rows($result);
	for($i=0;$i<=$num;$i++)
	{
		$row[$i] = mysql_fetch_array($result);
	}	
	if (!isset($index))
	{
		$index=0;
	}
	if (isset($page)&&$page>0&&$page<($num+5)/5)
	{
		$index=($page)*5-5;
	}
	$tmp=$index+5;
	$tmp2=$index+5;
	if ($num<$tmp)
	{
		$tmp=$num;
	}
	for (;$index<$tmp;$index++)
	{?>
	
		<table width="291" height="88" border="0" align="center" cellpadding="1" cellspacing="0" class="style1">
		<tr>
		  <td bgcolor="#260005"><div align = "center" class="style6">發表人</div></td>
		  <td width="0"></td>
		  <td bgcolor="#260005"><div align = "center" class="style6"><? echo $row[$index][mId];?></div></td>
		</tr><td colspan = "3"></td>
		</tr>
		<tr>
		  <td bgcolor="#770010"><div align = "center" class="style6">發表日期</div></td>
		  <td width="0"></td>
		  <td bgcolor="#770010"><div align = "center" class="style6"><? echo $row[$index][dateTime];?></div></td>
		</tr><td colspan = "3"></td>
		</tr>
		<tr>
		  <td bgcolor="#923358"><div align = "center" class="style6">標題</div></td>
		  <td width="0"></td>
		  <td bgcolor="#923358"><div align = "center" class="style6"><? echo $row[$index][title];?></div></td>
		</tr><td colspan = "3"></td>
		</tr>
		<tr bgcolor="#AB909F">
		  <td colspan = "3"><div align = "center" class="style6"><? echo $row[$index][content];?></div></td>
		</tr>
		</table>
 <br>
<? }?>
<table width="288"  border="0" cellpadding="1" cellspacing="0" class="style1">
	<tr><td><div align="center">目前在第 <? echo $tmp2/5;?> 頁
	共 <? if($num%5!=0) {echo (int)($num/5)+1;} elseif($num==0) {echo 1;}  else {echo (int)($num/5);}?> 頁</div></td></tr>
	<tr><td><div align="center"><form action="notice_all.php" method="post">
	到第
	<input  name="page" type="text" size="2" maxlength="3" style="BORDER: 1px solid; IME-MODE: disabled">
	頁
	<input type="submit" value="送出" style="color: #FFFFFF; border:1px solid #999999;background-color: #505050;padding-left:2;padding-top:2;padding-right:2">
	</form></div></td></tr>
</table></center>
</body>
</html>