<?php
             if(!defined('DIRECTACCESS')){
                 echo 'You cannot access this file directly!';
               die;
             }
     ?>     
          <script language="javascript" type="text/javascript" src="js/mootools-1.2-core.js"></script>
          <script language="javascript" type="text/javascript" src="js/mootools-1.2-more.js"></script>
          <script language="javascript" type="text/javascript" src="js/SlideItMoo.js"></script>
          <script language="javascript" type="text/javascript">
              window.addEvent('domready', function(){	
	             new SlideItMoo({itemsVisible:5, 
					      currentElement: 0, 
					      thumbsContainer: 'thumbs3',
					      elementScrolled: 'thumb_container3',
					      overallContainer: 'gallery_container3'});
              });
          </script>
          
          
          
         <table class="default" colspan="20">
     			<tr>
    <?php
          
      if(!isset($_GET['reportID']) OR empty($_GET['reportID']) OR !isset($_GET['name']) OR empty($_GET['name']) ) {
	           echo '<td class="result" style="height:80px;"><span class="DIVtext" style="font-size:20px;">'.LANG_BATTLEREPORT_DETAILS_ERROR.'</span></td>';	
           }else{
	         $report = $_GET['reportID']; 
	         $soldier = $_GET['name']; 
	       $sSql = "
		              SELECT 
		               a.*,
			             b.soldiername,
			             b.pid,
			             c.*
		             FROM 
		               ".DBPrefix."battlereportsDetails a
	               Left JOIN 
                   ".DBPrefix."generalStats  b ON a.stats_pid = b.pid
                 Left JOIN 
                   ".DBPrefix."battlereports  c ON a.ReportID = c.ReportID
	               WHERE 
			           b.soldiername = '{$soldier}' AND  a.ReportID = '{$report}' AND a.stats_pid = b.pid";

           $result = mysql_query($sSql) or $sError = 'Error in Query: ' . mysql_error() . ' in SQL: ' . print_r($sSql, true);
           $data = mysql_fetch_assoc($result);
      if ($data['status'] == 0 OR mysql_num_rows($result) == 0){
           	echo '<td class="result" style="height:80px;"><span class="DIVtext" style="font-size:20px;">'.LANG_BATTLEREPORT_DETAILS_ERROR.'</span></td>';	
         }else{
	         
	         if ($data['mapMode'] == 8){
	             $margin = "15";
	             $team1 = "TEAM A";
	             $team2 = "TEAM B";
	             $team3 = "TEAM C";
	             $team4 = "TEAM D";
	           }elseif ($data['mapMode'] == 0 OR $data['mapMode'] == 2 OR $data['mapMode'] == 4){
	             $margin = "40";
	             $team1 = "US Attacker";
	             $team2 = "RU DEFENDER";
	           }else{
	           	$margin = "40";
	           	 $team1 = "US ARMEE";
	             $team2 = "RU ARMEE";
	           }
	     ?>
     				<td class="result">
     					<span class="DIVtext" style="float:left;margin-left:5px;font-size:15px;"><?php echo LANG_BATTLEREPORT_DETAILS_TITLE.$EoT->GameMode($data['mapMode']); ?></span><br />
     					 <span style="float:left;margin-left:5px;"><?php echo LANG_BATTLEREPORT_DETAILS_DATE.$EoT->unix_to_time($data['CreatetAt']); ?>&nbsp;&nbsp;
     					 	<font class="DIVtext"><?php echo htmlspecialchars($data['Servername']); ?></font>
     					 	<?php echo  LANG_BATTLEREPORT_DETAILS_TIME.$EoT->time_m($data['duration']);?>
     					 </span><br />
     					 <span style="float:left;margin-left:5px;"><?php echo  LANG_BATTLEREPORT_MAP.$EoT->mapName($data['ServerMap']); ?></span>
     				</td>
     				<tr>
     					
     				<td class="result">
     					<div style="background-image:url(<?php echo $domain; ?>/img/gameserver/maps/big/<?php echo $data['map']; ?>.jpg);height:110px;background-repeat: no-repeat; background-position: center center;">
     					  <div style="background-image:url(<?php echo $domain; ?>/img/gameserver/back1.png);position:absolute;width:220px;height:30px;margin-left:170px;margin-top:<?php echo $margin;?>px;border:1px solid <?php echo checkwinner($data['winner'],"1"); ?>">
     					  	<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:5px;font-family: Times New Roman;"><?php echo $team1; ?></span>
     					  	<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:25px;font-family: Times New Roman;"><?php echo $data['ticket1']; ?></span>
     				   </div>
     				   <div style="background-image:url(<?php echo $domain; ?>/img/gameserver/back2.png);position:absolute;width:220px;height:30px;margin-left:410px;margin-top:<?php echo $margin;?>px;border:1px solid <?php echo checkwinner($data['winner'],"2"); ?>">
     				   	<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:11px;color:#000;font-family: Times New Roman;"><?php echo $team2; ?></span>
     				   	<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:25px;color:#000;font-family: Times New Roman;"><?php echo $data['ticket2']; ?></span>
     				   </div>
     				   <?php if ($data['mapMode'] == 8){
     				   	?>
     				   	<div style="background-image:url(<?php echo $domain; ?>/img/gameserver/back2.png);position:absolute;width:220px;height:30px;margin-left:170px;margin-top:<?php echo $margin+45;?>px;border:1px solid <?php echo checkwinner($data['winner'],"3"); ?>">
     				   		<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:11px;color:#000;font-family: Times New Roman;"><?php echo $team3; ?></span>
     				   		<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:25px;color:#000;font-family: Times New Roman;"><?php echo $data['ticket3']; ?></span>
     				   </div>
     				   <div style="background-image:url(<?php echo $domain; ?>/img/gameserver/back1.png);position:absolute;width:220px;height:30px;margin-left:410px;margin-top:<?php echo $margin+45;?>px;border:1px solid <?php echo checkwinner($data['winner'],"4"); ?>">
     				   	<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:11px;font-family: Times New Roman;"><?php echo $team4; ?></span>
     				   	<span style="margin-top:8px;font-weight:bold;font-size:19px;float:left;margin-left:25px;font-family: Times New Roman;"><?php echo $data['ticket4']; ?></span>
     				   </div>
     				 <?php } ?>
     					</div>
     				</div>
     				</td>	
     			<tr>
     			<td class="result">
            <span class="DIVtext" style="float:left;margin-left:5px;font-size:12px;margin-top:3px;"><?php echo LANG_BATTLEREPORT_DETAILS_BEST_PLAYERS; ?></span><br /><br />
            <?php

            	$topPlayers['bestKills'] = explode(',',$data['bestKills']);
            	$topPlayers['bestRecon'] = explode(',',$data['bestRecon']);
            	$topPlayers['jetcrew'] = explode(',',$data['jetcrew']);
            	$topPlayers['awardscore'] = explode(',',$data['awardscore']);
            	$topPlayers['support'] = explode(',',$data['support']);
            	$topPlayers['assault'] = explode(',',$data['assault']);
            	$topPlayers['engineer'] = explode(',',$data['engineer']);
            	$topPlayers['accuracy'] = explode(',',$data['accuracy']);
            	$topPlayers['helicrew'] = explode(',',$data['helicrew']);
            	$topPlayers['vehiclecrew'] = explode(',',$data['vehiclecrew']);
            
            
            $playersTeam[1] = isArray(json_decode($data['playersTeam1'],true));
            $playersTeam[2] = isArray(json_decode($data['playersTeam2'],true));
            $playersTeam[3] = isArray(json_decode($data['playersTeam3'],true));
            $playersTeam[4] = isArray(json_decode($data['playersTeam4'],true));
            
            

            if ($data['mapMode'] == 8){
             $playersTeam = array_merge($playersTeam[1],$playersTeam[2],$playersTeam[3],$playersTeam[4]);
           }else{
           	 $playersTeam = array_merge($playersTeam[1],$playersTeam[2]);
           }
                    $i=0;
                    foreach ($playersTeam as $key => $players){
                              $i++;
             	                 $player[$players['username']] = $players['gravatarMd5'];
                            }
            $i=0;
            foreach ($topPlayers as $key => $top){
            	if (count($topPlayers[$key]) > 1){
               ++$i;
                 echo '<div style="width:200px;height:70px;float:left;">
                          <span class="DIVtext" style="font-size:12px;float:left;margin-left:5px;">'.constant('LANG_BATTLEREPORT_DETAILS_'.$key).'</span><br/>
                          <div style="width:55px;height:55px;float:left;margin-left:5px;">';
                             if (array_key_exists($top[0],$player)){
                              $grav = $player[$top[0]];
                            }else{
                            	$grav = "";
                            }
                              echo '<img style="border: 3px solid <?php echo $border; ?>;-moz-border-radius:5px 5px 5px 5px;-webkit-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px;float:left;" src="http://www.gravatar.com/avatar/'.$grav.'?s=52&d=http%3A%2F%2Fbattlelog-cdn.battlefield.com%2Fpublic%2Fbase%2Fshared%2Fdefault-avatar-52.png%3Fv%3D7909" />
                          </div>
                          <div style="width:135px;height:55px;float:left;margin-left:5px;text-align:left;"><a href="http://battlelog.battlefield.com/bf3/user/'.rawurlencode($top[0]).'/" target="_blank"><b>'.TRIMUSERS($top[0]).'</b></a><br />'.constant('LANG_BATTLEREPORT_DETAILS1_'.$key).'<br /><span style="font-size:12px">'.$top[1].'</span>
                          </div>
                       </div>';
              }
            }

            ?>
          </td>
              <tr>
         	   <td class="result" style="width:100%"><span class="DIVtext" style="float:left;margin-left:5px;font-size:15px;" colspan="20"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_HEAD_PLAYERS; ?></span><br /><br />
         	   	<div style="width:395px;float:left;margin-left:10px;">
         	   		<span class="DIVtext" style="float:left;font-size:12px;" colspan="20"><?php echo $team1; ?></span><br>
         	   		<div class="phead" style="width:35px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLACE; ?></div>
         	      <div class="phead" style="width:19px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_SQ; ?></div>
         	      <div class="phead" style="width:194px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLAYERS; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_K; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_D; ?></div>
         	      <div class="phead" style="width:30px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_KD; ?></div>
         	      <div class="pheadL" style="width:50px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_POINTS; ?></div>
         	     <br />
         	     <?php
         	     $i=0;
         	      foreach (isArray(json_decode($data['playersTeam1'],true)) as $players){
         	     		++$i;
         	     	if ($players['username'] == $iPlayer){
         	     		$pbody = "pbody_own";
         	     		$pbodyL = "pbodyL_own";
         	     	}elseif (in_array($players['username'],$aPlayer)){
         	       	$pbody = "pbody_member";
         	     		$pbodyL = "pbodyL_member";
         	     	}else{
         	     		$pbody = "pbody";
         	     		$pbodyL = "pbodyL";
         	     	}
         	     	
         	     	 	if ($data['mapMode'] == 8){
         	     		$sq = "1";
         	     	}else{
         	     		$sq = $EoT->SQUAD($players['squadId']);
         	     	}
         	     
         	      echo '
         	      <div class="'.$pbody.'" style="width:35px;float:left;"><span style="float:left;margin: 5px 0 0 10px;">'.$i.'</span></div>
         	      <div class="'.$pbody.'" style="width:19px;float:left;"><img src="'.$domain.'/img/gameserver/sq/'.$sq.'.png" style="margin-top:4px;" /></div>
         	      <div class="'.$pbody.'" style="width:194px;float:left;">
         	           <span style="float:left;margin-left: 2px;">
         	              <img style="border:1px solid #008FC4;-moz-border-radius:4px 4px 4px 4px;-webkit-border-radius:4px 4px 4px 4px; border-radius:4px 4px 4px 4px;" src="http://www.gravatar.com/avatar/'.$players['gravatarMd5'].'?s=22&d=http%3A%2F%2Fbattlelog-cdn.battlefield.com%2Fpublic%2Fbase%2Fshared%2Fdefault-avatar-22.png%3Fv%3D7909" />&nbsp;
         	              <img src="'.$domain.'/img/rank/P0'.$players['rank'].'.png" />
         	            </span>
         	           <span style="float:left;margin-top:4px;margin-left:3px;"><a href="http://battlelog.battlefield.com/bf3/user/'.rawurlencode($players['username']).'/" target="_blank"><b>'.TRIMUSERS($players['username']).'</b></a></span></div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['kills'].'</div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['deaths'].'</div>
         	      <div class="'.$pbody.'" style="width:30px;float:left;">'.$EoT->kd($players['kills'],$players['deaths']).'</div>
         	      <div class="'.$pbodyL.'" style="width:50px;float:left;">'.$players['combatScore'].'</div>
         	     <br />';
         	    }
         	    ?>
         	      </div>   
         <div style="width:395px;float:left;margin-left:10px;">
         	    	<span class="DIVtext" style="float:left;font-size:12px;" colspan="20"><?php echo $team2; ?></span><br>
         	   		<div class="phead" style="width:35px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLACE; ?></div>
         	      <div class="phead" style="width:19px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_SQ; ?></div>
         	      <div class="phead" style="width:194px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLAYERS; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_K; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_D; ?></div>
         	      <div class="phead" style="width:30px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_KD; ?></div>
         	      <div class="pheadL" style="width:50px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_POINTS; ?></div>
         	     <br />
         	      <?php
         	     $i=0;
         	      foreach (isArray(json_decode($data['playersTeam2'],true)) as $players){
         	     		++$i;
         	     	if ($players['username'] == $iPlayer){
         	     		$pbody = "pbody_own";
         	     		$pbodyL = "pbodyL_own";
         	     	}elseif (in_array($players['username'],$aPlayer)){
         	       	$pbody = "pbody_member";
         	     		$pbodyL = "pbodyL_member";
         	     	}else{
         	     		$pbody = "pbody";
         	     		$pbodyL = "pbodyL";
         	     	}
         	     	 	if ($data['mapMode'] == 8){
         	     		$sq = "2";
         	     	}else{
         	     		$sq = $EoT->SQUAD($players['squadId']);
         	     	}
         	       echo '
         	      <div class="'.$pbody.'" style="width:35px;float:left;"><span style="float:left;margin: 5px 0 0 10px;">'.$i.'</span></div>
         	      <div class="'.$pbody.'" style="width:19px;float:left;"><img src="'.$domain.'/img/gameserver/sq/'.$sq.'.png" style="margin-top:4px;" /></div>
         	      <div class="'.$pbody.'" style="width:194px;float:left;">
         	           <span style="float:left;margin-left: 2px;">
         	              <img style="border:1px solid #008FC4;-moz-border-radius:4px 4px 4px 4px;-webkit-border-radius:4px 4px 4px 4px; border-radius:4px 4px 4px 4px;" src="http://www.gravatar.com/avatar/'.$players['gravatarMd5'].'?s=22&d=http%3A%2F%2Fbattlelog-cdn.battlefield.com%2Fpublic%2Fbase%2Fshared%2Fdefault-avatar-22.png%3Fv%3D7909" />&nbsp;
         	              <img src="'.$domain.'/img/rank/P0'.$players['rank'].'.png" />
         	            </span>
         	           <span style="float:left;margin-top:4px;margin-left:3px;"><a href="http://battlelog.battlefield.com/bf3/user/'.rawurlencode($players['username']).'/" target="_blank"><b>'.TRIMUSERS($players['username']).'</b></a></span></div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['kills'].'</div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['deaths'].'</div>
         	      <div class="'.$pbody.'" style="width:30px;float:left;">'.$EoT->kd($players['kills'],$players['deaths']).'</div>
         	      <div class="'.$pbodyL.'" style="width:50px;float:left;">'.$players['combatScore'].'</div>
         	     <br />';
         	    }
         	 echo'</td></div>';
         	    
               if ($data['mapMode'] == 8){ ?>
         <tr>
          <td style="width:100%">
         	    	<div style="width:395px;float:left;margin-left:10px;margin-top:10px;">
         	   		<span class="DIVtext" style="float:left;font-size:12px;" colspan="20"><?php echo $team3; ?></span><br>
         	   		<div class="phead" style="width:35px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLACE; ?></div>
         	      <div class="phead" style="width:19px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_SQ; ?></div>
         	      <div class="phead" style="width:194px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLAYERS; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_K; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_D; ?></div>
         	      <div class="phead" style="width:30px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_KD; ?></div>
         	      <div class="pheadL" style="width:50px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_POINTS; ?></div>
         	     <br />
         	     <?php
         	     $i=0;
         	     foreach (isArray(json_decode($data['playersTeam3'],true)) as $players){
         	     	++$i;
         	   	if ($players['username'] == $iPlayer){
         	     		$pbody = "pbody_own";
         	     		$pbodyL = "pbodyL_own";
         	     	}elseif (in_array($players['username'],$aPlayer)){
         	       	$pbody = "pbody_member";
         	     		$pbodyL = "pbodyL_member";
         	     	}else{
         	     		$pbody = "pbody";
         	     		$pbodyL = "pbodyL";
         	     	}
         	     	
         	     	
         	      echo '
         	      <div class="'.$pbody.'" style="width:35px;float:left;"><span style="float:left;margin: 5px 0 0 10px;">'.$i.'</span></div>
         	      <div class="'.$pbody.'" style="width:19px;float:left;"><img src="'.$domain.'/img/gameserver/sq/3.png" style="margin-top:4px;" /></div>
         	      <div class="'.$pbody.'" style="width:194px;float:left;">
         	           <span style="float:left;margin-left: 2px;">
         	              <img style="border:1px solid #008FC4;-moz-border-radius:4px 4px 4px 4px;-webkit-border-radius:4px 4px 4px 4px; border-radius:4px 4px 4px 4px;" src="http://www.gravatar.com/avatar/'.$players['gravatarMd5'].'?s=22&d=http%3A%2F%2Fbattlelog-cdn.battlefield.com%2Fpublic%2Fbase%2Fshared%2Fdefault-avatar-22.png%3Fv%3D7909" />&nbsp;
         	              <img src="'.$domain.'/img/rank/P0'.$players['rank'].'.png" />
         	            </span>
         	           <span style="float:left;margin-top:4px;margin-left:3px;"><a href="http://battlelog.battlefield.com/bf3/user/'.rawurlencode($players['username']).'/" target="_blank"><b>'.TRIMUSERS($players['username']).'</b></a></span></div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['kills'].'</div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['deaths'].'</div>
         	      <div class="'.$pbody.'" style="width:30px;float:left;">'.$EoT->kd($players['kills'],$players['deaths']).'</div>
         	      <div class="'.$pbodyL.'" style="width:50px;float:left;">'.$players['combatScore'].'</div>
         	     <br />';
         	    }
         	    ?>
         	    </div>
         	
         	    
         	    <div style="width:395px;float:left;margin-left:10px;margin-top:10px;">
         	    	<span class="DIVtext" style="float:left;font-size:12px;" colspan="20"><?php echo $team4; ?></span><br>
         	   		<div class="phead" style="width:35px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLACE; ?></div>
         	      <div class="phead" style="width:19px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_SQ; ?></div>
         	      <div class="phead" style="width:194px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_PLAYERS; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_K; ?></div>
         	      <div class="phead" style="width:28px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_D; ?></div>
         	      <div class="phead" style="width:30px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_KD; ?></div>
         	      <div class="pheadL" style="width:50px;float:left;"><?php echo LANG_BATTLEREPORT_DETAILS_LIST_POINTS; ?></div>
         	     <br />
         	      <?php
         	     $i=0;
         	     foreach (isArray(json_decode($data['playersTeam4'],true)) as $players){
         	     		++$i;
         	     		if ($players['username'] == $iPlayer){
         	     		$pbody = "pbody_own";
         	     		$pbodyL = "pbodyL_own";
         	     	}elseif (in_array($players['username'],$aPlayer)){
         	       	$pbody = "pbody_member";
         	     		$pbodyL = "pbodyL_member";
         	     	}else{
         	     		$pbody = "pbody";
         	     		$pbodyL = "pbodyL";
         	     	}
         	       echo '
         	      <div class="'.$pbody.'" style="width:35px;float:left;"><span style="float:left;margin: 5px 0 0 10px;">'.$i.'</span></div>
         	      <div class="'.$pbody.'" style="width:19px;float:left;"><img src="'.$domain.'/img/gameserver/sq/4.png" style="margin-top:4px;" /></div>
         	      <div class="'.$pbody.'" style="width:194px;float:left;">
         	           <span style="float:left;margin-left: 2px;">
         	              <img style="border:1px solid #008FC4;-moz-border-radius:4px 4px 4px 4px;-webkit-border-radius:4px 4px 4px 4px; border-radius:4px 4px 4px 4px;" src="http://www.gravatar.com/avatar/'.$players['gravatarMd5'].'?s=22&d=http%3A%2F%2Fbattlelog-cdn.battlefield.com%2Fpublic%2Fbase%2Fshared%2Fdefault-avatar-22.png%3Fv%3D7909" />&nbsp;
         	              <img src="'.$domain.'/img/rank/P0'.$players['rank'].'.png" />
         	            </span>
         	           <span style="float:left;margin-top:4px;margin-left:3px;"><a href="http://battlelog.battlefield.com/bf3/user/'.rawurlencode($players['username']).'/" target="_blank"><b>'.TRIMUSERS($players['username']).'</b></a></span></div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['kills'].'</div>
         	      <div class="'.$pbody.'" style="width:28px;float:left;">'.$players['deaths'].'</div>
         	      <div class="'.$pbody.'" style="width:30px;float:left;">'.$EoT->kd($players['kills'],$players['deaths']).'</div>
         	      <div class="'.$pbodyL.'" style="width:50px;float:left;">'.$players['combatScore'].'</div>
         	     <br />';
         	    }         	     
         	    echo '</td></div>'; 
         	  }        	    
         	    ?>

         	   	</td>
         	     <tr> 	
         	   <td class="result">
         	   	<?php 
         	if ($data['intData'] == "null"){
         	   	echo '<div class="rankDIV" style="width:794px;height:50px;margin-left:10px;margin-top:10px;margin-bottom:10px;font-size:20px;"><div class="DIVtext" style="margin-top:20px;">'.LANG_BATTLEREPORT_DETAILS_ERROR.'</div></div>';
         	 }else{
         	   	$fromRank = $data['pointsNeededNext']-$data['pointsNeededcurr'];
         	   	$progress = $data['rankSpanPreviousScore']*100/$fromRank;
         	   	$progress2 = $data['rankSpanIncrementScore']*100/$fromRank;
         	   	      $i=0;
                    foreach ($playersTeam as $key => $players){
                              $i++;
             	                 $player[$players['username']] = $players['rank'];
                            }
                     $i=0;
                    foreach ($playersTeam as $key => $players){
                              $i++;
             	                 $Scoreplayer[$players['username']] = $players['combatScore'];
                            } 
                            
              
               $int = json_decode($data['intData'],true); 

                if (arrayKey('c___k_g',$int) > 0 && arrayKey('c___d_g',$int) > 0){
                 	$KD = $EoT->kd($int['c___k_g'],$int['c___d_g']);
                }else{
                	$KD = $EoT->kd('0','1');
                }
                
                if (arrayKey('c___shw_g',$int) > 0 && arrayKey('c___sfw_g',$int) > 0){
                  $ac = number_format($int['c___shw_g']*100/$int['c___sfw_g'], 2, ',', ' ');
                }else{
                	$ac = '0,00';
                }
                
                if (arrayKey('score',$int) > 0 && $data['duration'] > 0){
                  $spm = number_format(($int['score']/($data['duration']/60)), 2, ',', ' ');
                }else{
                	$spm = '0,00';
                }
                
                 $time_on_map = arrayKeyT('c___sa_g',$int)
         	   	?>
         	   		<span class="DIVtext" style="float:left;margin-left:5px;font-size:15px;margin-top:10px;" colspan="20"><?php echo $data['soldiername'].LANG_BATTLEREPORT_DETAILS_BEST_PROGRESS; ?></span><br /><br />
         	   	  <div class="rankDIV" style="width:390px;float:left;margin-left:10px;margin-top:10px;"> 
         	   	  	
         	   	  	<div style="width:80px;height:100px;float:left;margin-left:10px;"><img src="<?php echo $domain; ?>/img/rank/big/P0<?php echo $player[$data['soldiername']]; ?>.png" width="80px" /></div>
         	   	  	<div class="progressbar" style="margin-left:5px;margin-top:40px;">
									        <div class="progressbar-oldxp" style="width:<?php echo $progress; ?>%"></div>
									        <div class="progressbar-newxp" style="width:<?php echo $progress2; ?>%"></div>
									        <?php
									        if ($player[$data['soldiername']] >= 145){
									        	$rankname = $EoT->rankname($player[$data['soldiername']]);
									        	$rankimg  = $player[$data['soldiername']];
									        }else{ 
									          $rankname  = $EoT->rankname($player[$data['soldiername']]+1);
									          $rankimg  = $player[$data['soldiername']]+1;
									        }
									        ?>
									        <div style="margin-top:15px;font-size:12px;"><?php echo $rankname; ?><br />+<?php echo $data['rankSpanIncrementScore']; ?></div>
									</div>
									        <div style="width:80px;height:100px;float:left;"><img src="<?php echo $domain; ?>/img/rank/big/P0<?php echo $rankimg; ?>.png" width="80px" /></div>  
                </div>
                
                
                <div class="rankDIV" style="width:190px;float:left;height:247px;margin-left:10px;margin-top:10px;">
                	<span class="DIVtext" style="float:left;margin-left:5px;font-size:12px;margin-top:10px;" colspan="20"><?php echo LANG_BATTLEREPORT_DETAILS_BEST_STATS; ?></span><br /><br />
                	<span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO0; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo $EoT->time_m($time_on_map); ?></span><br />
                	<span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO1; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo $data['elo']; ?></span><br />
                	<span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO2; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('c___k_g',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO3; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('c___d_g',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO4; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo $KD; ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO5; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('c___ka_g',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO6; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('c_vA__de_g',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO7; ?></span><span class="DIVtext" style="float:right;margin-right:2px;">--</span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO24; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('c___sfw_g',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO25; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('c___shw_g',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO8; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo $ac ?>%</span><br />
                  <span style="float:left;margin-left:2px;"><?php echo LANG_BATTLEREPORT_INFO23; ?></span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo arrayKey('rank',$int); ?></span><br />
                  <span style="float:left;margin-left:2px;">pPm</span><span class="DIVtext" style="float:right;margin-right:2px;"><?php echo $spm; ?></span><br />
                </div>
                <div class="rankDIV" style="width:190px;float:left;height:247px;margin-left:10px;margin-top:10px;">
                	<span class="DIVtext" style="float:left;margin-left:5px;font-size:12px;margin-top:10px;" colspan="20"><?php echo LANG_BATTLEREPORT_DETAILS_BEST_POINTS; ?></span><br /><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO9; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_award',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO10; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_squad',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO11; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_team',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO12; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_objective',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO13; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_general',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO14; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_unlocks',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO15; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_assault',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO16; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_engineer',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO17; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_support',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO18; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_recon',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO19; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_vehiclembt',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO20; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('sc_bonus',$int); ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO21; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo $Scoreplayer[$data['soldiername']]; ?></span><br />
                	<span style="float:left;margin-left:2px"><?php echo LANG_BATTLEREPORT_INFO22; ?></span><span class="DIVtext" style="float:right;margin-right:2px"><?php echo arrayKey('score',$int); ?></span><br />
                </div>
                
                
                <br />
                <br />
                
                <div class="rankDIV" style="width:190px;height:130px;margin-left:10px;margin-top:100px;">
                	<div style="float:left;position:absolute;margin-left:30px;">
                		<span class="DIVtext" style="float:left;font-size:12px;margin-top:10px;" colspan="20"><?php echo LANG_BATTLEREPORT_DETAILS_BEST_WEAPON; ?></span><br /><br />
                	<?php
                	$kititems = array("waeM67","seqRad","wasDef","waeC4","seqUGS","waeMine","waeClay","seqEOD","seqSOF","waeMort","seqMAV","wasRT");
                	$bestWeapon = explode(',',$data['topWeapon']);
                	if (is_array($bestWeapon) && count($bestWeapon) > 1 && $bestWeapon[0] != ""){
                	$weapon = $EoT->WEAPON($bestWeapon[0]);
                	if (in_array($weapon,$kititems)){
                		$text = 'LANG_EQUIPMENT_';
                		$folder = 'kititems';
                	}else{
                		$text = 'LANG_WEAPONS_';
                	  $folder = 'weapons';
                }
                	echo '<a class="tooltip"><img src="'.$domain.'/img/'.$folder.'/'.$weapon.'.png" width="120px"/>
                	      <span style="width:250px;margin-left:-60px;">'.constant($text.'TEXT_'.$weapon).'
                      	</span></a>
                	      <br /><b>'.constant($text.$weapon).'</b><br />';
                	echo LANG_BATTLEREPORT_DETAILS1_bestKills.': '.$bestWeapon[1];
                }else{
                	echo LANG_BATTLEREPORT_DETAILS_BEST_WEAPON_NO;
                }
                	echo '</div>';
                	?>
               </div>
               
                
                	<div class="rankDIV" style="width:190px;height:130px;margin-left:210px;margin-top:-131px;position: absolute;">
                	<div style="float:left;position:absolute;margin-left:30px;">
                		<span class="DIVtext" style="float:left;font-size:12px;margin-top:10px;" colspan="20"><?php echo LANG_BATTLEREPORT_DETAILS_BEST_VEHICLE; ?></span><br /><br />
                	<?php
                	$bestVehicle = explode(',',$data['topVehicle']);
                	if (is_array($bestVehicle) && count($bestVehicle) > 1 && $bestVehicle[0] != ""){
                	$vehicle = $EoT->VEHICLE($bestVehicle[0]);
                	echo '<a class="tooltip"><img src="'.$domain.'/img/vehicles/'.$vehicle.'.png" width="120px"/>
                	       <span style="width:250px;margin-left:-60px;">'.constant('LANG_VEHICLES_TEXT_'.$vehicle).'
                      	 </span></a>
                	       <br /><b>'.constant('LANG_VEHICLES_'.$vehicle).'</b><br />';
                	echo LANG_BATTLEREPORT_DETAILS1_bestKills.': '.$bestVehicle[1];
                }else{
                	echo LANG_BATTLEREPORT_DETAILS_BEST_VEHICLE_NO;
                }
                	echo '</div>';
                	?>
               </div>
             </td>

               
              
    <?php if (isset($weapon)) { ?>
               <tr>
              	<td>
              		<div style="width:810px;height:100%;margin-top:10px;margin-bottom:10px;">
                	
          <?php
               $for = array("arAK74","wahUGL","arM416","wahUSG","arAEK","arM16","arAN94","arF2","arG3","arKH","srM40","srM98","srMK11","srSKS","srSV98","srSVD","mgM240","mgM249","mgM27","mgM60","mgPech","mgRPK",
                            "mgT88","caA91","caAKS","caG36","caM4","caSCAR","caSG553","srM39","wLAAFIM","wLAAIGL","wLATJAV","wLATRPG","wLATSMAW","pG17S","pG17","pg18S","pg18","pM1911L","pM1911","pM1911S","pM1911T",
                            "pM412","pM9F","pM9S","pM9","pM93R","pMP443L","pMP443S","pMP443","pTaurS","pTaur","sg870","sgDAO","sgM1014","sgSaiga","sgUSAS","smMP7","smP90","smPDR","smPP2000","smUMP","smVAL","wasK",
                            "arFAMAS","arL85A2","caHK53","caQBZ95B","mgQBB95","mgMG36","srQBU88","srL96","smPP19","sgJackH","waeM67","seqRad","wasDef","waeC4","seqUGS","waeMine","waeClay","seqEOD","seqSOF","waeMort","seqMAV","repairtool","arAUG","arSCARL","mgL86A1","mgLSAT","caACR","caMTAR21","srHK417","srJNG90","sgSPAS12","smM5K"
                           );
         
                     if ($weapon == "arM16A4_2"){
              		     $weapon = "arM16";
              		   }else{
              		   	 $weapon = $weapon;
              		   }
              
              $i = 0;
              foreach ($for as $v){
              	if (array_key_exists('c_'.$v.'__kwa_g',$int)){ 
              		if ($v != $weapon){
              				++$i;
              				 if ($i == 1) echo   '<span class="DIVtext" style="float:left;margin-left:5px;font-size:12px;margin-top:10px;margin-left:10px;" colspan="20">'.LANG_BATTLEREPORT_DETAILS_MORE_WEAPONS.'</span><br /><br />';  
              			  if (in_array($v,$kititems))
              			  {
                		   $text = 'LANG_EQUIPMENT_';
                		   $folder = 'kititems';
                	    }else{
                		   $text = 'LANG_WEAPONS_';
                	     $folder = 'weapons';
                      }
              		echo '<div class="rankDIV" style="height:70px;width:190px;float:left;margin-left:10px;"><b>'.constant($text.$v).'</b> (Kills '. $int['c_'.$v.'__kwa_g'].')<br /><a class="tooltip" ><img src="'.$domain.'/img/'.$folder.'/'.$v.'.png" width="100px"/>
                	      <span style="width:250px;margin-left:-40px;">'.constant($text.'TEXT_'.$v).'
                      	</span></a></div>
                	      ';
                	   if ($i % 4 == 0) echo '<br /><br /><br /><br /><br /><br />';               		
              	  }
                }             	
              }
             echo '</div></td>';
         }      
 #print_r($int);
               
              $aAwards['awards'] = json_decode($data['awards'],true);
            	$aAwards['gadgets'] = json_decode($data['uGadgets'],true);
            	$aAwards['uSoldierspecializations'] = json_decode($data['uSoldierspecializations'],true);
            	$aAwards['uVehiclespecs'] = json_decode($data['uVehiclespecs'],true);
            	$aAwards['uWeapons'] = json_decode($data['uWeapons'],true);
              $aAwards['waddons'] = json_decode($data['uWeaponaddons'],true);

             
               ?>
             <tr>
              <td>
               <div class="rankDIV" style="width:794px;height:100px;margin-left:10px;margin-top:10px;margin-bottom:10px;">
                	<span class="DIVtext" style="float:left;margin-left:5px;font-size:12px;margin-top:10px;" colspan="20"><?php echo LANG_BATTLEREPORT_DETAILS_AWARDS_AWARDED; ?></span><br />
                  <div id="gallery_container3">	
		          <div id="thumb_container3">			
			         <div id="thumbs3">
			         	<?php
			         	$ia=0;
			         	$ib=0;	
                  if (is_array($aAwards['awards']) && count($aAwards['awards']) > 0)                  
                   foreach ($aAwards['awards'] as $key => $awards){  
                  	++$ia;
                  	 if ($awards['group'] == 'AwardGroup_Ribbons'){
                  	 	 $folder = 'ribbons';
                  	 	 $width = 'width="141px" height="52px"';
                  	 	    $aW = $awards['name'];
                  	 	 if ($aW == ""){
                  	 	 	$aW = "unknown";
                  	 	}  	
                  	 	 $text = constant('LANG_RIBBONS_TEXT_'.$aW);
                  	 	 $count = "";
                  	 	  if ($aW != "unknown"){
                  	 	    $count = '<div style="position:absolute;margin-left:94px;margin-top:-18px;background-color:#000;width:45px;opacity:0.80;filter: alpha(opacity=80);-moz-opacity: 0.8;">'.$int[$awards['name'].'_00'].'x</div>';
                  	      $ib += $int[$awards['name'].'_00']-1;
                  	    }
                  	   $img = $awards['name'];
                  	 }elseif ($awards['group'] == 'AwardGroup_Medals'){
                  	 	 $folder = 'medals';
                  	 	 $width = 'width="52px" height="52px"';
                  	 	   $aW = $awards['name'];
                  	 	 if ($aW == ""){
                  	 	 	$aW = "unknown";
                  	 	}  
                  	 	 $text = constant('LANG_MEDALS_TEXT_'.$aW);
                  	 	 $count = "";
                  	 	 $img = $awards['name'];
                  	 }elseif ($awards['group'] == 'AwardGroup_Mission'){
                  	 	 $folder = 'assignmens';
                  	 	 $width = 'width="141px" height="52px"';
                  	 	   $aW = $awards['unlockId'];
                  	 	 if ($aW == ""){
                  	 	 	$aW = "unknown";
                  	 	}  
                  	 	 $text = constant('LANG_ASSIGNMENTS_'.$aW);
                  	 	 $count = "";  
                  	 	 $img = $awards['unlockId'];
                  	 }elseif ($awards['group'] == 'AwardGroup_Star' && array_key_exists('unlockId',$awards) && $awards['unlockId'] == 'ssclbe' OR $awards['unlockId'] == 'ssclbas' OR $awards['unlockId'] == 'ssclbsu'){
                  	 	 $folder = 'stars';
                  	 	 $width = 'width="52px" height="52px"';
                  	 	 $text = constant('LANG_GENERAL_SERVICE_STAR_'.$awards['unlockId']).' (<font class="DIVtext">'.$int[$awards['unlockId'].'_00_a'].'</font>)<br /><img src="'.$domain.'/img/stars/'.$awards['unlockId'].'.png" style="border:0;" />';
                  	 	 $count = "";  
                  	 	 $img = $awards['name'];
                  	 }else{
                  	 	 $folder = 'stars';
                  	 	 $width = 'width="52px" height="52px"';
                  	 	  if (array_key_exists('unlockId',$awards)){
                  	 	    $constant = substr($awards['unlockId'], 4);
                  	 	      if ($constant == "bvmbt" OR $constant == "bvjet" OR $constant == "bvah" OR $constant == "bvaa" OR $constant == "bvsh" OR $constant == "bvifv"){
                  	 	        $text = constant('LANG_GENERAL_SERVICE_STAR_'.$constant).'<br />SERVICESTAR';
                  	 	       }else{
                  	 	        $text = constant('LANG_WEAPONS_'.$constant).'<br />SERVICESTAR '.$int[$awards['unlockId'].'_00_a'].'<br /> '.($int[$awards['unlockId'].'_00_a']*100).' Kills';
                  	 	       } 
                  	 	        $img = $awards['name'];
                  	     }else{
                  	 	     $text = 'SERVICESTAR';
                  	 	     $img = $awards['name'];
                  	     }
                  	 	 $count = "";
                  	 }
                  	 
                  	
                       ?>
                      <div class="thumbnail">
                      <a class="tooltip" rel="lightbox[galerie]"><img style="border:0" src="<?php echo $domain; ?>/img/<?php echo $folder; ?>/<?php echo $img; ?>.png" <?php echo $width; ?> /><?php echo $count; ?>
                      	<span style="width:130px;margin-left:0px;"><?php echo $text; ?>
                      	</span>
                      </a>
                     </div>
					          <?php	
					        }	
					      $ig=0;
					       if (is_array($aAwards['gadgets']) && count($aAwards['gadgets']) > 0)					       
                 foreach ($aAwards['gadgets'] as $key => $awards){  
                 	$gadget = $EoT->WEAPON($awards['name']);
                  	++$ig;      	
                       ?>
                      <div class="thumbnail">
                      <a class="tooltip" rel="lightbox[galerie]"><img style="border:0" src="<?php echo $domain; ?>/img/kititems/<?php echo $gadget; ?>.png" width="135px" height="52px" />
                      	<span style="width:130px;margin-left:0px;"><?php echo constant('LANG_EQUIPMENT_'.$gadget); ?><br /><?php echo WEAPONSTEXT(constant('LANG_EQUIPMENT_TEXT_'.$gadget)); ?>
                      	</span>
                      	</a>
                     </div>
					          <?php		
					       }	
					       $iw=0;
					       if (is_array($aAwards['waddons']) && count($aAwards['waddons']) > 0)
                           foreach ($aAwards['waddons'] as $key => $awards){
                           	  if (array_key_exists('name',$awards) && $awards['name'] != ""){
                           	  	  $uW = $awards['name'];
                           	  	if (array_key_exists('weapon',$awards)){
                           	  		$uW = $awards['weapon'];
                           	  	 }
                           	  	 
                 	 	           $wa = LANG_WEAPONS_UNLOCKS_FOR.constant('LANG_WEAPONS_'.$EoT->WEAPON($uW));
                 	 	           $aName = constant('LANG_WEAPONS_UNLOCKS_'.$awards['name']);
                 	 	           $iIMG = $awards['name'];
                 	           }else{
                 	 	           $wa = "";
                 	 	           $aName = "";
                 	 	           $iIMG = "unknown";
                 	           }
                           	++$iw;       	
                       ?>
                      <div class="thumbnail">
                      <a class="tooltip" rel="lightbox[galerie]"><img style="border:0" src="<?php echo $domain; ?>/img/weapons/weaponunlocks/battlereport/<?php echo $iIMG; ?>.png" width="141px" height="52px" />
                      	<span style="width:130px;margin-left:0px;"><?php echo $aName; ?><br /><?php echo $wa; ?>
                      	</span>
                      	</a>
                     </div>
					          <?php		 
					    } 
					     $is=0;
					        if (is_array($aAwards['uSoldierspecializations']) && count($aAwards['uSoldierspecializations']) > 0)  
                           foreach ($aAwards['uSoldierspecializations'] as $key => $awards){  
                           	++$is;      	
                       ?>
                      <div class="thumbnail">
                      <a class="tooltip" rel="lightbox[galerie]"><img style="border:0" src="<?php echo $domain; ?>/img/specializations/<?php echo $awards['name']; ?>.png" width="87px" height="52px" />
                      <span style="width:130px;margin-left:0px;"><?php echo constant('LANG_SPECIALIZATIONS_REPORT_'.$awards['name']); ?>
                      </span>
                      </a>
                     </div>
					          <?php		 
					    } 
					      $iv=0;
					        if (is_array($aAwards['uVehiclespecs']) && count($aAwards['uVehiclespecs']) > 0) 
                           foreach ($aAwards['uVehiclespecs'] as $key => $awards){  
                           	++$iv;      	
                       ?>
                      <div class="thumbnail">
                      <a class="tooltip" rel="lightbox[galerie]"><img style="border:0" src="<?php echo $domain; ?>/img/vehicles/unlocks/<?php echo $awards['name']; ?>.png" width="87px" height="52px" />
                      	  <span style="width:130px;margin-left:0px;"><?php echo WEAPONSTEXT(constant('LANG_VEHICLES_UNLOCKS_TEXT_'.$awards['name'])); ?>
                      </span>          
                      </a>
                     </div>
					          <?php		 
					    } 
					      $iuw=0;
					        if (is_array($aAwards['uWeapons']) && count($aAwards['uWeapons']) > 0)
                        foreach ($aAwards['uWeapons'] as $key => $awards){                           	
                           	++$iuw; 
                           $weapon = $EoT->WEAPON($awards['name']);
                           if (in_array($weapon,$kititems)){
                		        $text = 'LANG_EQUIPMENT_';
                		        $folder = 'kititems';
                	         }else{
                		        $text = 'LANG_WEAPONS_';
                	          $folder = 'weapons';
                           }
                                 	
                       ?>
                      <div class="thumbnail">
                      <a class="tooltip" rel="lightbox[galerie]"><img style="border:0" src="<?php echo $domain; ?>/img/<?php echo $folder; ?>/<?php echo $weapon; ?>.png" width="87px" height="52px" />
                      	<span style="width:130px;margin-left:0px;"><b><?php echo constant($text.$weapon); ?></b><br /><?php echo WEAPONSTEXT(constant($text.'TEXT_'.$weapon)); ?>
                      	</span>
                      	</a>
                     </div>
					          <?php		 
					    } 
					   ?>
						   </div>
						   <br />
		          </div>
	           </div>
            </div>
                	<span class="DIVtext" style="float:left;margin-left:250px;font-size:12px;margin-top:-101px;">(<?php echo $ia+$ib+$ig+$iw+$is+$iv+$iuw; ?>)</span>
         	   </td>
     <?php
         }  
       } 
    }
       echo'</table>';
       
       
    function checkwinner($winner,$team){
    	if($team == $winner){
    		$border="#00FF00";
    	}else{
    		$border="#FF0000";
    	}   	
    	return $border;
    }  
    
     function TRIMUSERS ($name) {
      if(strlen($name) <= 14) {
          $result = htmlspecialchars($name);
        }else{
          $result = htmlspecialchars(substr($name,0,11) . '..'); 
        } 
     return $result;
  }  
  
  function WEAPONSTEXT($name) {
      if(strlen($name) <= 50) {
          $result = $name;
        }else{
          $result = substr($name,0,47) . '...'; 
        } 
     return $result;
  }  
  
  
  function arrayKey($data,$int){
    	if(array_key_exists($data,$int)){
    		$data=$int[$data];
    	}else{
    		$data="--";
    	}   	
    	return $data;
    } 
    
    
    function arrayKeyT($data,$int){
    	if(array_key_exists($data,$int)){
    		$data=$int[$data];
    	}else{
    		$data="0";
    	}   	
    	return $data;
    } 
    
    
    
    function isArray($array){
    	if (is_array($array)){
    		return $array;
    	}else{
    		$array = array();
    		return $array;
    	}    		
    }