(function($) {
  "use strict";
/* =================================
===        STICKY HEADER        ====
=================================== */
jQuery(window).on('load', function() { 
  // Enable Hover for Bootstrap Nav Dropdowns
  jQuery('.mg-search-box').hover(function() {
       jQuery(this).addClass('open');
     }, function() {
       jQuery(this).removeClass('open');
  }); 
});

function homefeatured() {
 var recentareaSlider = new Swiper('.recentarea-slider', {
  direction: 'vertical',
  loop: true,
                slidesPerView: 6,
                spaceBetween: 0,
                autoplay: true,
                breakpoints: {
                    // when window width is <= 320px
                    768: {
                        allowTouchMove: 0,

                    },
                }
            });

}
homefeatured();
function homemain() {
  var Homemain = new Swiper('.homemain', {
    direction: 'horizontal',
    loop: true,
    autoplay: true,
    slidesPerView: 1,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    }
  });              
}
homemain(); 
// featured post
function editorchoice() {
  var Editorchoice = new Swiper('.editorchoice', {
    direction: 'horizontal',
    loop: false,
    autoplay: true,
    slidesPerView: 1,
    pagination: {
        el: '.swiper-pagination',
      },
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    },
    breakpoints: {
        640: {
          slidesPerView: 2,
          spaceBetween: 20,
        },
        768: {
          slidesPerView: 4,
          spaceBetween: 30,
        },
        1024: {
          slidesPerView: 4,
          spaceBetween: 30,
        },
      }
  });   
}
editorchoice(); 
// featured post

// featured post
function postcrousel() {
  var postcrousel = new Swiper('.postcrousel', {
    direction: 'horizontal',
    loop: true,
    autoplay: true,
    slidesPerView: 1,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    }
  });              
}
postcrousel(); 
// featuredcat crowsel
function featuredcat() {
  var featuredcat = new Swiper('.featuredcat', {
    direction: 'horizontal',
    loop: false,
    autoplay: true,
    slidesPerView: 1,
    spaceBetween: 2,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    },
    breakpoints: {
        640: {
          slidesPerView: 2,
        },
        768: {
          slidesPerView: 4,
        },
        1024: {
          slidesPerView: 3,
        },
      }
  });              
}
featuredcat(); 
// featuredcat crowsel
// featuredcat crowsel
function no_gutter() {
  var no_gutter = new Swiper('.no_gutter', {
    direction: 'horizontal',
    loop: false,
    autoplay: true,
    slidesPerView: 1,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    },
    breakpoints: {
        640: {
          slidesPerView: 2,
        },
        768: {
          slidesPerView: 4,
        },
        1024: {
          slidesPerView: 4,
        },
      }
  });              
}
no_gutter(); 
// no_gutter crowsel
// featuredcat crowsel
function nolist_crowsel() {
  var nolist_crowsel = new Swiper('.nolist_crowsel', {
    direction: 'horizontal',
    loop: false,
    autoplay: true,
    slidesPerView: 1,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    },
    breakpoints: {
        640: {
          slidesPerView: 2,
        },
        768: {
          slidesPerView: 4,
        },
        1024: {
          slidesPerView: 3,
          spaceBetween: 30,
        },
      }
  });              
}
nolist_crowsel(); 
// nolist_crowsel
// colmnthree crousel
function colmnthree() {
  var colmnthree = new Swiper('.colmnthree', {
    direction: 'horizontal',
    loop: false,
    autoplay: true,
    slidesPerView: 1,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    },
    breakpoints: {
        640: {
          slidesPerView: 2,
          spaceBetween: 20,
        },
        768: {
          slidesPerView: 4,
          spaceBetween: 30,
        },
        1024: {
          slidesPerView: 3,
          spaceBetween: 30,
        },
      }
  });              
}
colmnthree();

function instagallery() {
  var instagallery = new Swiper('.instagallery', {
    direction: 'horizontal',
    loop: false,
    autoplay: true,
    slidesPerView: 1,
    // Navigation arrows
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev'
    },
    breakpoints: {
        640: {
          slidesPerView: 2,
          spaceBetween: 20,
        },
        768: {
          slidesPerView: 4,
          spaceBetween: 30,
        },
        1024: {
          slidesPerView: 3,
          spaceBetween: 30,
        },
      }
  });              
}
instagallery(); 

function marquee() {
  jQuery('.marquee').marquee({
  speed: 50,
  direction: 'left', 
  delayBeforeStart: 0,
  duplicated: true,
  pauseOnHover: true,
  startVisible: true
  });
}
marquee();

/* =================================
===         SCROLL TOP       ====
=================================== */
jQuery(".ta_upscr").hide(); 
function taupr() {
  jQuery(window).on('scroll', function() {
    if ($(this).scrollTop() > 500) {
        $('.ta_upscr').fadeIn();
    } else {
      $('.ta_upscr').fadeOut();
    }
  });   
  $('a.ta_upscr').on('click', function()  {
    $('body,html').animate({
      scrollTop: 0
    }, 800);
    return false;
  });
}    
taupr();

})(jQuery);

jQuery(document).ready(function($) {
 /*Time*/
  var myVar = setInterval(function() {
    myTimer();
  }, 100);

  function myTimer() {
    var d = new Date();
    document.getElementById("time").innerHTML = d.toLocaleTimeString();
  }
  
});