<?
//  Copyright (c) 2004-2005 randshop
//  http://www.randshop.com
//
//  Unter Lizenz von randshop
//	
//	Letzte Bearbeitung: 24.01.2005


	session_start();

	// Hauptkonfigurationsdatei
	include_once("../../config.inc.php");
	include_once(DATEIPFAD . "db.inc.php");
	if(KUNDENGRUPPEN) {
		include_once(DATEIPFAD . "includes/functions.mod.kundengruppen.inc.php");
	} else {
		include_once(DATEIPFAD . "includes/functions.kundengruppen.inc.php");
	}
	include_once(DATEIPFAD . "includes/functions.artikel.inc.php");
  include_once(DATEIPFAD . "includes/functions.merkmale.inc.php");
	include_once(DATEIPFAD . "includes/functions.kategorie.inc.php");
	//Sessionregister
	include_once(DATEIPFAD . "includes/session_register.inc.php");
	include_once(DATEIPFAD . "includes/global.inc.php");
	//Spracheninclude
	include_once(DATEIPFAD . "includes/language/langu_" . $_SESSION["langu"] . ".inc.php");

if($katId == "")
{
	$_SESSION['kat'] = "";
}
	// Header
	include(DATEIPFAD . "includes/header.inc.php");
	
	
if(!$_GET["menueId"]) {
	$_GET["menueId"] = $_POST["menueId"];
}

$tpl_menueId = $_GET["menueId"];
	
$SQLString = "SELECT * FROM " . TABLE_NAVI . " where id='".$_GET["menueId"]."'";
$MySQLQueryReference = mysql_query($SQLString);
$TopnaviObject = mysql_fetch_object($MySQLQueryReference);



// Abfrage nach Online Status
if($TopnaviObject->aktiv == "1") {



$tpl_topnaviName = $TopnaviObject->headline;
if($TopnaviObject->bigImage != "") {
	if(file_exists("../../images/dbimages/" . $TopnaviObject->bigImage)) 	{
		$imageSize = getimagesize("../../images/dbimages/" . $TopnaviObject->bigImage);
		$tpl_topImage =  "<img src=\"../../images/dbimages/" . $TopnaviObject->bigImage . "\" width=\"" . $imageSize[0] . "\" height=\"" . $imageSize[1] . "\" border=\"0\" align=\"left\">\n";
	}
}
$tpl_topEintrag = nl2br(stripslashes($TopnaviObject->textEintrag)) . "<br><br>\n";
	
	
if($_POST["submit"]) {
	if (($_POST["name"] == "") || ($_POST["tel"] == "") || ($_POST["betreff"] == "") || ($_POST["nachricht"] == ""))
  {
  	$tpl_formFehler = "<br><b>".$u_ausfuellFehler."</b><br>\n";
		$tpl_formFehlerText = $u_sternFelder . "<br><br>";
  }
	elseif(is_mail($_POST["formEmail"]) == false)
	{
		$tpl_formFehler = "<br><b>".$u_ausfuellFehler."</b><br>\n";
		$tpl_formFehlerText = $lang_emailInkorrekt . "<br><br>";
	}
  else
  {
	  $mailText = "Anfrage zum Thema " . $_POST["betreff"] . "\n\nName: " . $_POST["name"] . "\nFirma:" . $_POST["firma"] . "\nTelefon:" . $_POST["tel"] . "\nFax: " . $_POST["fax"] . "\nE-Mail: " . $_POST["formEmail"] . "\n\n".$_POST["nachricht"];
     $e_mail = mail($rowAll->email,$_POST["betreff"], $mailText, "From: ".$_POST["formEmail"]."\nReply-To: ".$_POST["formEmail"]);

   	$_POST["name"] ="";
		$_POST["firma"] ="";
		$_POST["tel"] ="";
		$_POST["fax"] ="";
		$_POST["formEmail"] ="";
		$_POST["betreff"] ="";
		$_POST["nachricht"] ="";
	  $tpl_formErfolgreich = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
    $tpl_formErfolgreich .= "<tr><td>\n";
    $tpl_formErfolgreich .= "<br><b>".$lang_anfrage_erfolgreich."</b></td></tr></table><br><br>\n";
	}
}


$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/kontakt/formular.tpl";
	
	


} // Ende Abfrage onlinestatus
else {
	$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/kein_inhalt.tpl";
}


// Letzte globale Zusammenfassung z.B. fuer Warenkorbanzeige, bevor das Template geladen wird.
include(DATEIPFAD . "includes/footer.inc.php");


// Template
include(DATEIPFAD . "templates/" . $rowTemp->name . "/index.tpl");

	
@mysql_close($db);
?>
