<?php
include ("../../functions.php");
include ("../../conf.php");

if (!$board_config->lang) $board_config->lang = "en";
include ("$www_dir/lang/" . $board_config->lang . "/common.lang.php");

$ranks_dir = "$rel_path/images/ranks/img";
if (!is_dir($ranks_dir)) exit("$ranks_dir not found");
$hdl1 = opendir($avatars_dir);

$hdl = opendir($ranks_dir);
while(false !== ($file = readdir($hdl))) {
  if ($file=="."||$file=="..") continue;
  elseif (preg_match('/(gif|png|jpg|jpeg)$/i',$file)) {
    $ranks[] = $file;
  }
}
closedir($hdl);


if ($ranks) {
  $ranks_cnt = count($ranks);
  sort($ranks);
  for ($i=0;$i<$ranks_cnt;$i++) {
    echo "<img src='$main_path/img/" . $ranks[$i] . "' title='" . $ranks[$i] . "' />\n";
  }
?>
<script type="text/javascript">
  $("#sbbrankimgs img").click(function() {
    var newSrc = $(this).attr("src");
    $("#sbb .sbbrank").attr("src",newSrc);
    $("input[name='img']").val(newSrc);
    closeavatars();
  });
</script>


  
<?php
} else {
  exit("No Rankimages :(");
}

?>