<div class="primary-block">
	<div class="main-content">
		<h1 class="title-content">Xếp hạng Bang Hội</h1>
		<ul class="tabs-content">
			<li <? if(!isset($_GET['type']) || $_GET['type'] == 'point') echo 'class="active"'; ?> ><a href="#rank&act=ranking_guild&type=point" rel="ajax">Tổng Point</a></li>
			<li <? if($_GET['type'] == 'rs') echo 'class="active"'; ?> ><a href="#rank&act=ranking_guild&type=rs" rel="ajax">Tổng RS</a></li>
			<li <? if($_GET['type'] == 'mem') echo 'class="active"'; ?> ><a href="#rank&act=ranking_guild&type=mem" rel="ajax">Tổng MEM</a></li>
		<? if ($rank_gp == 1){ ?>
			<li <? if($_GET['type'] == 'score') echo 'class="active"'; ?> ><a href="#rank&act=ranking_guild&type=score" rel="ajax">Tổng GP</a></li>
		<? } if ($rank_tieuphi == 1){ ?>
			<li <? if($_GET['type'] == 'tieuphi') echo 'class="active"'; ?> ><a href="#rank&act=ranking_guild&type=tieuphi" rel="ajax">Tổng Tiêu Phí</a></li>
		<? } ?>
		</ul>
	</div>
