<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="author" content="EngSaS - Engineering Solutions and Services Langenbach" />
		<meta name="keywords=" content="<?php if(isset($keywords)){ echo $keywords; }; ?>" />
		<meta name="description=" content="<?php if(isset($description)){ echo $description; }; ?>" />
		<link rel="stylesheet" href="engsas.css" type="text/css" />
    <link rel="SHORTCUT ICON" href="engsas.ico" type="image/x-icon" />
		<title><?php if(isset($title)){ echo $title; }; ?></title>
		<?php if(isset($additionalHeader)){ echo $additionalHeader; }; ?>
	</head>
	<body>
<?php
// language chooser
$localeDir = "./locale";
$dirs = scandir($localeDir);
$langs = array();
foreach($dirs as $dir){
	if(preg_match("/^[a-z]{2}_[A-Z]{2}/", $dir))
		if(is_dir($localeDir ."/". $dir))
			$langs[] = substr($dir, 0, strpos($dir, ".UTF-8"));
}

if(count($langs) > 0){
	echo "<div class=\"rightFloat\">\n";
	echo "	<div class=\"languageChooser\">\n";
	echo "		<h3>". _("Languages") .":</h3>\n";
	echo "			<ul>\n";
	foreach($langs as $language){
		// extract upper case part
		$start = strpos($language, "_") + 1;
		$ende = strpos($language, ".");
		if(!$ende)
			$ende = strlen($language);
		$name = substr($language, $start, $ende);
		echo "			<li>\n";
		echo "				<a href=\"". $_SERVER["PHP_SELF"] ."?lang=". $language ."\"";
		echo "					title=\"This page in ". $name ."\">\n";
		echo "					". $name ."\n";
		echo "				</a>\n";
		echo "			</li>\n";
	}
	echo "		</ul>\n";
	echo "	</div>\n";
	echo "</div>\n";
}
?>
	<h2 class="header">
		<img src="engsas.png" alt="EngSaS - Logo" width="71" height="100" />
		EngSaS - Engineering Solutions and Services Langenbach
	</h2>
  <h3><?php if(isset($title)){ echo $title; }; ?></h3>