<?
require_once("../../mysyde/common/common_functions.inc.php");
require_once((local_environment()) ? "../../mysyde/dc.config.php" : "../../mysyde/dc-server.config.php");

db_connect();
extract($_POST);
?>
<link rel="stylesheet" type="text/css" href="../../plugins/magicslideshow/magicslideshow.css">
<!--<style src="../../plugins/magicslideshow/magicslideshow.css" ></style>-->

<script type="text/javascript">
    /*<![CDATA[*/
    MagicSlideshow.extraOptions.preview = {
        'speed'            : <?= $interval ?>,
        'thumbnail-opacity': 1,
        'effect'           : '<?= $effect ?>',
        'container-opacity': 0,
        'width'            : <?= $width?>,
        'height'           : <?= $height?>,
        'effect-duration'  : <?= $effect_duration ?>,
        <?php IF ($arrows <> ''){echo "'arrows': 'no',\n";}?>
        'text-effect'      : '<?= $text_effect ?>',
        'text-position'    : '<?= $text_pos ?>'
    }
    /*]]>*/
</script>
<?
require_once("slideshow.config.inc.php");
$query   = "SELECT * FROM slideshow_entry WHERE main_navigation_has_sitepart_id = '" . $sitepart_id . "' ORDER BY sorting DESC";
$result1 = mysqli_query($GLOBALS['mysql_con'], $query);
$query2  = "SELECT * FROM slideshow_options WHERE sitepart_id = '" . $sitepart_id . "'";
$result2 = mysqli_query($GLOBALS['mysql_con'], $query2);
$row2    = mysqli_fetch_array($result2);
extract($row2);
?>

<?

echo "<div id=\"preview\" class=\"MagicSlideshow\">\n";
WHILE ($row1 = mysqli_fetch_array($result1)) {

    IF ($row1["link"] <> "") {
        $link = $row1["link"];
    } ELSE {
        $link = "";
    }

    echo "<a href=\"" . $link . "\">";
    $img = "\t<img src=\"" . PATH_ORIGINAL_FRONTEND . "resize_" . $row1['id'] . "_" . $row1['description'] . ".jpg\" alt=\"" . $row1['headline'] . "\" />\n";
    echo $img;

    echo "\t<span>" . $row1['text'] . "</span>\n";
    echo "</a>\n";

}
echo("\n</div>\n");
?>