</div>
<div class="primary-block out-top-20">

	<div class="in-20 font-14 text-semibold">
        <center>Cập nhập lúc: <? echo date('H:i d/m/Y', $time_host); ?></center>
        
        <? if(!isset($_GET['type']) || $_GET['type'] == 'point') { ?>
		<p class="update-time in-10">
			<center><b><font color="red">Danh sách Bang Hội nhiều Point nhất</font></b></center>
		</p>
		<table class="table table-blue-white table-border-2 table-text-center table-sort">
			<thead>
				<tr>
					<th align="center" scope="col">#</th>
					<th align="center" scope="col"><b>Bang Hội</b></th>
					<th align="center" scope="col"><b>Chủ Hội</b></th>
					<th align="center" scope="col"><b>Point</b></th>
					<th align="center" scope="col"><b>MEM</b></th>
					<th align="center" scope="col"><b>RS</b></th>
					<th align="center" scope="col"><b>Logo</b></th>
                    <th align="center" scope="col"><b>Liên Minh</b></th>
                    <th align="center" scope="col"><b>Đối Địch</b></th>
				</tr>
			</thead>
			<tbody>
			<? for($i=0;$i<$slg_GPoint;$i++) { 
				$top = $i+1;
				if($top==1){$top='<img src="images/icons/top/1.png" width="80px"/>';}
				if($top==2){$top='<img src="images/icons/top/2.png" width="60px"/>';}
				if($top==3){$top='<img src="images/icons/top/3.png" width="55px"/>';}
			?>
			<tr>
				<td align="center"><? echo $top; ?></td>
				<td align="center"><? echo $gtop['Point'][$i]['GName']; ?></td>
				<td align="center"><? echo $gtop['Point'][$i]['GMaster']; ?></td>
				<td align="center"><? echo $gtop['Point'][$i]['PointTotal']; ?></td>
				<td align="center"><? echo $gtop['Point'][$i]['SlgMem']; ?></td>
				<td align="center"><? echo $gtop['Point'][$i]['RSTotal']; ?></td>
				<td align="center"><img src="./includes/guild_logo.php?decode=<? echo $gtop['Point'][$i]['Logo']; ?>" width="30" height="30" /></td>
                <td align="center"><? echo $gtop['Point'][$i]['LM']; ?></td>
                <td align="center"><? echo $gtop['Point'][$i]['DD']; ?></td>
			</tr>
			<? } ?>
			</tbody>
		</table>
        
        <? } elseif (!isset($_GET['type']) || $_GET['type'] == 'rs') { ?>
		<p class="in-10">
			<center><b><font color="red">Danh sách Bang Hội Reset nhiều nhất</font></b></center>
		</p>
		<table class="table table-blue-white table-border-2 table-text-center table-sort">
			<thead>
				<tr>
					<th align="center">#</th>
					<th align="center"><b>Bang Hội</b></th>
					<th align="center"><b>Chủ Hội</b></th>
					<th align="center"><b>RS</b></th>
					<th align="center"><b>MEM</b></th>
					<th align="center"><b>Point</b></th>
					<th align="center"><b>Logo</b></th>
                    <th align="center"><b>Liên Minh</b></th>
                    <th align="center"><b>Đối Địch</b></th>
				</tr>
			</thead>
			<tbody>
				<? for($i=0;$i<$slg_GReset;$i++) { 
				$top = $i+1;
				if($top==1){$top='<img src="images/icons/top/1.png" width="80px"/>';}
				if($top==2){$top='<img src="images/icons/top/2.png" width="60px"/>';}
				if($top==3){$top='<img src="images/icons/top/3.png" width="55px"/>';}
				?>
				<tr>
					<td align="center"><? echo $top; ?></td>
					<td align="center"><? echo $gtop['RS'][$i]['GName']; ?></td>
					<td align="center"><? echo $gtop['RS'][$i]['GMaster']; ?></td>
					<td align="center"><? echo $gtop['RS'][$i]['RSTotal']; ?></td>
					<td align="center"><? echo $gtop['RS'][$i]['SlgMem']; ?></td>
					<td align="center"><? echo $gtop['RS'][$i]['PointTotal']; ?></td>
					<td align="center"><img src="./includes/guild_logo.php?decode=<? echo $gtop['RS'][$i]['Logo']; ?>" width="30" height="30" /></td>
					<td align="center"><? echo $gtop['RS'][$i]['LM']; ?></td>
					<td align="center"><? echo $gtop['RS'][$i]['DD']; ?></td>
				</tr>
				<? } ?>
			</tbody>

		</table>
		
        <? } elseif (!isset($_GET['type']) || $_GET['type'] == 'mem') { ?>
		<p class="in-10">
			<center><b><font color="red">Danh sách Bang Hội đông dân nhất</font></b></center>
		</p>
		<table class="table table-blue-white table-border-2 table-text-center table-sort">
			<thead>
				<tr>
					<th align="center">#</th>
					<th align="center"><b>Bang Hội</b></th>
					<th align="center"><b>Chủ Hội</b></th>
					<th align="center"><b>MEM</b></th>
					<th align="center"><b>RS</b></th>
					<th align="center"><b>Point</b></th>
					<th align="center"><b>Logo</b></th>
                    <th align="center"><b>Liên Minh</b></th>
                    <th align="center"><b>Đối Địch</b></th>
				</tr>
			</thead>
			<tbody>
				<? for($i=0;$i<$slg_GMem;$i++) { 
				$top = $i+1;
				if($top==1){$top='<img src="images/icons/top/1.png" width="80px"/>';}
				if($top==2){$top='<img src="images/icons/top/2.png" width="60px"/>';}
				if($top==3){$top='<img src="images/icons/top/3.png" width="55px"/>';}
				?>
				<tr>
					<td align="center"><? echo $top; ?></td>
					<td align="center"><? echo $gtop['Mem'][$i]['GName']; ?></td>
					<td align="center"><? echo $gtop['Mem'][$i]['GMaster']; ?></td>
					<td align="center"><? echo $gtop['Mem'][$i]['SlgMem']; ?></td>
					<td align="center"><? echo $gtop['Mem'][$i]['RSTotal']; ?></td>
					<td align="center"><? echo $gtop['Mem'][$i]['PointTotal']; ?></td>
					<td align="center"><img src="./includes/guild_logo.php?decode=<? echo $gtop['Mem'][$i]['Logo']; ?>" width="30" height="30" /></td>
					<td align="center"><? echo $gtop['Mem'][$i]['LM']; ?></td>
					<td align="center"><? echo $gtop['Mem'][$i]['DD']; ?></td>
				</tr>
				<? } ?>
			</tbody>

		</table>
        <? } elseif (!isset($_GET['type']) || $_GET['type'] == 'score') { ?>
		<p class="in-10">
			<center><b><font color="red">Danh sách Bang Hội nhiều điểm GP nhất (GP nhận được khi hoàn thành nhiệm vụ hằng ngày)</font></b></center>
		</p>
		<table class="table table-blue-white table-border-2 table-text-center table-sort">
			<thead>
				<tr>
					<th align="center">#</th>
					<th align="center"><b>Bang Hội</b></th>
					<th align="center"><b>Chủ Hội</b></th>
					<th align="center"><b>GP</b></th>
					<th align="center"><b>MEM</b></th>
					<th align="center"><b>RS</b></th>
					<th align="center"><b>Point</b></th>
					<th align="center"><b>Logo</b></th>
                    <th align="center"><b>Liên Minh</b></th>
                    <th align="center"><b>Đối Địch</b></th>
				</tr>
			</thead>
			<tbody>
				<? for($i=0;$i<$slg_G_Score;$i++) { 
				$top = $i+1;
				if($top==1){$top='<img src="images/icons/top/1.png" width="80px"/>';}
				if($top==2){$top='<img src="images/icons/top/2.png" width="60px"/>';}
				if($top==3){$top='<img src="images/icons/top/3.png" width="55px"/>';}
				?>
				<tr>
					<td align="center"><? echo $top; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['GName']; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['GMaster']; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['G_Score']; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['SlgMem']; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['RSTotal']; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['PointTotal']; ?></td>
					<td align="center"><img src="./includes/guild_logo.php?decode=<? echo $gtop['Score'][$i]['Logo']; ?>" width="30" height="30" /></td>
					<td align="center"><? echo $gtop['Score'][$i]['LM']; ?></td>
					<td align="center"><? echo $gtop['Score'][$i]['DD']; ?></td>
				</tr>
				<? } ?>
			</tbody>

		</table>
        <? } elseif (!isset($_GET['type']) || $_GET['type'] == 'tieuphi') { ?>
		<p class="in-10">
			<center><b><font color="red">Danh sách Bang Hội đông dân nhất</font></b></center>
		</p>
		<table class="table table-blue-white table-border-2 table-text-center table-sort">
			<thead>
				<tr>
					<th align="center">#</th>
					<th align="center"><b>Bang Hội</b></th>
					<th align="center"><b>Chủ Hội</b></th>
					<th align="center"><b>Tiêu Phí</b></th>
					<th align="center"><b>MEM</b></th>
					<th align="center"><b>RS</b></th>
					<th align="center"><b>Point</b></th>
					<th align="center"><b>Logo</b></th>
                    <th align="center"><b>Liên Minh</b></th>
                    <th align="center"><b>Đối Địch</b></th>
				</tr>
			</thead>
			<tbody>
				<? for($i=0;$i<$slg_TieuPhi;$i++) { 
				$top = $i+1;
				if($top==1){$top='<img src="images/icons/top/1.png" width="80px"/>';}
				if($top==2){$top='<img src="images/icons/top/2.png" width="60px"/>';}
				if($top==3){$top='<img src="images/icons/top/3.png" width="55px"/>';}
				?>
				<tr>
					<td align="center"><? echo $top; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['GName']; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['GMaster']; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['G_TieuPhi']; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['SlgMem']; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['RSTotal']; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['PointTotal']; ?></td>
					<td align="center"><img src="./includes/guild_logo.php?decode=<? echo $gtop['TieuPhi'][$i]['Logo']; ?>" width="30" height="30" /></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['LM']; ?></td>
					<td align="center"><? echo $gtop['TieuPhi'][$i]['DD']; ?></td>
				</tr>
				<? } ?>
			</tbody>

		</table>
        <? } ?>
	</div>

</div>