;(function($,document,window){

    offset_header();
    $(document).ready(function(){
        $("#topMainBnr div.slideFrame img").attr('src_l', $("#topMainBnr div.slideFrame img").attr('src'));
        flushFrontImage();

    });
    $(window).resize(function(){flushFrontImage()});


    var flushFrontImage = function(){
        if ( $(window).width() <= 969 && bizvektor_vast['theme_plus_mobile']) {
            $("#topMainBnr div.slideFrame img").attr('src', bizvektor_vast['theme_plus_mobile']);

        }else{
            $("#topMainBnr div.slideFrame img").attr('src', $("#topMainBnr div.slideFrame img").attr('src_l'));

        }
    }


    $(document).ready(function(){
        offset_header();
    });
    $(window).resize(function(){
        offset_header();
    });
    /*----------------------------------------------------------*/
    /*  Offset header for admin bar
    /*----------------------------------------------------------*/
    
    function offset_header(){
        var headerHeight = $('#header').height();
        //$('body').css("padding-top",headerHeight+"px");
        if ( $('body').hasClass('admin-bar') ){
            var adminBarHeight = $('#wpadminbar').height();
            
            var allHead_height = adminBarHeight + headerHeight;
            $('.admin-bar .navbar-fixed-top').css("top",adminBarHeight+"px");
            
        }
    }

    /*-------------------------------------------*/
    /*  Header height changer
    /*-------------------------------------------*/
    $(document).ready(function(){
        var imagearea = 0;
        var header = $("#header");

        if($("#topMainBnr")[0]){imagearea=$("#topMainBnr").height();}
        else{imagearea=230;}

        $(window).scroll(function () {
            var bodyWidth = $(window).width();
            // ウィンドウサイズが768より大きい場合
            if ( bodyWidth >= 969 ) {
                var scroll = $(this).scrollTop();
                if (scroll > 10) {
                    head_low();
                } else {
                    head_high();
                }
                if(!bizvektor_vast['headerAreaBg']){
                    //var bodyHeight = imagearea;
                    // if (scroll > bodyHeight - header.height()){
                    if (scroll > 50){
                        header.addClass("opacyHeader");
                    } else {
                        header.removeClass("opacyHeader");
                    }
                }

            } else {
                head_low();
            }
        });
    });

    function head_low(){
        $('#header #headerInner').stop().animate({
            "padding-top":"5px",
            "padding-bottom":"5px",
        },100);
        $('.navbar-brand img').stop().animate({
            "max-height":"45px",
        },100);
    }
    function head_high(){
        $('#header #headerInner').stop().animate({
            "padding-top":"22px",
            "padding-bottom":"10px",
        },100);
        $('.navbar-brand img').stop().animate({
            "max-height":"50px",
        },100);
    }
    function head_collor(){

    }
})(jQuery,document,window);


/*----------------------------------------------------------*/
/*  Top slide control
/*----------------------------------------------------------*/
jQuery('#top__fullcarousel .carousel-indicators li:first-child').addClass("active");
jQuery('#top__fullcarousel .item:first-child').addClass("active");
