"Français",
		 "en" => "English",
		  );
$locales=array("fr" => "fr_FR.UTF-8",
	       "en" => "en_GB.UTF-8",
	       );
$uri=trim($_SERVER["REQUEST_URI"],"/");
// auto lang redirect:
if (!$uri) {
  $lang="en";
  if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
    $l=substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
    if (isset($otherlang[$l])) {
      $lang=$l;
    }
  }
  header("Location: /Home-".$lang."");
  exit();
}
if (preg_match('#^(.*)-([^-]*)$#',$uri,$mat)) {
  $lang=$mat[2]; 
  $uri=$mat[1];
}
if (!isset($otherlang[$lang])) {
  header("HTTP/1.0 404 Not Found");
  echo "
Lang not supported
";
  exit();
}
// set locales:
putenv("LC_MESSAGES=".$locales[$lang]);
putenv("LANG=".$locales[$lang]);
putenv("LANGUAGE=".$locales[$lang]);
// this locale MUST be selected in "dpkg-reconfigure locales"
setlocale(LC_ALL,$locales[$lang]); 
unset($otherlang[$lang]);
header("Content-Type: text/html; charset=UTF-8");
if (!file_exists("../pages/".$uri."-".$lang.".md")) {
  header("HTTP/1.0 404 Not Found");
  echo "File not found
";
  exit();
}
// automatic compilation / caching of HTML pages
if (!file_exists("../pages/".$uri."-".$lang.".html") ||
    filemtime("../pages/".$uri."-".$lang.".html") < filemtime("../pages/".$uri."-".$lang.".md") ) {
  passthru("github-markup ".escapeshellarg("../pages/".$uri."-".$lang.".md")." >".escapeshellarg("../pages/".$uri."-".$lang.".html")." 2>&1");
}
$f=fopen("../pages/".$uri."-".$lang.".html","rb");
$headings=array();
$cur=array(); $id=""; $name="";
$first=true;
while ($s=fgets($f,1024)) {
  if (preg_match('#([^<]*)
#',$s,$mat)) {
    if ($first) { $title=$mat[2]; $first=false; }
    if ($id) $headings[]=array("id"=>$id, "name"=>$name, "cur"=>$cur);
    $id=$mat[1]; $name=$mat[2];
    $cur=array();
  }
  if (preg_match('#([^<]*)
#',$s,$mat)) {
    $cur[]=array("id"=>$mat[1], "name"=>$mat[2]);
  }
}
if ($id) $headings[]=array("id"=>$id, "name"=>$name, "cur"=>$cur);
ob_start();
foreach($headings as $v) {
?>                
  
    ">