<?
require_once("slideshow.config.inc.php");
$query   = "SELECT * FROM slideshow_header WHERE id = '" . $sitepart_id."'";
$result1 = @mysqli_query($GLOBALS['mysql_con'], $query);
$row1    = mysqli_fetch_array($result1);

$query2  = "SELECT * FROM slideshow_line WHERE header_id = '" . $sitepart_id . "' ORDER BY sorting ASC";
$result2 = @mysqli_query($GLOBALS['mysql_con'], $query2);
?>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#a<?=$sitepart_id?>.owl-carousel").owlCarousel(
                {
                    autoplay:true,
                    autoplayTimeout: <?=$row1['eff_interval'] * 1000?>,
                    loop: true,
                    items: 1,
                    responsiveClass: true,
                    animateOut: 'fadeOut',
                    nav: true,
                    navText: ['&#xf104;', '&#xf105;']
                }
            );
        });
    </script>
    <style>
        .slideshow_box .owl-carousel-item.animated {
            -webkit-animation-duration : <?=$row1['effect_duration'] / 100?>s  ;
            animation-duration : <?=$row1['effect_duration'] /100?>s  ;
            height: <?echo $row1['height']?>px;
        }
    </style>
<?php



echo "<div class=\"slideshow_box\"><div id=\"a" . $sitepart_id . "\" class=\"owl-carousel\">";
WHILE ($row2 = mysqli_fetch_array($result2)) {
    echo "<div class='owl-carousel-item animated'  style=\"background-image:url(".PATH_ORIGINAL_FRONTEND . $row2['filename'].")\">";
    if($row2['link'] <> "") {
        echo "<a href=\"" . $row2["link"] . "\">";
    }
    ?>
    <?/*<img src="<?=PATH_ORIGINAL_FRONTEND . $row2['filename']?>" />*/?>
    <div class="slideshow_content container">
    <? if($row2['headline'] <> "" || $row2['text'] <> "" || $row2['text2'] <> "") { ?>
        <div class="slideshow_content_inner">
            <? if($row2['headline'] <> "") { ?>
                <div class="slideshow_headline">
                    <div class="slideshow_headline_inner">
                        <?=$row2['headline']?>
                    </div>
                </div>
            <? }?>
            <? if($row2['text'] <> "") { ?>
                <div class="slideshow_text">
                    <div class="slideshow_text_inner">
                        <?=$row2['text']?>
                    </div>
                </div>
            <? }?>
            <? if($row2['text2'] <> "") { ?>
                <div class="slideshow_text2">
                    <div class="slideshow_text2_inner">
                        <?=$row2['text2']?>
                    </div>
                </div>
            <? }?>
            <? if($row2['link'] <> "") { ?>
                <div class="slideshow_button">
                    <div class="button"><?=$GLOBALS['tc']['slideshow_button']?></div>
                </div>
            <? }?>
        </div>
    <? }?>
    </div>
    <? if($row2['link'] <> "") {
        echo "</a>";
    }
    echo "</div>";
}
echo("</div></div>\n");
?>