else
			{
				echo $MSG_LANG["black"];
				$tmpFrom = "black";
				$ratingL = $tmpGame['ratingWhite'];
				$ratingW = $tmpGame['ratingBlack'];
			}

            if ($tmpGame['oficial'] == "1")
                $oficial = $MSG_LANG["official"];
            else $oficial = $MSG_LANG["notofficial"];

            echo "<td>".$oficial."</td>";

            if ($tmpGame['oficial'] == "1"){
               $xpw = getXPW($ratingW,$ratingL,getPV($id));
               $xpl = getXPL($ratingL,$ratingW,getPV($id));
            }else{
                $xpl=0;
                $xpw=0;
            }

			$dificuldade = getDifficult($_SESSION['playerID'],$id);
			
            echo "<td>$dificuldade</td>\n";
			echo "<td><i>+$xpw / -$xpl</i></td>\n";

            /* Response */
			echo ("</td><td align='center'>");
			echo ("<input type='button' value='".$MSG_LANG["accept"]."' onclick=\"sendResponse('accepted', '".$tmpFrom."', ".$tmpGame['gameID'].")\">");
			echo ("<input type='button' value='".$MSG_LANG["reject"]."' onclick=\"sendResponse('declined', '".$tmpFrom."', ".$tmpGame['gameID'].")\">");
function writePoints()
{
        global $MSG_LANG, $opponent, $_SESSION, $oficial, $MyRating, $OpponentRating, $MyPV, $OpponentPV;

        if ($oficial == "1")
        {
                    //$MyRealPV = ($MyPV+getPV($OpponentPV)/2;
                    //$OpponentRealPV = ($MyPV+getPV($OpponentPV))/2;
                    //$xpw = getXPW($MyRating,$OpponentRating,$OpponentRealPV);
                    //$xpl = getXPL($OpponentRating,$MyRating,$OpponentRealPV);


                $xpw = getXPW($MyRating,$OpponentRating,$OpponentPV);
                $xpl = getXPL($OpponentRating,$MyRating,$OpponentPV);
            }
            else
            {
                $xpl=0;
                $xpw=0;
            }


echo '     <table border="0" width="300" align="center" cellspacing=1 cellpadding=1 bgcolor=black>
        <tr bgcolor="beige">
            <th><font size=2>  ';
            echo $MSG_LANG["punctuation"];
            echo '
            </th>
<TR><td align="center" bgcolor="white"> ';

            if ($playersColor == "white")
            {
            echo ("".$MSG_LANG["ifwin"]." +$xpl, ".$MSG_LANG["iflose"]." -$xpw");
            }
            else
            {
            echo ("".$MSG_LANG["ifwin"]." +$xpw, ".$MSG_LANG["iflose"]." -$xpl");
            }
            echo "</td></tr></table>";
            return;
            }
				else
				{
					echo $MSG_LANG["black"];
					//$tmpFrom = "black";
					$ratingL = $tmpGame['ratingWhite'];
					$ratingW = $tmpGame['ratingBlack'];
				}

            	if ($tmpGame['oficial'] == "1")
	                $oficial = $MSG_LANG["official"];
    	        else $oficial = $MSG_LANG["notofficial"];

        	    echo "<td bgcolor=white>".$oficial."</td>";

            	if ($tmpGame['oficial'] == "1"){
               		$xpw = getXPW($ratingW,$ratingL,getPV($_SESSION['playerID']));
               		$xpl = getXPL($ratingL,$ratingW,getPV($id));
            	}else{
                	$xpl=0;
                	$xpw=0;
            	}

				$dificuldade = getDifficult($_SESSION['playerID'],$id);

		            	echo "<td bgcolor=white>$dificuldade</td>\n";
				echo "<td bgcolor=white><i>+$xpw / $xpl</i></td>\n";

				if ($tmpGame[timelimit] == 0)
					echo "<td bgcolor=white>$CFG_EXPIREGAME $MSG_LANG[unlimited]</td>\n";
				else if ($tmpGame[timelimit] <60)
					echo "<td bgcolor=white> <strong><font color=red>$MSG_LANG[min] $tmpGame[timelimit] min.</font></strong></td>\n";
            }

		elseif (getRating($row['playerID']) == 0 && !$isme)
 			{
			echo "<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["challengethisplayer"]."</td><td style='text-align:left'><input type='button' style='font-size:11' value='$MSG_LANG[challengethisplayer]' onClick=\"javascript:newuserchallenge(".$row['playerID'].")\">                 </td></td></tr>";				
            }				
		elseif (!$isme)
			{
			echo "<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["challengethisplayer"]."</td><td style='text-align:left'><input type='button' style='font-size:11' value='$MSG_LANG[challengethisplayer]' onClick=\"javascript:challenge(".$row['playerID'].")\">                 </td></td></tr>";
			}
		echo "<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["level"]."</td><td style='text-align:left'>".$nivel."</td></tr>";
		echo "<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["rating"]."/".$MSG_LANG["max"]."</td><td style='text-align:left'>$row[rating]/$row[rating_max] (<B>".$MSG_LANG["nextlevel"].":</b> ".getXPmax($nivel).")</td></tr>";

        if (!$isme){

            $xpw = getXPW(getRating($_SESSION['playerID']),$row['rating'],getPV($_SESSION['playerID']));
            $xpl = getXPL($row['rating'],getRating($_SESSION['playerID']),getPV($_GET['cod']));

            echo "<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["challengerate"]."</td><td style='text-align:left'>$dificuldade (<i>".$MSG_LANG["ifwin"].": +$xpw ".$MSG_LANG["iflose"].": -$xpl</i>)</td></tr>";
			echo "<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["lastseen"]."</td><td style='text-align:left' width=50%>".date("d/m/y H:i",$row[lastUpdate])."</td></tr>";
        }
		echo "<tr><td nowrap width='20%' style='text-align:left'><B>".$MSG_LANG["finishedgames"]."</td><td style='text-align:left'>$total</td></tr>
		<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["victories"]."</td><td style='text-align:left'>$vitorias ($PV%)</td></tr>
		<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["defeats"]."</td><td style='text-align:left'>$derrotas</td></tr>
		<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["draw"]."</td><td style='text-align:left'>$empates</td></tr>
		<tr><td width='20%' style='text-align:left'><B>".$MSG_LANG["activegames"]."</td><td style='text-align:left'><a href=games_user.php?cod=$player>$ativos games</a></td></tr>";
		if (mysql_num_rows($t2) >0)
		echo "<tr><td width='20%' style='text-align:left'><B>TEAM</td><td style='text-align:left'><a href='stats_team.php?cod=".$rt[fk_team]."'><b>".$teamName."</b></a></td></tr><br>";
		else 		
		echo "<tr><td width='20%' style='text-align:left'><B>TEAM</td><td style='text-align:left'><a href='teams.php'><b>".$MSG_LANG['chooseateamtojoin']."</b></a></td></tr><br>";