updated copyright for 2013
[e-DoKo.git] / include / output.php
index 79e42c276f130c879ee10f06deb9af6392b40b09..978edebd8536d742ff14d5fe40bd3af2fa47350c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
+/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arun Persaud <arun@nubati.net>
  *
  *   This file is part of e-DoKo.
  *
@@ -26,21 +26,38 @@ if(!isset($HOST))
 
 /* functions which only ouput html  */
 
+function autoversion($file)
+{
+  /* changes the file name of e.g. css/style.css to css/style.<md5>.css/js
+   * this way the browser can cache the file and will reload it if the file changed
+   * needs to have .htaccess set up correctly to link back to css/style.css */
+
+  /* only use it for file that have an absolut path */
+  if(!file_exists(dirname($_SERVER['SCRIPT_FILENAME']). '/' . $file))
+    return $file;
+
+  $md5 = md5_file(dirname($_SERVER['SCRIPT_FILENAME']). '/' . $file);
+  return preg_replace('{\\.([^./]+)$}', ".$md5.\$1", $file);
+}
+
+
 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
 {
   global $RULES;
 
   echo "<div class=\"message\">\n<form action=\"index.php?action=new\" method=\"post\">\n";
-  echo "Do you want to continue playing?(This will start a new game, with $playerA starting the game.)\n";
+  $output = sprintf(_('Do you want to continue playing? (This will start a new game, with %s starting the game.)'),$playerA);
+  echo $output."\n";
   echo "  <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
-  echo "  <input type=\"hidden\" name=\"dullen\"  value=\"".$RULES["dullen"]."\" />\n";
-  echo "  <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
-  echo "  <input type=\"hidden\" name=\"callrule\" value=\"".$RULES["call"]."\" />\n";
+  echo "  <input type=\"hidden\" name=\"dullen\"  value=\"".$RULES['dullen']."\" />\n";
+  echo "  <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES['schweinchen']."\" />\n";
+  echo "  <input type=\"hidden\" name=\"callrule\" value=\"".$RULES['call']."\" />\n";
+  echo "  <input type=\"hidden\" name=\"lowtrump\" value=\"".$RULES['lowtrump']."\" />\n";
   echo "  <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
-  echo "  <input type=\"submit\" value=\"keep playing\" />\n";
+  echo "  <input type=\"submit\" value=\""._('keep playing')."\" />\n";
   echo "</form>\n</div>";
   return;
 }
@@ -51,96 +68,124 @@ function output_form_for_new_game($names)
                         * after we selected them to make sure that each name
                         * only shows up once
                         */
-?>
-  <form action="index.php?action=new" method="post">
-    <h2> Select players (Remember: you need to be one of the players) </h2>
 
-   <div class="table">
-     <img class="table" src="pics/table.png" alt="table" />
-<?php
+  /* delete players name, since he will be on position D anyway */
+  unset($copy_names[array_search($_SESSION["name"],$copy_names)]);
+  srand((float) microtime() * 10000000);
 
-  /* ask player for names */
 
-  $i=0;
+  echo '  <form action="index.php?action=new" method="post">';
+  echo '    <h2> '._('Select players (Remember: you need to be one of the players)').' </h2>';
 
-  /* delete players name, since he will be on position D anyway */
-  unset($copy_names[array_search($_SESSION["name"],$copy_names)]);
+  echo '   <div class="table">';
 
-  srand((float) microtime() * 10000000);
-  foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
+  echo  "     <div class=\"table1\">\n";
+  $randkey = array_rand($copy_names);
+  $rand = $copy_names[$randkey];
+  /* delete this name from the list of possible names */
+  unset($copy_names[$randkey]);
+  echo "       <select name=\"PlayerB\" size=\"1\">  \n";
+  foreach($names as $name)
     {
-      /* pick 3 names at random and put the players name on position D*/
-      if($i<3)
-       {
-         $randkey = array_rand($copy_names);
-         $rand = $copy_names[$randkey];
-         /* delete this name from the list of possible names */
-         unset($copy_names[$randkey]);
-       }
+      if($name==$rand)
+       echo "         <option selected=\"selected\">$name</option>\n";
       else
-       {
-         $rand = $_SESSION["name"];
-       }
+       echo "         <option>$name</option>\n";
+    }
+  echo "       </select>\n     </div>\n";
 
