<div id="kontakt" style="width: 750px;" class="CatContainer">
	<div class="title">
		<img src="images/kontakt.png" align="left" class="icon">Kontakt
	</div>
	<div class="content">
	<?php
		function safepost ($param) {
			$retval="";
			if (isset($_POST["$param"])) $retval=$_POST["$param"];
			return $retval;
		}

		$betreff= safepost('betreff');
		$mail= safepost('mail');
		$text= safepost('text');
		$error= safepost('error');
	?>

	<table width="100%" cellspacing="10" id="tableborderless">
		<tr>
			<td>
				<?php
					if ($_SERVER["REQUEST_METHOD"] == "POST") {
						if ($mail == ""){
							$msg2="Das Mailfeld darf nicht leer sein";
							$error=1;
						} else {
							if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2}|[a-z]{3}|shop|aero|coop|info|museum|name)+$/i", $mail)) {
								$msg2 .= "Die Mailadresse hat kein g&uuml;ltiges Format!\n";
								$error=1;
							}
						}
						if ($text == ""){
							$msg3="Das Textfeld darf nicht leer sein";
							$error=1;
						}
					}
					if ($error==1 || $error=='')  {
						$error=2;
						echo "<form action='index.php?go=contact' method='POST'>\n";
						echo "<tr>\n";
						echo "<td align='right' valign='top' width='150'><b>Ihre Mailadresse:<br>(f&#252;r R&#252;ckfragen)</b></td>\n";
						echo "<td align='left'><input type='text' name='mail' size='31' value='$mail'></td>\n";
						echo "<td align='left' style='color: red; font-weight: bold;'>".$msg2."</td>\n";
						echo "</tr>\n";
						echo "</tr>\n";
						echo "<tr>\n";
						echo "<td colspan='3'>&nbsp;</td>\n";
						echo "</tr>\n";
						echo "<tr>\n";
						echo "<td align='right' valign='top' width='90'><b>Ihre Nachricht: </b></td>\n";
						echo "<td align='left'><textarea rows='5' cols='35' name='text'>$text</textarea></td>\n";
						echo "<td align='left' style='color: red; font-weight: bold;'>".$msg3."</td>\n";
						echo "</tr>\n";
						echo "<tr>\n";
						echo "<td colspan='3'>&nbsp;</td>\n";
						echo "</tr>\n";
						echo "<tr>\n";
						echo "<td width='90'></td>\n";
						echo "<td align='left' colspan='2'><input type='submit' value='Absenden'></td>\n";
						echo "</tr>\n";
						echo "<tr>\n";
						echo "<td width='90'></td>\n";
						echo "<td><input type='hidden' name='error' value='$error'></td>\n";
						echo "<td></td>\n";
						echo "</tr>\n";
						echo "</form>\n";
					} else {
						$empfang="linuxmailing@web.de, stark@gmx.org";
						$betreff="Anfrage vom EasyPortal";
						$header = "From: ".$mail. "\r\n";
						$header .= "To: ".$mail."\r\n";
						$header .= "Reply-To: ".$mail."\r\n";
						$header .= "MIME-Version: 1.0\r\n";
						$header .= "X-Mailer: PHP\r\n";
						$header .= "Content-type: text/plain; charset=iso-8859-1\r\n";
						$header .= "Content-Transfer-Encoding: 8bit\r\n";
						$Message = str_replace(chr(92), '', $text);
						mail ($empfang, $betreff, $Message, $header);
						echo "<tr>\n";
						echo "<td></td>\n";
						echo "<td><h3>Ihre Nachricht wurde versandt.</h3></td>\n";
						echo "<td></td>\n";
						echo "</tr>\n";
					}
				?>
			</td>
		</tr>
	</table>
</div>
</div>