var images = new Array();
function preload() {
    for (i = 0; i < preload.arguments.length; i++) {
        images[i] = new Image();
        images[i].src = preload.arguments[i];
        console.log("preload file: " + preload.arguments[i]);
    }
}
function playVideo3() {
    var mediaPlayer;
    mediaPlayer = document.getElementById('media-video-3');
    mediaPlayer.controls = false;
    mediaPlayer.play();
}

function playVideo4() {
    var mediaPlayer;
    mediaPlayer = document.getElementById('media-video-4');
    mediaPlayer.controls = false;
    mediaPlayer.play();
}

function playVideo5() {
    var mediaPlayer;
    mediaPlayer = document.getElementById('media-video-5');
    mediaPlayer.controls = false;
    mediaPlayer.play();
}

$(document).ready(function() {
	


    preload(
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/galaxy_1280_06-2.jpg",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/galaxy_1024_06-2.jpg",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/galaxy_780_06-2.jpg",

        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_front_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_right_side_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_right_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_left_side_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_left_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_back_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_front_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_right_side_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_right_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_left_side_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_left_orchidgray_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_back_orchidgray_s4.png",

        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_front_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_right_side_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_right_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_left_side_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_left_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8_gallery_back_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_front_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_right_side_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_right_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_left_side_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_left_arcticsilver_s4.png",
        "https://images.colombo.com.br/hotsite/GalaxyS8animated/animado/img/gallery/galaxy-s8-plus_gallery_back_arcticsilver_s4.png"
    );

    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        slidesPerView: $("#containerIsee").width() < 1024 ? 5 : 6,
        centeredSlides: true,
        paginationClickable: true,
        /*autoplay: 2000,*/
        spaceBetween: 10,
		nextButton: '.swiper-button-next',
		prevButton: '.swiper-button-prev'
    });

	setInterval(function(){ playVideo3() }, 12000);
	setInterval(function(){ playVideo4() }, 12000);
	setInterval(function(){ playVideo5() }, 12000);


    $("#containerIsee #bloco06 .isee-menu a").click(function(e){
        console.log("troca imagem");
        e.preventDefault();

        $("#containerIsee #bloco06").removeClass("stickers");
        $("#containerIsee #bloco06").removeClass("smart");
        $("#containerIsee #bloco06 .isee-menu a").removeClass("active");

        $(this).addClass("active");
        $("#containerIsee #bloco06").addClass($(this).attr("data-value"));
        
    });

	
	//animação do swiper indo para esquerda
	$(".swiper-wrapper").css('left', '2000px');
	
		
    $("#containerIsee #bloco03B .swiper-color-selector a").click(function(e){
		
		
		
        e.preventDefault();
		
		$("#containerIsee #bloco03B .swiper-color-selector a").removeClass("active");
		 
        $("#containerIsee #bloco03B").removeClass("black", 500);
        $("#containerIsee #bloco03B").removeClass("orchidgray", 500);
        $("#containerIsee #bloco03B").removeClass("arcticsilver", 500);
        
		$(this).addClass("active");
        $("#containerIsee #bloco03B").addClass($(this).attr("class"), 500);
    });
	
	$(".swiperArrowLeft").click(function(){
		alert('vai');
	});
});

//animação do swiper indo para esquerda
var swiperScrolled = false;
$(window).scroll(function(){
	if(swiperScrolled)
		return;
	
	var scrollPos = $(window).scrollTop();
	
	if(scrollPos > 1000){
		swiperScrolled = true;
		$(".swiper-wrapper").animate({left: '0px'}, 2000);
	}
});