-      echo  "     <div class=\"table".$i."\">\n";
-      $i++;
-      echo "       <select name=\"$player\" size=\"1\">  \n";
-      foreach($names as $name)
-       {
-         if($name==$rand)
-           {
-             echo "         <option selected=\"selected\">$name</option>\n";
-           }
-         else
-           echo "         <option>$name</option>\n";
-       }
-      echo "       </select>\n     </div>\n";
+  echo '   <div class="middle">';
+
+  $randkey = array_rand($copy_names);
+  $rand = $copy_names[$randkey];
+  /* delete this name from the list of possible names */
+  unset($copy_names[$randkey]);
+  echo  "     <div class=\"table0\">\n";
+  echo "       <select name=\"PlayerA\" size=\"1\">  \n";
+  foreach($names as $name)
+    {
+      if($name==$rand)
+       echo "         <option selected=\"selected\">$name</option>\n";
+      else
+       echo "         <option>$name</option>\n";
     }
-?>
-    </div>
-
-     <h2 class="rules">Rules</h2>
-     <h3>Gameplay-related</h3>
-     <h4>Ten of hearts:</h4>
-     <p>
-       <select name="dullen">
-         <option value="none"> just normal non-trump  </option>
-         <option value="firstwins"> first ten of hearts wins the trick </option>
-         <option value="secondwins" selected="selected"> second ten of hearts wins the trick </option>
-       </select>
-     </p>
-     <h4>Schweinchen (both foxes), only in normal games or silent solos:</h4>
-     <p>
-       <select name="schweinchen">
-         <option value="none" selected="selected"> none </option>
-        <option value="both"> both become highest trump (automatic call at beginning of the game)   </option>
-        <option value="second"> first one normal, second one becomes highest (call during the game) </option>
-        <option value="secondaftercall">  second one become highest only in case re/contra was announced
-        </option>
-       </select>
-     </p>
-     <h4>Call Re/Contra, etc.:</h4>
-     <p>
-       <select name="callrule">
-        <option value="1st-own-card" selected="selected">  Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</option>
-        <option value="5th-card"> Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</option>
-        <option value="9-cards" > Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</option>
-       </select>
-     </p>
-     <h4>Low trump</h4>
-     <p>
-       Player can't trump a fox, that is none of his trump is higher than a fox.
-       <select name="lowtrump">
-        <option value="poverty">The trump will be treated as poverty and offered to another player.</option>
-        <option value="cancel">  The game will be canceled unless there is a solo.</option>
-        <option value="none">   Bad luck, the player needs to play a normal game.</option>
-       </select>
-     </p>
-     <h3>Scoring-related</h3>
-     <h4>(not yet implemented)</h4>
-     <p><input type="submit" value="start game"></p>
-     </form>
-<?php
+  echo "       </select>\n     </div>\n";
+
+  echo '     <img class="table" src="pics/table.png" alt="table" />';
+  $randkey = array_rand($copy_names);
+  $rand = $copy_names[$randkey];
+  /* delete this name from the list of possible names */
+  unset($copy_names[$randkey]);
+  echo  "     <div class=\"table2\">\n";
+  echo "       <select name=\"PlayerC\" size=\"1\">  \n";
+  foreach($names as $name)
+    {
+      if($name==$rand)
+       echo "         <option selected=\"selected\">$name</option>\n";
+      else
+       echo "         <option>$name</option>\n";
+    }
+  echo "       </select>\n     </div>\n";
+
+  echo '   </div>';
+  $rand = $_SESSION["name"];
+  echo  "     <div class=\"table3\">\n";
+  echo "       <select name=\"PlayerD\" size=\"1\">  \n";
+  foreach($names as $name)
+    {
+      if($name==$rand)
+       echo "         <option selected=\"selected\">$name</option>\n";
+      else
+       echo "         <option>$name</option>\n";
+    }
+  echo "       </select>\n     </div>\n";
+
+  /* ask player for names */
+
+    echo '    </div>';
+    echo '';
+    echo '     <h2 class="rules">'._('Rules').'</h2>';
+    echo '     <h3>'._('Gameplay-related').'</h3>';
+    echo '     <h4>'._('Ten of hearts').':</h4>';
+    echo '     <p>';
+    echo '       <select name="dullen">';
+    echo '         <option value="none"> '._('just normal non-trump').'  </option>';
+    echo '         <option value="firstwins"> '._('first ten of hearts wins the trick').' </option>';
+    echo '         <option value="secondwins" selected="selected"> '.('second ten of hearts wins the trick').' </option>';
+    echo '       </select>';
+    echo '     </p>';
+    echo '     <h4>'._('Schweinchen (both foxes), only in normal games or silent solos').':</h4>';
+    echo '     <p>';
+    echo '       <select name="schweinchen">';
+    echo '         <option value="none" selected="selected"> '._('none').' </option>';
+    echo '      <option value="both"> '._('both become highest trump (automatic call at beginning of the game)').'   </option>';
+    echo '      <option value="second"> '._('first one normal, second one becomes highest (call during the game)').' </option>';
+    echo '      <option value="secondaftercall">  ',_('second one become highest only in case re/contra was announced');
+    echo '      </option>';
+    echo '       </select>';
+    echo '     </p>';
+    echo '     <h4>'._('Call Re/Contra, etc.').':</h4>';
+    echo '     <p>';
+    echo '       <select name="callrule">';
+    echo '      <option value="1st-own-card" selected="selected">  '._('Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.').'</option>';
+    echo '      <option value="5th-card"> '._('Can call re/contra until 5th card is played, 90 until 9th card is played, etc.').'</option>';
+    echo '      <option value="9-cards" > '._('Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.').'</option>';
+    echo '       </select>';
+    echo '     </p>';
+    echo '     <h4>'._('Low trump').'</h4>';
+    echo '     <p>';
+    echo '       '._('Player can\'t trump a fox, that is none of his trump is higher than a fox.');
+    echo '       <select name="lowtrump">';
+    echo '      <option value="poverty">'._('The trump will be treated as poverty and offered to another player.').'</option>';
+    echo '      <option value="cancel"> '._('The game will be canceled unless there is a solo.').'</option>';
+    echo '      <option value="none">   '._('Bad luck, the player needs to play a normal game.').'</option>';
+    echo '       </select>';
+    echo '     </p>';
+    echo '     <h3>'._('Scoring-related').'</h3>';
+    echo '     <h4>'._('(not yet implemented)').'</h4>';
+    echo '     <p><input type="submit" value="'._('start game').'"></p>';
+    echo '     </form>';
+
 }
 
 function output_table($data,$caption="",$class="",$id="")
