<?php
	$sql	= "SELECT Titel, Text, Foto_Layout FROM Uns WHERE ID='3' ";
	$result = $db->query($sql);
	$nt 	= $result->fetch_assoc();
	$sql1	= "SELECT * FROM Firma WHERE ID='2' ";
	$result1= $db->query($sql1);
	$nt1	= $result1->fetch_assoc();
	$sql2	= "SELECT Kurz FROM US WHERE Sektion = \"kontakt\" AND Wert = \"on\" ORDER BY ID ASC;";
	$result2= $db->query($sql2);
	
	echo "<h1>".$nt['Titel']."</h1>\n";
	if ("ohne" == $nt['Foto_Layout']) {
	} elseif ("rechts" == $nt['Foto_Layout']) {
		echo "<img style=\"float: right; margin-left: 20px;\" src=\"img/team/ko.jpg\" title=\"".$nt['Titel']."\" alt=\"".$nt['Titel']."\" />\n";
	} elseif ("links" == $nt['Foto_Layout']) {
		echo "<img style=\"float: left; margin-right: 20px;\" src=\"img/team/ko.jpg\" title=\"".$nt['Titel']."\" alt=\"".$nt['Titel']."\" />\n";
	} elseif ("oben" == $nt['Foto_Layout']) {
		echo "<p style=\"text-align: center;\">\n";
		echo "	<img style=\"float: none;\" src=\"img/team/ko_oben.jpg\" title=\"".$nt['Titel']."\" alt=\"".$nt['Titel']."\" />\n";
		echo "</p>\n";
	}
	echo "<p>".nl2br($nt['Text'])."</p>\n";
	echo "<h3>".$nt1['Firma']."</h3>\n";

	if ('' !== $nt1['Vertreter1']) {
		echo $nt1['Vertreter1'];
	}
	if ('' !== $nt1['Vertreter2']) {
		echo ", ".$nt1['Vertreter2'];
	}
	if ('' !== $nt1['Vertreter3']) {
		echo ", ".$nt1['Vertreter3']."\n";
	}
	echo "&nbsp;<br />\n";
	
	echo "<table>\n";
	echo "    <colgroup>\n";
	echo "        <col width=\"50px\" />\n";
	echo "        <col width=\"300px\" />\n";
	echo "    </colgroup>\n";
	echo "    <tr>\n";
	echo "        <td colspan=\"2\">".$nt1['Strasse']." ".$nt1['HausNr']."<br />".$nt1['PLZ']." ".$nt1['Ort']."<br />".$nt1['Land']."<br />&nbsp;</td>\n";
	echo "    </tr>\n";
	echo "    <tr>\n";
	echo "        <td>Tel:</td>\n";
	echo "        <td>".$nt1['Telefon']."</td>\n";
	echo "    </tr>\n";
	echo "    <tr>\n";
	echo "        <td>Fax:</td>\n";
	echo "        <td>".$nt1['Telefax']."</td>\n";
	echo "    </tr>\n";
	echo "    <tr>\n";
	echo "        <td>Email:</td>\n";
	echo "        <td><a href=\"mailto:" . $nt1['EMail'] . "\">" . $nt1['EMail'] . "</a></td>\n";
	echo "    </tr>\n";
	echo "</table>\n";
	echo "<br />&nbsp;<br />\n";
	if (("links" == $nt['Foto_Layout']) OR ("rechts" == $nt['Foto_Layout'])) {
		echo "<br class=\"fix\" />\n";
		echo "&nbsp;<br />\n";
	}
	while ($nt2 = $result2->fetch_assoc()) {
		if ("ii" == $nt2['Kurz']) {
			echo "<p>Ich suche eine Immobilie und möchte das <a href=\"index.php?section=unter&t=ko&b=ii\">Interessentenformular</a> nutzen.</p>\n";
		} elseif ("vv" == $nt2['Kurz']) {
			echo "<p>Ich bin Vermieter / Verkäufer und möchte das <a href=\"index.php?section=unter&t=ko&b=ii\">Vermieterformular</a> nutzen.</p>\n";
		}
	}
	
?>