<?php

	$a = true;
	$b = true;

        $sql1="SELECT * FROM objekte WHERE ID = '$_GET[obj]' ";
        $result1 = $db->query($sql1);
		$nt1 = $result1->fetch_assoc();
		if ("0" !== $nt1['TID']) {
			$sql2="SELECT ID, Vorname, Nachname, Telefon, EMail FROM Team WHERE ID = ".$nt1['TID']." ";
		}
		else {
			$sql2="SELECT Firma AS Vorname, Telefon, EMail FROM Firma WHERE ID = 2 ";
		}
		$result2 = $db->query($sql2);
		$nt2 = $result2->fetch_assoc();
		echo "<h2 align=\"right\"><span style=\"float:left;\">$nt1[Kurz]</span>Objekt-Nr: $nt1[ID]</h2>\n";
		if (isset($_GET['f'])) {
			$pic = "img/objekte/".$_GET['obj']."_".$_GET['f'].".jpg";
		}



?>
<table class="uebersicht">
    <colgroup>
	    <col width="120" />
		<col width="80" />
		<col width="120" />
		<col width="150" />
		<col width="150" />
		<col width="80" />
	</colgroup>
	<tr>
		<td colspan="6"><hr style="margin-top: 0px; margin-left: -5px; margin-right: -5px;"/></td>
	</tr>
	<tr>
		<th colspan="4">Übersicht</th>
		<th colspan="2">Kontakt</th>
	</tr>
	<tr>
		<td>Zimmer:</td><td><?php echo $nt1[Zimmer]; ?></td>
<?php
		if ('1' == $nt1[Balkon]) {
			echo "        <td><img src=\"img/balkon.png\" alt=\"Balkon\" /></td>\n";
		}
		else {
			echo "<td>&nbsp;</td>\n";
		}
		if ('1' == $nt1[Terrasse]) {
			echo "        <td><img src=\"img/terrasse.png\" alt=\"Terrasse\" /></td>\n";
		}
		else {
			echo "<td>&nbsp;</td>\n";
		}
?>
		<?php echo "<td>$nt2[Vorname] $nt2[Nachname] </td><td rowspan=\"3\">\n";
			if ("0" !== $nt1[TID]) {
				echo "<img src=\"img/team/$nt2[ID].jpg\" width=\"80px\"></td>\n";
			}
		?>
	</tr>
	<tr>
	    <td>Nutzfl&auml;che:</td><td><?php echo $nt1[WohnF]; ?> m&sup2;</td>
<?php
		if ('1' == $nt1[Garten]) {
			echo "        <td><img src=\"img/garten.png\" alt=\"Garten\" /></td>\n";
		}
		else {
			echo "<td>&nbsp;</td>\n";
		}
		if ('1' == $nt1[Garage]) {
			echo "        <td><img src=\"img/garage.png\" alt=\"Garage\" /></td>\n";
		}
		else {
			echo "<td>&nbsp;</td>\n";
		}
?>
		<td><?php echo $nt2[Telefon]; ?></td>
	</tr>
	<tr>
	    <td>Kaltmiete:</td><td><?php echo $nt1[Mkalt]; ?> &euro;</td>
<?php
		if ('1' == $nt1[StellPl]) {
			echo "        <td><img src=\"img/ebk.png\" alt=\"Balkon\" /></td>\n";
		}
		else {
			echo "<td>&nbsp;</td>\n";
		}
?>
		<td></td>
		<td><?php echo $nt2[EMail]; ?></td>
	</tr>
	<tr>
		<td colspan="6"><hr style="margin-bottom: 0px; margin-left: -5px; margin-right: -5px;"/></td>
	</tr>
</table><br />

<table class="foto">
    <colgroup>
		<col width="440px" />
		<col span="2" width="130px" />
	</colgroup>
	<tr>
<?php
	for ($i = 1; $i <= 8; $i++) {
		$file = "img/objekte/".$_GET['obj']."_".$i.".jpg";
		if (("1" == $i) AND (isset($_GET['f']))) {
			echo "<td rowspan=\"4\"><img src=$pic /></td>\n";
		}
		if (file_exists($file)) {
			if ("" == $pic) {
				$pic = $file;
				echo "<td rowspan=\"4\"><img src=$file /></td>\n";
			}
			echo "<td style=\"text-align:right;\"><a href=\"index.php?section=gewerbe&t=mfm&obj=".$_GET['obj']."&f=$i\"><img src=$file width=\"100px\" height=\"75px\" /></a></td> \n";
			if (!$a) {
				echo "</tr>\n<tr>\n";
			}
			$a = ($a xor $b);
			$count++;
		}
	}
	for ($count; $count <7; $count++) {
		echo "<td>&nbsp</td>\n";
		if (!$a) {
			echo "</tr>\n<tr>\n";
		}
		$a = ($a xor $b);
	}
