<?php
//error_reporting(E_ALL ^ E_DEPRECATED); ini_set('display_errors', 1);
session_start();
include('script/variablen.php');
include('connect.php');

$datei = "neuheiten.php";
?>
<!DOCTYPE html>
<html lang="de-CH">
<head>

<?php include('page_meta.php'); ?>

	<title>Exklusiv bei Fux - Fux Elektrowerkzeuge GmbH, Rümlingen</title>

<?php include('page_css.php'); ?>

<style>
html {
	scroll-behavior:smooth;
}

.markenlogos {
	width:200px; height:65px; display:flex; justify-content:center; align-items:center;
}
	
.set_abstand {
	height:100px
}

@media only screen and (max-width : 1130px) {
	.set_abstand {
		height:90px
	}
}

@media only screen and (max-width : 767px) {
	.set_abstand {
		height:40px
	}
}
</style>

<?php include('page_script_top.php'); ?>

</head>

<?php
// WENN Cookie Admin aktiv
if ( !empty($_COOKIE["administrator"]) == 1 )
{
	echo '<body class="admin">'."\n";
}
else
{
	echo '<body oncontextmenu="return false">'."\n";
}

include('page_header.php'); ?>

<div id="content">

<section>

	<h1>Exklusiv bei Fux</h1>

	<article>
<?php
$result_marke_trenner = mysqli_query($dbi,"SELECT nummer, marke, www, bildname, bild_w_1, bild_h_1 FROM marken WHERE aktiv='1' ORDER BY sort, marke");

echo '<div class="clear footer_marken">';

while($row_marke_trenner = mysqli_fetch_assoc($result_marke_trenner)) {

$result_produkt = mysqli_query($dbi,"SELECT nummer FROM produkte WHERE marke='".$row_marke_trenner['nummer']."' AND exklusiv='1'");

	if ( mysqli_num_rows($result_produkt) != 0 )
	{
		$filemarke = 'images/logos/'.$row_marke_trenner['bildname'].'.svg';

		if (file_exists($filemarke))
		{
			echo '<a href="#'.$row_marke_trenner['nummer'].'" class="markenlogos"><img src="images/logos/'.$row_marke_trenner['bildname'].'.svg" alt="'.$row_marke_trenner['marke'].'" width="'.$row_marke_trenner['bild_w_1'].'" height="'.$row_marke_trenner['bild_h_1'].'" class="logo_schatten"/></a>';
		}
		else
		{
			$bild_groesse = getimagesize ("images/logos/".$row_marke_trenner['bildname'].".png");
			$bild_breite = $bild_groesse[0];
			$bild_hoehe = $bild_groesse[1];

			echo '<a href="#'.$row_marke_trenner['nummer'].'" class="markenlogos"><img src="images/logos/'.$row_marke_trenner['bildname'].'.png" alt="'.$row_marke_trenner['marke'].'" width="'.$bild_breite.'" height="'.$bild_hoehe.'" class="logo_schatten"/></a>';
		}
	}
}

echo '</div>';

$result_marke_trenner = mysqli_query($dbi,"SELECT nummer, marke, www, bildname, bild_w_1, bild_h_1 FROM marken WHERE aktiv='1' ORDER BY sort, marke");

	while($row_marke_trenner = mysqli_fetch_assoc($result_marke_trenner)) {

	$result_produkt = mysqli_query($dbi,"SELECT nummer FROM produkte WHERE marke='".$row_marke_trenner['nummer']."' AND exklusiv='1'");

		if ( mysqli_num_rows($result_produkt) != 0 )
		{
			$link = ''.$datei.'?marke='.$row_marke_trenner['nummer'].'';

			echo '<div class="clear set_abstand" id="'.$row_marke_trenner['nummer'].'"></div>
			<div class="black_logo"><a href="hauptrubrik.php?marke='.$row_marke_trenner['nummer'].'">';

			$filemarke = 'images/logos/'.$row_marke_trenner['bildname'].'.svg';

			if (file_exists($filemarke))
			{
				echo '<img src="images/logos/'.$row_marke_trenner['bildname'].'.svg" alt="'.$row_marke_trenner['marke'].'" width="'.$row_marke_trenner['bild_w_1'].'" height="'.$row_marke_trenner['bild_h_1'].'"/>';
			}
			else
			{
				$bild_groesse = getimagesize ("images/logos/".$row_marke_trenner['bildname'].".png");
				$bild_breite = $bild_groesse[0];
				$bild_hoehe = $bild_groesse[1];

				echo '<img src="images/logos/'.$row_marke_trenner['bildname'].'.png" alt="'.$row_marke_trenner['marke'].'" width="'.$bild_breite.'" height="'.$bild_hoehe.'"/>';
			}

			echo '</a></div>
			<div class="clear"></div>
			<div class="navi titel rund abstand_top_2 abstand_bottom">'.$row_marke_trenner['marke'].'</div>';

			include('produkte_layout_result.php');
			$result .= "WHERE p.exklusiv='1' AND p.marke='".$row_marke_trenner['nummer']."'
			ORDER BY m.marke, p.produkt";
			$result = mysqli_query($dbi, $result);

			// Prüfen ob Black aktiv
			$result_black = mysqli_query($dbi,"SELECT black_von FROM black WHERE black_von <= '$datum' AND black_bis >= '$datum'");

			while($row = mysqli_fetch_assoc($result)) {
			include('produkte_layout.php');
			}
		}
	}
?>
	</article>

<?php include('page_last.php'); ?>

</section>

</div>

<?php include('page_footer.php'); ?>

<?php include('page_script_bottom.php'); ?>

</body>
</html>