// 메인슬라이드
$(document).ready(function(){
    $('.big_slide').owlCarousel({
        items:1,
        animateOut:'fadeOut',
        animateIn:'fadeIn',
        loop:true,
        margin:0,
        smartSpeed: 2000, // 슬라이드 애니메이션 속도 (1000s = 1초)
        nav: false, // 화살표 컨트롤 사용
        autoplay: true, // 자동재생
        autoplayTimeout: 5000, // 자동재생 간격 (1000s = 1초)
        autoplayHoverPause: false, // 마우스 오버시 자동재생 멈춤
        navText:['<i class="xi-angle-left-thin"></i>', '<i class="xi-angle-right-thin"></i>']
    });    
});
// 메인 미니 롤링 슬라이드
$(document).ready(function(){
    $('.mini_rolling').owlCarousel({
        items:4,
        loop:true,
        margin:0,
        smartSpeed: 2000, // 슬라이드 애니메이션 속도 (1000s = 1초)
        nav: true, // 화살표 컨트롤 사용
        autoplay: true, // 자동재생
        autoplayTimeout: 5000, // 자동재생 간격 (1000s = 1초)
        autoplayHoverPause: true, // 마우스 오버시 자동재생 멈춤
        navText:['<i class="xi-angle-left-thin"></i>', '<i class="xi-angle-right-thin"></i>'],
		responsive: {
			0:{
				items:2
			},
			480:{
				items:2
			},
			768:{
				items:3
			},
			1024:{
				items:4
			},
			1280:{
				items:4
			}
		}
			
    });    
});

// 서비스 스크립트 옵션 입니다.
// 현재 최대 이미지 수가 3이며, 슬라이드를 추가하고 싶을 때엔
// 아래 옵션중 maxSlides:3 의 값을 추가하신 갯수로 변경해주세요.
$(document).ready(function() {
	$('.slider').bxSlider({
		// 옵션 설정
		mode: 'horizontal', // 건들지 말것
		infiniteLoop: true, // 무한슬라이드 옵션
		auto: true, // 자동 옵션
		pause: 6000, // 슬라이드가 멈추어 있는 시간 (6000 = 6초)
		pager: true, // 이전, 다음 버튼 사용 여부
		touchEnabled: true, // 스마트폰에서 터치로 넘길수 있는지 여부
		useCSS: true, // CSS 사용 여부
		tickerHover: true, // 마우스를 올렸을 때 이미지가 멈추는지 여부
		minSlides: 1, // 슬라이드 이미지 최소값 1고정
		maxSlides: 3, // 슬라이드 이미지 최대값 li의 개수의 따라 변경
		slideWidth: 0, // 슬라이드의 width값 : 0일 경우 자동 조정
	});
});

// 섹션2 슬라이드 - 오른쪽 이미지
$(window).load(function() {
    var idx = 0;
    var slideWrap = $("#mid_slide1");
    var slideWidth = slideWrap.children().width();
    var slideCount = slideWrap.children().length;
    var prev = $("a.prev");
    var next = $("a.next");
    var duration = 300000;
    var slidebody = function() {
        slideWrap.stop(true, false).animate({
            "left": -slideWidth * idx
        }, 500, 'easeOutCubic');
    }
    prev.click(function() {
        if (idx <= 0) {
            idx = slideCount - 1;
        } else {
            idx--;
        }
        slidebody();
    });
    next.click(function() {
        if (idx >= slideCount - 1) {
            idx = 0;
        } else {
            idx++;
        }
        slidebody();
    });
    var autoSlide = setInterval(function() {
        if (idx >= slideCount - 1) {
            idx = 0;
        } else {
            idx++;
        }
        slidebody();
    }, duration);
});
// 섹션2 슬라이드 - 왼쪽 텍스트
$(window).load(function() {
    var idx = 0;
    var slideWrap2 = $("#mid_slide2-");
    var slideWidth2 = slideWrap2.children().width();
    var slideCount2 = slideWrap2.children().length;
    var prev = $("a.prev");
    var next = $("a.next");
    var duration = 300000;
    var slidebody2 = function() {
        slideWrap2.stop(true, false).animate({
            "left": -slideWidth2 * idx
        }, 500, 'easeOutCubic');
    }
    prev.click(function() {
        if (idx <= 0) {
            idx = slideCount2 - 1;
        } else {
            idx--;
        }
        slidebody2();
    });
    next.click(function() {
        if (idx >= slideCount2 - 1) {
            idx = 0;
        } else {
            idx++;
        }
        slidebody2();
    });
    var autoSlide2 = setInterval(function() {
        if (idx >= slideCount2 - 1) {
            idx = 0;
        } else {
            idx++;
        }
        slidebody2();
    }, duration);
});