jQuery(document).ready(function($){
	
	// Popular Cars Carousel
	var owlFindCars = $('#nearestDealer');
		owlFindCars.owlCarousel({
		margin: 25,
		loop: true,
		nav: false,
		navText : ["<i class='fa fa-chevron-left fa-lg'></i>","<i class='fa fa-chevron-right fa-lg'></i>"],
		dots: false,
		autoplay:true,
		stagePadding: 100,
		autoplayTimeout:5000,
		responsive: {
			0: {
			items: 1
			},
			800: {
			items: 2
			},
			1200: {
			items: 3
			}
		}
	});
	
	// Popular Brands Carousel
	var owlFindCars = $('#searchDealerByBrand');
		owlFindCars.owlCarousel({
		margin: 25,
		loop: true,
		nav: true,
		navText : ["<i class='fa fa-chevron-left fa-lg'></i>","<i class='fa fa-chevron-right fa-lg'></i>"],
		dots: false,
		autoplay:true,
		autoplayTimeout:2000,
		responsive: {
			0: {
			items: 3
			},
			400 : {
			items: 3
			},
			600 : {
			items: 3	
			},
			800: {
			items: 4
			},
			1200: {
			items: 5
			}
		}
	});

	/*************************************
        Service Dropdown Filter
    *************************************/

   $('#filter').on('click', function(){
		$('#selectService').slideToggle();
		$(this).find('i').toggleClass('rotate');
	});
	
});

function deferVideo() {

    //defer html5 video loading
  $("video source").each(function() {
    var sourceFile = $(this).attr("data-src");
    $(this).attr("src", sourceFile);
    var video = this.parentElement;
    video.load();
    // uncomment if video is not autoplay
    //video.play();
  });

}
window.onload = deferVideo;	