function View(data){
    var varUA = navigator.userAgent.toLowerCase();
    this._data = data?data:{};
    this._t = new Tools();
    this._unitInfo = {
             __isiOSApp : (/iosacf/.test(varUA)),
             __isIos : /iphone|ipad|ipod/.test(varUA),
             __isAndroid : /android/.test(varUA),
             __width : window.innerWidth,
             __height : window.innerHeight //(typeof window.outerHeight != 'undefined')?Math.max(window.outerHeight, $(window).height()):$(window).height()
    }

    this._unitInfo.__isMobile = (this._unitInfo.__isIos || this._unitInfo.__isAndroid)?1:0;
}

(function() {
    this.init = function(data)
    {
        var self = this;
            self._const = data;

            if(self._const.__isMobile) {
                var sliderheight = $('.sliderwrap1 .bigimg').height();
                    // $('.sliderwrap1').css('height',((sliderheight*2)+30)+'px');
            }

            if($('#floatDiv').length>0) {
                var distance = $('#floatDiv').offset().top;
            } else {
                var distance = 0;
            }
            

            $('body').scroll(function () {
                // var scrolltop = $('body').scrollTop();
                // var footertop = $('.footer-bs').offset().top;
                // var fixtop = 0;
                // // console.log(scrolltop,distance,footertop);
                //  if (scrolltop+90 >= distance) {
                //         $('#floatDiv').css('top',scrolltop+'px');
                //     // if(footertop<(scrolltop+90))
                //     // {
                //     //     $('#floatDiv').css('top',(footertop-900)+'px');
                //     // } else {
                //     //     $('#floatDiv').css('top',scrolltop+'px');
                //     // }
                //  } else {
                //     $('#floatDiv').css('top','-60px');
                //  }
             });

            // console.log(self._unitInfo);
            self.sliderInit();
            // self.boardInit();
            self.popupInit();
            // self.magnifPopup();
            // self.mediaInit();

            $('#productTab span').click( function(){
                var idx = Number($(this).attr('idx'));
                    // $('#slider2').sliderStop(idx-1);
                    // self.brandSlider.goToSlide(idx-1);
                    $('#slider3').sliderStop().sliderUpdate(idx-1);
                    $('#productTab span').removeClass('active');
                    $(this).addClass('active');
            });

            $('.tab-menu').click( function(){
                var idx = $(this).data('idx');
                // console.log(idx);
                $('.tab-menu').removeClass('active');
                $('.smegtab-slide-list').slick('slickGoTo', idx);
                $(this).addClass('active');
            });
    };

    this.magnifPopup = function() {
        var self = this;
        $('.image-popup').magnificPopup({
            type: 'image',
            removalDelay: 300,
            mainClass: 'mfp-with-zoom',
            gallery:{
                enabled:true
            },
            zoom: {
                enabled: true, // By default it's false, so don't forget to enable it

                duration: 300, // duration of the effect, in milliseconds
                easing: 'ease-in-out', // CSS transition easing function

                // The "opener" function should return the element from which popup will be zoomed in
                // and to which popup will be scaled down
                // By defailt it looks for an image tag:
                opener: function(openerElement) {
                // openerElement is the element on which popup was initialized, in this case its <a> tag
                // you don't need to add "opener" option if this code matches your needs, it's defailt one.
                return openerElement.is('img') ? openerElement : openerElement.find('img');
                }
            }
        });
    };

    this.sliderInit = function()
    {
        var self = this;

        const mediaSwiper = new Swiper('.mediaSlide', {
                // Optional parameters
                slidesPerView: 1.1,
                centeredSlides: true,
                slideToClickedSlide: false,
                allowTouchMove : true,
                spaceBetween: 20,
                loop: true,
                autoHeight: false,
        
                navigation: {
                    nextEl: ".nextMdBtn",
                    prevEl: ".prevMdBtn",
                },
                
                pagination: {
                    el: ".swiper-pagination",
                },
        
                breakpoints: {  
                    '768': {
                        slidesPerView: 1.5,
                        spaceBetween: 40,
                    },
                    '1440': {
                    slidesPerView: 1.9,
                    spaceBetween: 120,
                    },
                },
            });

            $('#slider1').slick({
				slide: 'div',		//슬라이드 되어야 할 태그 ex) div, li 
				infinite : true, 	//무한 반복 옵션	 
				slidesToShow : 1,		// 한 화면에 보여질 컨텐츠 개수
				slidesToScroll : 1,		//스크롤 한번에 움직일 컨텐츠 개수
				speed : 1000,	 // 다음 버튼 누르고 다음 화면 뜨는데까지 걸리는 시간(ms)
				arrows : true, 		// 옆으로 이동하는 화살표 표시 여부
				dots : false, 		// 스크롤바 아래 점으로 페이지네이션 여부
				autoplay : true,			// 자동 스크롤 사용 여부
				autoplaySpeed : 5000, 		// 자동 스크롤 시 다음으로 넘어가는데 걸리는 시간 (ms)
				pauseOnHover : false,		// 슬라이드 이동	시 마우스 호버하면 슬라이더 멈추게 설정
				vertical : false,		// 세로 방향 슬라이드 옵션
				prevArrow : $('.slickPrev'),		// 이전 화살표 모양 설정
				nextArrow : $('.slickNext'),		// 다음 화살표 모양 설정
				dotsClass : "slick-dots", 	//아래 나오는 페이지네이션(점) css class 지정
				draggable : true, 	//드래그 가능 여부 
                // variableWidth : true,
				
				responsive: [ // 반응형 웹 구현 옵션
					{  
						breakpoint: 960, //화면 사이즈 960px
						settings: {
							//위에 옵션이 디폴트 , 여기에 추가하면 그걸로 변경
							slidesToShow:1 
						} 
					},
					{ 
						breakpoint: 768, //화면 사이즈 768px
						settings: {	
							//위에 옵션이 디폴트 , 여기에 추가하면 그걸로 변경
							slidesToShow:1 
						} 
					}
				]
			});

            $('#slider1').on('afterChange',function(){
                $(".pro-bar").addClass('pro-ani');
            });

            $("#slider1").on('beforeChange',function(){
               $(".pro-bar").removeClass('pro-ani');
            });

            $('#slider2').slick({
				slide: 'div',		//슬라이드 되어야 할 태그 ex) div, li 
				infinite : true, 	//무한 반복 옵션	 
				slidesToShow : 1,		// 한 화면에 보여질 컨텐츠 개수
				slidesToScroll : 1,		//스크롤 한번에 움직일 컨텐츠 개수
				speed : 1000,	 // 다음 버튼 누르고 다음 화면 뜨는데까지 걸리는 시간(ms)
				arrows : true, 		// 옆으로 이동하는 화살표 표시 여부
				dots : true, 		// 스크롤바 아래 점으로 페이지네이션 여부
				autoplay : false,			// 자동 스크롤 사용 여부
				autoplaySpeed : 5000, 		// 자동 스크롤 시 다음으로 넘어가는데 걸리는 시간 (ms)
				pauseOnHover : false,		// 슬라이드 이동	시 마우스 호버하면 슬라이더 멈추게 설정
				vertical : false,		// 세로 방향 슬라이드 옵션
				prevArrow : "<button type='button' class='slick-prev'>Previous</button>",		// 이전 화살표 모양 설정
				nextArrow : "<button type='button' class='slick-next'>Next</button>",		// 다음 화살표 모양 설정
				dotsClass : "slick-dots", 	//아래 나오는 페이지네이션(점) css class 지정
				draggable : true, 	//드래그 가능 여부 
                // variableWidth : true,
				
				responsive: [ // 반응형 웹 구현 옵션
					{  
						breakpoint: 960, //화면 사이즈 960px
						settings: {
							//위에 옵션이 디폴트 , 여기에 추가하면 그걸로 변경
							slidesToShow:1 
						} 
					},{ 
						breakpoint: 768, //화면 사이즈 768px
						settings: {	
							//위에 옵션이 디폴트 , 여기에 추가하면 그걸로 변경
							slidesToShow:1
						} 
					}
				]

			});

            // if(!self._const.__isMobile) {
                $('.smegtab-slide-list').slick({
                    dots: true,
                    infinite: true,
                    speed: 500,
                    fade: true,
                    cssEase: 'linear'
                });
            // }

            // if(self._const.__isMobile)
            // {
            // }

            $(".inline-video").click( function() { 
                if (!$(this).hasClass("active")) {
                    var type = $(this).data('type');
                    var video = $(this).data('videoid');
                    var vlink = '';
                        if(video.substr(0,4)=='http')
                        {
                            vlink = video;
                        } else {
                            vlink = 'https://www.youtube.com/embed/'+video;
                        }
                        // <iframe width="1280" height="720" src="https://www.youtube.com/embed/cPH0nBCm-iA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                    if (type === 'youtube') { 
                        var $iframe=$('<iframe src="'+vlink+'?autoplay=1" width="100%" height="100%" frameborder="0"     allowfullscreen ></iframe>');
                    }
                    var $inlineIframeContainer = $('<div class="inline-iframe-container"></div>');
                    var $closeInlineVideo = $('<div class="close-inline-video"></div>').click( function(){
                            $(this).parents( ".inline-video" ).removeClass('active');
                            $(this).parent( ".inline-iframe-container" ).fadeOut(200).remove();
                            return false;
                    })
                    $inlineIframeContainer.append($iframe,$closeInlineVideo);
                    $(this).addClass('active').append($inlineIframeContainer); //.fadeIn(200);
                };
            });

            mediaSwiper.on('slideChange', function(){
                $('.close-inline-video').trigger('click');
            });
    }

    this.boardInit = function()
    {
        var self = this;
            $('.card-bgimg').each( function(){
                var imgfile = $(this).attr('bgimg');
                // console.log(imgfile);
                $(this).css('background-image','url('+imgfile+')');
            });
    }

    this.popupInit = function()
    {
        var self = this;
            if(self._const.__isMobile)
            {
                $('.popuplayers').each(  function(){
                    $(this).css({'left':0,'top':55,'width':'100%'}).appendTo('#layerwrap');
                });
            }
            $('.hd_pops_close').click( function(){
                var code = $(this).attr('code');
                $('#'+code).hide();
            });

            $('.hd_pops_reject').click( function(){
                var code = $(this).attr('code');
                $.cookie('popup_'+code,'true',{expires:1,path:'/'});
                $('#'+code).hide();
            });
            for(i in self._data.popup_cookie) {
                if( $.cookie('popup_'+self._data.popup_cookie[i]) )
                {
                    $('#'+self._data.popup_cookie[i]).hide();
                } else {
                    // $('#popupwindow').show();
                    $('#'+self._data.popup_cookie[i]).show();
                }
            }
            
    }

    this.initCurationATitle = function()
    {
        var self = this;
            $('.ubea-card-item.image-popup').each( function(){
                var title = $(this).attr('title');
                $('<div />',{'class':'ubea-card-title'}).text(title).appendTo(this);
            });
    }

    this.StartFWDR3DCovUtils = function()
    {
        var self = this;
        // console.log(FWDR3DCovUtils.isMobile);
        var coverflow = new FWDRoyal3DCoverflow({       
            //required settings
            coverflowHolderDivId:"mediaWrap",
            coverflowDataListDivId:"coverflowData",
            displayType:"responsive",
            autoScale:"yes",
            coverflowWidth: FWDR3DCovUtils.isMobile?500:1420,
            coverflowHeight:FWDR3DCovUtils.isMobile?300:600,
            mainFolderPath:"/assets/plugins/FWDRoyal3DCoverflow",
            skinPath:"load/skin_modern_silver/",
            initializeOnlyWhenVisible:"no",
                                         
            //main settings
            backgroundColor:"",
            backgroundImagePath:"",
            thumbnailsBackgroundImagePath:"",
            scrollbarBackgroundImagePath:"",
            backgroundRepeat:"repeat-x",
            showDisplay2DAlways:"yes",
            coverflowStartPosition:"center",
            numberOfThumbnailsToDisplayLeftAndRight:"1",
            slideshowDelay:4000,
            autoplay:"yes",
            showPrevButton:"no",
            showNextButton:"no",
            showSlideshowButton:"no",
            disableNextAndPrevButtonsOnMobile:"yes",
            controlsMaxWidth:1026,
            controlsHeight:25,
            showLargeNextAndPrevButtons:FWDR3DCovUtils.isMobile?"no":"yes",
            largeNextAndPrevButtonsOffest:1220,
            slideshowTimerColor:"#777777",
            showContextMenu:"no",
            addKeyboardSupport:"yes",
            useDragAndSwipe:"yes",
                                         
            //thumbnail settings
            thumbnailWidth:1040,
            thumbnailHeight:FWDR3DCovUtils.isMobile?400:600,
            thumbnailXOffset3D:86,
            thumbnailXSpace3D:78,
            thumbnailZOffset3D:200,
            thumbnailZSpace3D:93,
            thumbnailYAngle3D:70,
            thumbnailXOffset2D:60,
            thumbnailXSpace2D:40,
            thumbnailBorderSize:0,
            thumbnailBackgroundColor:"#666666",
            thumbnailBorderColor1:"#fcfdfd",
            thumbnailBorderColor2:"#e4e4e4",
            transparentImages:"no",
            maxNumberOfThumbnailsOnMobile:13,
            showThumbnailsGradient:"yes",
            showThumbnailsHtmlContent:"no",
            textBackgroundColor:"#333333",
            textBackgroundOpacity:.7,
            showText:"yes",
            showTextBackgroundImage:"yes",
            showThumbnailBoxShadow:"no",
            thumbnailBoxShadowCss:"0px 2px 2px #555555",
            showReflection:"no",
            reflectionHeight:0,
            reflectionDistance:0,
            reflectionOpacity:.2,
                                         
            //scrollbar settings
            showScrollbar:"no",
            disableScrollbarOnMobile:"yes",
            enableMouseWheelScroll:"no",
            scrollbarHandlerWidth:300,
            scrollbarTextColorNormal:"#777777",
            scrollbarTextColorSelected:"#000000",
  
            //bullets navigation settings
            showBulletsNavigation:"no",
            bulletsBackgroundNormalColor1:"#fcfdfd",
            bulletsBackgroundNormalColor2:"#e4e4e4",
            bulletsBackgroundSelectedColor1:"#000000",
            bulletsBackgroundSelectedColor2:"#666666",
            bulletsShadow:"0px 0px 4px #888888",
            bulletsNormalRadius:7,
            bulletsSelectedRadius:8,
            spaceBetweenBullets:16,
            bulletsOffset:0,
                                         
            //lightbox settings
            buttonsAlignment:"in",
            itemBoxShadow:"none",
            descriptionWindowAnimationType:"opacity",
            descriptionWindowPosition:"bottom",
            slideShowAutoPlay:"no",
            addKeyboardSupport:"yes",
            showCloseButton:"yes",
            showShareButton:"yes",
            showZoomButton:"yes",
            showSlideShowButton:"yes",
            showSlideShowAnimation:"yes",
            showNextAndPrevButtons:"yes",
            showNextAndPrevButtonsOnMobile:"no",
            showDescriptionButton:"yes",
            showDescriptionByDefault:"no",
            videoShowFullScreenButton:"yes",
            videoAutoPlay:"no",
            nextVideoOrAudioAutoPlay:"yes",
            videoLoop:"no",
            audioAutoPlay:"no",
            audioLoop:"no",
            backgroundOpacity:0,
            descriptionWindowBackgroundOpacity:.95,
            buttonsHideDelay:3,
            slideShowDelay:4,
            defaultItemWidth:FWDR3DCovUtils.isMobile?300:640,
            defaultItemHeight:FWDR3DCovUtils.isMobile?200:480,
            itemOffsetHeight:50,
            spaceBetweenButtons:1,
            buttonsOffsetIn:2,
            buttonsOffsetOut:5,
            itemBorderSize:5,
            itemBorderRadius:0,
            itemBackgroundColor:"#333333",
            itemBorderColor1:"#fcfdfd",
            itemBorderColor2:"#e4e4e4",
            lightBoxBackgroundColor:"#000000",
            descriptionWindowBackgroundColor:"#FFFFFF",
            videoPosterBackgroundColor:"#0099FF",
            videoControllerBackgroundColor:"#FFFFFF",
            audioControllerBackgroundColor:"#FFFFFF",
            timeColor:"#000000"
        });

    // coverflow.data.thumbWidth = 10000;
    // coverflow.update();
// console.log(coverflow);
    }
}).call(View.prototype);