<?
include "cnn.php";
?>
<script>
function AbreMenu(nome_div)
{
var div = "";
var menus = 3;
	for (var i=1; i < menus; i++)
	{
	div = "div"+i;
	document.getElementById(div).style.display = "none"; 
		if (div == nome_div)
		{
		document.getElementById(nome_div).style.display = "block"; 
		}
	}
}
</script>
<h1>Ranking Guild </h1>
<p class='post-footer'>
<a href="javascript:AbreMenu('div1')">Ranking de Personagens</a>&nbsp;|
<a href="javascript:AbreMenu('div2')">Ranking de Guilds</a>
<p class=''><form action='index.php?go=gsearch' method='post'>
Guild:
<input type="text" id="guild" size="14" name="guild" value="nome da guild" maxlength="20" onFocus="clearText(this)">
<input type="submit" name="submit" value="pesquisar" >
</form>&nbsp;</p>
</p>
<div class='post-footer' id='div1' style='display:none'>
<a href='?go=ranres&top=10'>Resets</a>&nbsp;|
<a href='?go=ranlev&top=10'>Level</a>&nbsp;|
<a href='?go=ranpk&top=10'>PK (Mortes)</a>&nbsp;|
<a href='?go=ranmr&top=10'>Master Reset</a>&nbsp;|
<a href='?go=rankmed'>Medalhas</a></div>
<div class='post-footer' id='div2' style='display:none'>
<a href='?go=rangui&top=10'>Pontos (Wars Ganhos)</a>
</div>
<div class="quadros">
<input name="button" type='button' class='submit' onClick="location='?go=rangui&top=10'" value='Top 10'>
<input name="button" type='button' class='submit' onClick="location='?go=rangui&top=30'" value='Top 30'>
<input name="button" type='button' class='submit' onClick="location='?go=rangui&top=50'" value='Top 50'>
<input name="button" type='button' class='submit' onClick="location='?go=rangui&top=100'" value='Top 100'>
<input name="button" type='button' class='submit' onClick="location='?go=rangui&top=300'" value='Top 300'>
<input name="button" type='button' class='submit' onClick="location='?go=rangui&top=500'" value='Top 500'>
<table border='0' width='100%'>
<tr>
<td bgcolor='#cccccc' align='center'><strong>#</strong></td>
<td bgcolor='#cccccc' align='center'><strong>Logo</strong></td>
<td bgcolor='#cccccc' align='center'><strong>Guild</strong></td>
<td bgcolor='#cccccc' align='center'><strong>Guild Master</strong></td>
<td bgcolor='#B4B4B4' align='center'><strong>Pontos</strong></td>
<td bgcolor='#cccccc' align='center'><strong>Membros</strong></td>
<td bgcolor='#cccccc' align='center'><strong>Not&iacute;cia</strong></td>
</tr>
<?
  $Query = mssql_query("select top $top g_name,g_score,g_master,g_notice,g_mark from guild order by g_score desc");
  for($i=0;$i<mssql_num_rows($Query);$i++) {
  $rank = $i+1;
  $Array = mssql_fetch_row($Query);
  $Membros = mssql_fetch_row(mssql_query("select count(*) from guildmember where g_name='".$Array[0]."'"));
  $query_dados = mssql_query("SELECT * FROM Guild WHERE G_Name = '$Array[0]'");
  $dados = mssql_fetch_array($query_dados);
  $logo = urlencode(bin2hex($dados['G_Mark']));
?>
<tr>
<td align="center" bgcolor="#E5E5E5"><strong>
  <?=$rank?>
</strong></td>
<td align="center"><img src="decode.php?decode=<?=$logo?>" width="20" height="20" style="border:none"></td>
<td align="center"><a href="index.php?go=gbusca&guild=<?=$Array[0]?>"><strong><?=$Array[0]?></strong></td>
<td align="center"><?=$Array[2]?></td>
<td align="center"><strong><?=$Array[1]?></strong></td>
<td align="center"><?=$Membros[0]?></td>
<td align="center"><a href="javascript:void();" onclick="javascript:alert('<?=$Array[3]?>');">[Ver]</a></td>
</tr>
<? } ?>
</table>
</div>