$(function() {
	$(document).ready(function() {
		$('#product-tab ul > li > a').click(function (e) {
			e.preventDefault();
			$(this).tab('show');
		});
		
		var $mainCarousel = $('#owl-carousel');
		var $thumbCarousel = $('.product-thumbs-slider');
		var $relatedProductsCarousel = $('#related-products-slider');
		
		$mainCarousel.owlCarousel({
			"items":1,
			"loop":false,
			"rewind":true,
			"nav":true,
			"navText":[],
			//"onChanged": function(event){$thumbCarousel.trigger('to.owl.carousel', [event.item.index +1 , 300]); console.log(event.item.index);}
		});
		$thumbCarousel.owlCarousel({
			"items":4,
			"loop":false,
			"rewind":true,
			"nav":true,
			"navText":[],
			//"onChanged": function(event){$mainCarousel.trigger('to.owl.carousel', [event.item.index +1 , 300]); console.log(event.item.index);} //callbackCarousel
		});
		$relatedProductsCarousel.owlCarousel({
			"items":4,
			"loop":true,
			"nav":true,
			"navText":[],
			"slideBy":4,
		});
//		console.log($mainCarousel);
//		console.log($thumbCarousel);
		function callbackCarousel(event){
			//$mainCarousel.page.index = event.page.index;
			//$thumbCarousel.page.index = event.page.index;
			
			$mainCarousel.trigger('to.owl.carousel', [event.page.index]);
			
		}
		
	});
});