?>
</tr>
</table><br />

<table class="expose">
    <colgroup>
	    <col width="200" />
		<col width="150" />
		<col width="200" />
		<col width="150" />
	</colgroup>
	<tr>
		<th colspan="4">Beschreibung</th>
	</tr>
	<tr>
		<td colspan="4"><?php echo nl2br($nt1[Beschreibung]); ?></td>
	</tr>
	<tr>
		<td colspan="4"><hr /></td>
	</tr>
	<tr>
		<th colspan="4">Kosten</th>
	</tr>
    <tr>
	    <td>Kaution:</td>
		<td><?php echo $nt1[Kaution]; ?></td>
		<td>zzgl. Garage:</td>
		<td><?php echo $nt1[GaraK]; ?> &euro;</td>
	</tr>
	<tr>
	    <td>Miete kalt:</td>
		<td><?php echo $nt1[Mkalt]; ?> &euro;</td>
		<td>zzgl. Stellplatz:</td>
		<td><?php echo $nt1[StellK]; ?> &euro;</td>
	</tr>
	<tr>
	    <td>Miete warm:</td>
		<td><?php echo $nt1[Mwarm]; ?> &euro;</td>
		<td>Abl&ouml;se EBK:</td>
		<td><?php echo $nt1[EBKK]; ?> &euro;</td>
	</tr>
	<tr>
        <td>Nebenkosten:</td>
		<td><?php echo $nt1[NebenK]; ?> &euro;</td>
		<td>Sonstige Kosten:</td>
		<td><?php echo $nt1[SonK]; ?> &euro;</td>
	</tr>
	<tr>
		<td colspan="4"><hr /></td>
	</tr>
	<tr>
		<th colspan="4">Auflagen</th>
	</tr>
    <tr>
        <td colspan="4"><?php echo nl2br($nt1[Auflagen]); ?></td>
	</tr>
	<tr>
		<td colspan="4"><hr /></td>
	</tr>
	<tr>
		<th colspan="4">Ausstattung innen</th>
	</tr>
    <tr>
	
	<?php
		$a = true;
		if ('1' == $nt1[EinbauK]) {
			echo "<td>Einbauküche:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[Speise]) {
			echo "<td>Speisekammer:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[BadeW]) {
			echo "<td>Badewanne:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[DuschK]) {
			echo "<td>Duschkabine:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[WCsep]) {
			echo "<td>WC separat:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[WCbad]) {
			echo "<td>WC im Bad:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[Abstell]) {
			echo "<td>Abstellraum:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[DachB]) {
			echo "<td>Dachboden:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[Keller]) {
			echo "<td>Keller:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
		}
	?>
	</tr>
	<tr>
		<td>Heizart:</td><td colspan="3"><?php echo $nt1[Heizart]; ?></td>
	</tr>
	<tr>
		<td>Waschmaschine im:</td><td colspan="3"><?php echo $nt1[WaschOrt]; ?></td>
	</tr>
	<tr>
		<td>TV-Anschluss:</td><td colspan="3"><?php echo $nt1[TV]; ?></td>
	</tr>
	<tr>
		<td colspan="4"><hr /></td>
	</tr>
	<tr>
		<th colspan="4">Ausstattung au&szlig;en</th>
	</tr>
    <tr>
	<?php
		$a = true;
		if ('1' == $nt1[Garage]) {
			echo "<td>Garage:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[StellPl]) {
			echo "<td>Stellplatz:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[Terrasse]) {
			echo "<td>Terrasse:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[Balkon]) {
			echo "<td>Balkon:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
			if ($a) {
				echo "</tr>\n<tr>\n";
			}
		}
		if ('1' == $nt1[Garten]) {
			echo "<td>Garten:</td><td><img src=\"img/1.png\" alt=\"ja\" /></td> \n";
			$a = ($a xor $b);
		}
	?>
	</tr>
	<tr>
		<td colspan="4"><hr /></td>
	</tr>
	<tr>
		<th colspan="4">Ausstattung</th>
	</tr>
	<tr>
		<td colspan="4"><?php echo nl2br($nt1[Ausstatt]); ?></td>
	</tr>
	<tr>
		<td colspan="4"><hr /></td>
	</tr>
	<tr>
		<th colspan="4">Sonstiges</th>
	</tr>
	<tr>
		<td colspan="4"><?php echo nl2br($nt1[Sonst]); ?></td>
	</tr>
</table><br />

<p><b>Provision: 2 Kaltmieten zuz&uuml;glich gesetzlicher MwSt.</b></p>