<script>
import { onMount } from 'svelte';

let name = "mySlides";
let slideIndex = 1;


// Next/previous controls
function plusSlides(n) {
  console.log("changing slides");
  showSlides(slideIndex += n, name);
}

// Thumbnail image controls
function currentSlide(n) {
  showSlides(slideIndex = n, className);
}

function showSlides(n) {
  var i;
  var slides = document.getElementsByClassName(name);
  var dots = slides.children.filter((x) => x.classList.indexOf("dot") > -1);
  if (n > slides.length) {slideIndex = 1}
  if (n < 1) {slideIndex = slides.length}
  for (i = 0; i < slides.length; i++) {
      slides[i].style.display = "none";
  }
  for (i = 0; i < dots.length; i++) {
      dots[i].className = dots[i].className.replace(" carousel-active", "");
  }
  slides[slideIndex-1].style.display = "block";
  dots[slideIndex-1].className += " carousel-active";
} 


</script>



<section class="row" style="margin-top: 4vh" id="dalsi">
	<section class="col">
		<link rel="stylesheet" href="/css/carousel.css">
		 <!-- Slideshow container -->
		<div class="slideshow-container">

    		<slot></slot>

		  <!-- Full-width images with number and caption text -->
		  <div class="mySlides fade">
		    <div class="numbertext">1 / 3</div>
    		<video class="smol-video" controls style="width: 100%">
    			<source src="/video/5_lenka.mp4" type="video/webm">
    			Your browser does not support video.
    		</video>
		  </div>

		  <div class="mySlides fade">
		    <div class="numbertext">2 / 3</div>
    		<video class="smol-video" controls style="width: 100%">
    			<source src="/video/4_holka_pozvanka.mp4" type="video/webm">
    			Your browser does not support video.
    		</video>
		  </div>

		  <!-- Next and previous buttons -->
		  <a class="prev" onclick="plusSlides(-1)" href="/predseda#0">&#10094;</a>
		  <a class="next" onclick="plusSlides(1)" href="/predseda#0">&#10095;</a>
		</div>
		<br>

		<!-- The dots/circles -->
		<div style="text-align:center">
		  <span class="dot" onclick="currentSlide(1)"></span>
		  <span class="dot" onclick="currentSlide(2)"></span>
		</div>
	</section>
	<script src="js/carousel.js"></script>
</section>