@@ -203,91 +248,92 @@ function display_card($card,$dir="english")
   return;
 }
 
-function display_link_card($card,$dir="english",$type="card")
+function display_link_card($card,$dir="english",$type="card", $selected=0)
 {
+  if($selected)
+    $selected = 'checked="checked"';
+
   if( $card/2 - (int)($card/2) == 0.5)
-    echo "<div class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" /></div>\n";
+    echo "<label class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" $selected /><img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" /></label>\n";
   else
-    echo "<div class=\"cardinput\" ><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" /></div>\n";
+    echo "<label class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" $selected /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" /></label>\n";
   return;
 }
 
 function output_check_for_sickness($me,$mycards)
 {
   global $RULES;
- ?>
-  <div class="sickness"> Thanks for joining the game...<br />
-
-    Do you want to play solo?
-    <select name="solo" size="1">
-      <option selected="selected">No</option>
-      <option>trumpless</option>
-      <option>trump</option>
-      <option>queen</option>
-      <option>jack</option>
-      <option>club</option>
-      <option>spade</option>
-      <option>heart</option>
-    </select>
-    <br />
-
- <?php
-
-  echo "Wedding?";
+
+  echo '  <div class="sickness"> '._('Thanks for joining the game').'...<br />';
+  echo '';
+  echo '    '._('Do you want to play solo?').'';
+  echo '    <select name="solo" size="1">';
+  echo '      <option value="No" selected="selected">'.'No'.'</option>';
+  echo '      <option value="trumpless">'._('trumpless').'</option>';
+  echo '      <option value="trump">'._('trump').'</option>';
+  echo '      <option value="queen">'._('queen').'</option>';
+  echo '      <option value="jack">'._('jack').'</option>';
+  echo '      <option value="club">'._('club').'</option>';
+  echo '      <option valvue="spade">'._('spade').'</option>';
+  echo '      <option value="hear">'._('heart').'</option>';
+  echo '    </select>';
+  echo '    <br />';
+
   if(check_wedding($mycards))
      {
-       echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
-       echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
+       echo _('Do you want to call Wedding?');
+       echo ' '._('yes')."<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
+       echo ' '._('no')." <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
      }
    else
      {
-       echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
+       echo "  <input type=\"hidden\" name=\"wedding\" value=\"no\" />\n";
      };
 
-  echo "Do you have poverty?";
   if(count_trump($mycards)<4)
     {
-      echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
-      echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
+      echo _('Do you want to call poverty?');
+      echo ' '._('yes')."<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
+      echo ' '._('no')." <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
     }
   else
     {
-      echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
+      echo "  <input type=\"hidden\" name=\"poverty\" value=\"no\" />\n";
     };
 
-  echo "Do you have too many nines?";
   if(count_nines($mycards)>4)
      {
-       echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
-       echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
+       echo _('Do you want to call too many nines?');
+       echo ' '._('yes')."<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
+       echo ' '._('no')." <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
      }
    else
      {
-       echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
+       echo "  <input type=\"hidden\" name=\"nines\" value=\"no\" />\n";
      };
 
   if($RULES['lowtrump']=='cancel' || $RULES['lowtrump']=='poverty')
     {
-      if($RULES['lowtrump']=='cancel')
-       echo "Do you have low trump (cancel game)?";
-      else
-       echo "Do you have low trump (poverty)?";
-
       if(check_low_trump($mycards))
        {
-         echo " yes<input type=\"radio\" name=\"lowtrump\" value=\"yes\" checked=\"checked\" />";
-         echo " no <input type=\"radio\" name=\"lowtrump\" value=\"no\" /> <br />\n";
+          if($RULES['lowtrump']=='cancel')
+            echo _('Do you want to call low trump (cancel game)?');
+          else
+           echo _('Do you want to call low trump (poverty)?');
+
+         echo ' '._('yes')."<input type=\"radio\" name=\"lowtrump\" value=\"yes\" checked=\"checked\" />";
+         echo ' '._('no')." <input type=\"radio\" name=\"lowtrump\" value=\"no\" /> <br />\n";
        }
       else
        {
-         echo " no <input type=\"hidden\" name=\"lowtrump\" value=\"no\" /> <br />\n";
+         echo "  <input type=\"hidden\" name=\"lowtrump\" value=\"no\" />\n";
        };
     }
   else
-    echo "<input type=\"hidden\" name=\"lowtrump\" value=\"no\" />";
+    echo "  <input type=\"hidden\" name=\"lowtrump\" value=\"no\" />";
 
    echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
-   echo "<input type=\"submit\" value=\"count me in\" />\n";
+   echo "<br /><input type=\"submit\" value=\""._('count me in')."\" />\n";
 
    echo "</div>\n";
 
@@ -296,74 +342,72 @@ function output_check_for_sickness($me,$mycards)
 
 function output_form_calls($me,$myparty)
 {
-  $highstart = "<span class=\"highcall\">";
-  $highend   = "</span>";
+  $highstart = '  <span class="highcall">';
+  $highend   = '</span>';
 
   $tmp = can_call(120,$me);
   if( $tmp )
     {
       if($tmp==2) echo $highstart;
       if($myparty=='re')
-       echo "re (120):";
+       echo '  re (120):';
       else if ($myparty=='contra')
-       echo "contra (120):";
+       echo '  contra (120):';
       else
-       echo " re/contra (120):";
-      echo " <input type=\"radio\" name=\"call\" value=\"120\" />";
+       echo '  re/contra (120):';
+      echo ' <input type="radio" name="call" value="120" />';
       if($tmp==2) echo $highend;
-      echo "<br />\n";
+      echo "\n";
     }
-  $tmp =  can_call(90,$me);
+  $tmp = can_call(90,$me);
   if( $tmp )
     {
       if($tmp==2) echo $highstart;
-      echo " 90:".
-       " <input type=\"radio\" name=\"call\" value=\"90\" />";
+      echo '  90:'.
+       ' <input type="radio" name="call" value="90" />';
       if($tmp==2) echo $highend;
-      echo "<br />\n";
+      echo "\n";
     }
   $tmp = can_call(60,$me);
   if( $tmp )
     {
       if($tmp==2) echo $highstart;
-      echo " 60:".
-       " <input type=\"radio\" name=\"call\" value=\"60\" />";
+      echo '  60:'.
+       ' <input type="radio" name="call" value="60" />';
       if($tmp==2) echo $highend;
-      echo "<br />\n";
+      echo "\n";
     }
   $tmp = can_call(30,$me);
   if( $tmp )
     {
       if($tmp==2) echo $highstart;
-      echo " 30:".
-       " <input type=\"radio\" name=\"call\" value=\"30\" />";
+      echo '  30:'.
+       ' <input type="radio" name="call" value="30" />';
       if($tmp==2) echo $highend;
-      echo "<br />\n";
+      echo "\n";
     }
   $tmp = can_call(0,$me);
   if( $tmp )
     {
       if($tmp==2) echo $highstart;
-      echo " 0:".
-       " <input type=\"radio\" name=\"call\" value=\"0\" />";
+      echo '  0:'.
+       ' <input type="radio" name="call" value="0" />';
       if($tmp==2) echo $highend;
-      echo "<br />\n".
-       " no call:".
-       " <input type=\"radio\" name=\"call\" value=\"no\" /> <br />";
+      echo "\n".
+       '  no call:'.
+       ' <input type="radio" name="call" value="no" />'."\n";
     }
 }
 
 function output_check_want_to_play($me)
 {
-   ?>
- <div class="joingame">
-   Do you want to play a game of DoKo? <br />
-   yes<input type="radio" name="in" value="yes" />
-   no<input type="radio" name="in" value="no" /> <br />
-<?php
+  echo ' <div class="joingame">';
+  echo '   '._('Do you want to play a game of DoKo?').' <br />';
+  echo '   '._('yes').'<input type="radio" name="in" value="yes" checked="checked" />';
+  echo '   '._('no').'<input type="radio" name="in" value="no" /> <br />';
   echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
   echo "\n";
-  echo "<input type=\"submit\" value=\"submit\" />\n";
+  echo "<input type=\"submit\" value=\""._('submit')."\" />\n";
   echo " </div>\n";
 
   return;
@@ -373,31 +417,19 @@ function output_header()
 {
    global $REV;
 ?>
-<!DOCTYPE html PUBLIC
-    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
-    "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<!DOCTYPE html>
+<html lang="en">
   <head>
      <title>e-Doko</title>
-     <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
-     <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
-     <link rel="stylesheet" type="text/css" href="css/standard023.css" />
-     <script type="text/javascript" src="include/game.js"> </script>
-     <script type="text/javascript" src="include/jquery.js"> </script>
-     <script type="text/javascript" src="include/jquery.tablesorter.js"></script>
-     <script type="text/javascript">
-        $(document).ready(function()
-          {
-              $("#ScoreTable").tablesorter({ widgets: ['zebra']});
-           });
-     </script>
+     <meta charset="utf-8" />
+     <meta name="viewport" content="width=device-width; initial-scale=1.0;" />
+     <link rel="shortcut icon" href="pics/edoko-favicon.png" />
+     <link rel="stylesheet/less" media="all" href="<?php echo autoversion("css/bootstrap.less"); ?>" />
+     <link rel="stylesheet/less" href="<?php echo autoversion("css/standard.less"); ?>" />
+     <link rel="stylesheet" href="<?php echo autoversion("css/dateinput.css"); ?>"/>
+     <script src="js/less.min.js" type="text/javascript"></script>
   </head>
 <body onload="high_last();">
-<div class="header">
-<?php
-  echo '<h1> '._('Welcome to E-Doko').' </h1>';
-?>
-</div>
 <?php
 
   echo "<div class=\"main\">";
@@ -406,22 +438,27 @@ function output_header()
 
 function output_footer()
 {
-  global $REV,$PREF;
+  global $REV, $PREF, $INDEX;
 
   echo "</div>\n\n";
-  echo "<div class=\"footer\">\n";
-  echo "  <p class=\"left\"> copyright 2006,2007,2008,2009,2010 Arun Persaud, Lance Thornton(graphics),  Jeff Zerger(database support) <br />\n".
+  echo "<footer>\n";
+  echo "  <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
+    "  via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
+    "  <a href=\"http://www.dreamhost.com/green.cgi\"><p>\n".
+    "  <img class=\"right\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
+    " src=\"pics/green1.gif\" height=\"32\" width=\"100\" /></a>\n";
+  echo "  <p class=\"left\"> copyright 2006-2012 <a href=\"$INDEX?action=about\">Arun Persaud, et al.</a> <br />\n".
     "  Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n".
     "  - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n".
     "  a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
- echo " <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
-    "  via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
-    "  <a href=\"http://www.dreamhost.com/green.cgi\">\n".
-    "  <img  border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
-    "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>\n".
-    "  </p> \n";
-  echo "\n";
-  echo "</div>\n";
+  echo "</footer>\n\n";
+
+  echo '<script src="'.autoversion('js/jquery.min.js').             '"></script>';
+  echo '<script src="'.autoversion('js/jquery.tablesorter.min.js'). '"></script>';
+  echo '<script src="'.autoversion('js/jquery.tools.min.js').       '"></script>';
+  echo '<script src="'.autoversion('js/bootstrap.min.js').          '"></script>';
+  echo '<script src="'.autoversion('js/layout.js').                 '"></script>';
+  echo '<script src="'.autoversion('js/game.js').                   '"></script>';
 
   echo "</body>\n";
   echo "</html>\n";
@@ -429,16 +466,17 @@ function output_footer()
   return;
 }
 
-function output_status()
+function output_navbar()
 {
   global $defaulttimezone, $INDEX, $WIKI, $RSS;
 
-  if(isset($_SESSION["name"]))
+  if(isset($_SESSION['name']))
     {
-      $name = $_SESSION["name"];
+      $name  = $_SESSION['name'];
+      $email = DB_get_email('name',$name);
 
       /* last logon time */
-      $myid  = DB_get_userid("name",$name);
+      $myid  = DB_get_userid('name',$name);
       $zone  = DB_get_user_timezone($myid);
 
       $time     = DB_get_user_timestamp($myid);
@@ -450,24 +488,25 @@ function output_status()
       $token = get_user_token($myid);
 
       /* logout info */
-      echo "\n<div class=\"status\">\n";
-      echo $name,"\n";
-      echo " | <a href=\"".$INDEX."\"> mypage </a>\n";
-      echo " | <a href=\"".$INDEX."?action=prefs\">settings</a>\n";
-      echo " | <a href=\"".$INDEX."?action=new\">new game</a>\n";
-      echo " | <a href=\"".$INDEX."?action=stats\">statistics</a>\n";
-      echo " | <a href=\"".$WIKI."\">wiki</a>\n";
-      echo " | <a href=\"".$RSS."?uid=".$myid."&amp;token=".$token."\">rss</a>\n";
-      echo " |&nbsp;&nbsp;&nbsp; <a href=\"".$INDEX."?action=logout\">logout</a>\n";
+      echo "\n<div class=\"navigation\">\n";
+      echo "  <span class=\"brand\" href=\"#\">E-DoKo</span>\n";
+      echo "  <ul class=\"nav\">";
+      echo "     <li>\n";
+      echo "         <img title=\"$name\" ";
+      echo             "src=\"http://www.gravatar.com/avatar/".md5(strtolower(trim($email)))."?d=identicon\" />\n";
+      echo "     </li>\n";
+      echo "     <li> <a href=\"".$INDEX."\"><i class=\"icon-home\"></i><span class=\"navhide\">"._('Home')."</span></a></li>\n";
+      echo "     <li> <a href=\"".$INDEX."?action=prefs\"><i class=\"icon-cog\"></i><span class=\"navhide\">".
+       _('settings')."</span></a></li>\n";
+      echo "     <li> <a href=\"".$INDEX."?action=new\">"._('new game')."</a></li>\n";
+      echo "     <li> <a href=\"".$INDEX."?action=stats\">"._('statistics')."</a></li>\n";
+      echo "     <li> <a href=\"".$WIKI."\">"._('wiki/bugs')."</a></li>\n";
+      echo "     <li> <a href=\"".$RSS."?uid=".$myid."&amp;token=".$token."\">"._('atom')."</a></li>\n";
+      echo "     <li> <a href=\"".$INDEX."?action=logout\"><i class=\"icon-off\"></i><span class=\"navhide\">"._('logout')."</span></a></li>\n";
+      echo "  </ul>\n";
       echo "</div>\n";
 
-      echo "<div class=\"lastlogin\"><span>last login: ".date("r",$unixtime)."</span></div>\n";
-    }
-  else
-    {
-      echo "\n<div class=\"status\">\n";
-      echo "<a href=\"".$INDEX."\">login</a>\n";
-      echo "</div>\n";
+      echo "<div class=\"lastlogin\"><span>"._('last login').": ".date("r",$unixtime)."</span></div>\n\n";
     }
   return;
 }
@@ -551,13 +590,13 @@ function output_password_recovery($email,$password)
        <legend>Password recovery</legend>
         <table>
          <tr>
-            <td><label for="email">Old password:</label></td>
+            <td><label for="password0">Old password:</label></td>
             <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
          </tr><tr>
-            <td><label for="password">New password:</label></td>
+            <td><label for="password1">New password:</label></td>
             <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
          </tr><tr>
-            <td><label for="password">Retype:</label></td>
+            <td><label for="password2">Retype:</label></td>
             <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
          </tr><tr>
            <td></td>
@@ -572,13 +611,13 @@ function output_password_recovery($email,$password)
 
 function output_user_notes($userid,$gameid,$userstatus)
 {
-  echo "<div class=\"notes\"> Personal notes: <br />\n";
+  echo "<div class=\"notes\"> "._('Personal notes').": <br />\n";
   $notes = DB_get_notes_by_userid_and_gameid($userid,$gameid);
   foreach($notes as $note)
-    echo "$note <hr />\n";
+    echo "  $note <hr />\n";
   if($userstatus!='gameover')
-    echo "<input name=\"note\" type=\"text\" size=\"15\" maxlength=\"100\" />\n";
-  echo "</div> \n";
+    echo "  <input name=\"note\" type=\"text\" size=\"15\" maxlength=\"100\" />\n";
+  echo "</div>\n\n";
 
   return;
 }
@@ -658,6 +697,19 @@ function output_exchanged_cards()
   $show=1;
   for($mypos=1;$mypos<5;$mypos++)
     {
+      /* output comments */
+      if($mypos==2)
+       {
+         /* display all comments on the top right (card1)*/
+         $comments = DB_get_pre_comment($gameid);
+         /* display card */
+         echo "      <div class=\"card1\">\n";
+         /* display comments */
+         foreach( $comments as $comment )
+           echo "        <span class=\"comment\">".$comment[1].": ".$comment[0]."</span>\n";
+         echo "      </div>\n"; /* end div card */
+       }
+
       $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid);
       if($usersick!=NULL ||
         $mypos==$povertypos1 || $mypos==$partnerpos1 ||
@@ -701,7 +753,7 @@ function output_exchanged_cards()
                  else
                    display_card(0,$PREF['cardset']);
                }
-             if($trump_back1) echo "        Trump back";
+             if($trump_back1) echo '        '._('Trump back');
            }
          else if($mypos==$povertypos1)
            {
@@ -713,7 +765,7 @@ function output_exchanged_cards()
                  else
                    display_card(0,$PREF['cardset']);
              }
-             if($trump_back1) echo "        Trump back";
+             if($trump_back1) echo '        '._('Trump back');
            }
          else if($mypos==$povertypos2)
            {
@@ -725,7 +777,7 @@ function output_exchanged_cards()
                  else
                    display_card(0,$PREF['cardset']);
                }
-             if($trump_back2) echo "        Trump back";
+             if($trump_back2) echo '        '._('Trump back');
            }
          else if($mypos==$partnerpos2)
            {
@@ -738,7 +790,7 @@ function output_exchanged_cards()
                  else
                    display_card(0,$PREF['cardset']);
                }
-             if($trump_back2) echo "        Trump back";
+             if($trump_back2) echo '        '._('Trump back');
            }
          echo  "      </div>\n";
        }