var $ = require("jquery");
require("../lib/owl-carousel/owl.carousel.js");

module.exports = function initOwlCarousel(id) {

	$(document).ready(function() {
		var owl = id;

		owl.owlCarousel({
			singleItem: true,
			items : 1,
			//navigation : false,
			pagination: false,
			autoHeight : false
		});
		
		// initial state for custom html pagination
		$(".owl-goto:first").addClass("active");
		
		// Custom Navigation Events
		$(".owl-goto").click(function(){
			var t = this;
			var owl = owl.data("owlCarousel");
			owl.goTo($(t).attr("data-slide-id"));
			$(".owl-goto.active").removeClass("active");
			$(".owl-goto.active").removeClass("active");
			$(t).addClass("active");
		});
	}
}
