jQuery(document).ready(function($){
	
	// Popular Cars Carousel
	var owlFindCars = $('#nearestDealer');
		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:5000,
		responsive: {
			0: {
			items: 1
			},
			800: {
			items: 1
			},
			1200: {
			items: 1
			}
		}
	});
	
	// Popular Brands Carousel
	var owlFindCars = $('#searchDealerByBrand');
		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,
		autoplayTimeout:2000,
		responsive: {
			0: {
			items: 2
			},
			400 : {
			items: 4
			},
			600 : {
			items: 5	
			},
			800: {
			items: 6
			},
			1200: {
			items: 8
			}
		}
	});

	/*************************************
        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;	