//disabling context menu
document.onkeydown = function(e) {
	if (e.ctrlKey &&
		(e.keyCode === 67 ||
			e.keyCode === 86 ||
			e.keyCode === 85 ||
			e.keyCode === 117)) {
		return false;
	} else {
		return true;
	}
};
$(document).keypress("u", function(e) {
	if (e.ctrlKey) {
		return false;
	} else {
		return true;
	}
});
document.addEventListener("contextmenu", function(e) {
	e.preventDefault();
}, false);

function stickyHeader() {
	if ($(".navigation_bar").length) {
		var a = 100;
		if ($(window).scrollTop() > a) {
			$(".navigation_bar").removeClass("fadeIn animated");
			$(".navigation_bar").addClass("stricky-fixed fadeInDown animated")
		} else {
			if ($(this).scrollTop() <= a) {
				$(".navigation_bar").removeClass("stricky-fixed fadeInDown animated");
				$(".navigation_bar").addClass("slideIn animated")
			}
		}
	}
}
jQuery(window).on("scroll", function() {
	(function(a) {
		stickyHeader()
	})(jQuery)
});
if ($(".navigation").length) {
	$(".navigation .navbar button").on("click", function() {
		$(".navigation .menu").slideToggle();
		$(this).toggleClass('open');
		return false;
	});
	$(".navigation .cs-submenu").children("a").append(function() {
		return '<button class="dropdown-expander"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg></button>';
	});
}
if (document.documentElement.clientWidth < 1023) {
	$(".navigation .menu .dropdown-expander").on("click", function() {
		$(this).parent().parent().children(".cs-dropdown").slideToggle();
		console.log($(this).parents("li"));
		console.log($(this).parents().children(".dropdown-expander").toggleClass("rotated"));
		return false
	});
	$(document).click(function(e) {
		if (!$(e.target).closest('.navigation .navbar button').length) {
			$('.navigation .menu').stop(true).slideUp();
			$(".navigation .navbar button").removeClass('open');
		}
	});
}
jQuery(document).on("ready", function() {
	(function(a) {
		mobiletNavToggler()
	})(jQuery)
});
if (document.documentElement.clientWidth < 980) {
	$(document).click(function(e) {
		if (!$(e.target).closest('.navigation .navbar button').length) {
			$('.menu').stop(true).slideUp();
			$(".navigation .navbar button").removeClass('open');
		}
	});
}
$(document).ready(function() {
	var a = $("#slider");
	a.owlCarousel({
		loop: true,
		margin: 0,
		navSpeed: 500,
		nav: true,
		navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
		autoplay: true,
		dots: false,
		items: 1,
        responsiveClass: true,
		responsive: {
			0: {
				items: 1,
				nav: false
			},
			600: {
				items: 1,
				nav: false
			},
			1000: {
				items: 1,
				nav: true
			}
		}
	});
	var a = $("#popular");
	a.owlCarousel({
		loop: false,
		margin: 9,
		navSpeed: 500,
		nav: true,
		navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
		autoplay: true,
		dots: false,
		items: 4,
		responsiveClass: true,
		responsive: {
			0: {
				items: 1,
				nav: true
			},
			600: {
				items: 2,
				nav: false
			},
			1000: {
				items: 4,
				nav: true,
				loop: false
			}
		}
	});
	var a = $("#featured");
	a.owlCarousel({
		loop: true,
		margin: 9,
		navSpeed: 500,
		nav: true,
		navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
		autoplay: true,
		dots: false,
		items: 5,
		responsiveClass: true,
		responsive: {
			0: {
				items: 1,
				nav: true
			},
			600: {
				items: 2,
				nav: false
			},
			1000: {
				items: 5,
				nav: true,
				loop: false
			}
		}
	});
	var a = $("#shop_look");
	a.owlCarousel({
		loop: false,
		margin: 10,
		navSpeed: 500,
		nav: true,
		navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
		autoplay: true,
		dots: false,
		items: 5,
		responsiveClass: true,
		responsive: {
			0: {
				items: 1,
				nav: true
			},
			600: {
				items: 2,
				nav: false
			},
			1000: {
				items: 5,
				nav: true,
				loop: false
			}
		}
	});
	var a = $("#googleReview");
	a.owlCarousel({
		loop: true,
		margin: 10,
		navSpeed: 500,
		nav: true,
		navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
		autoplay: true,
		dots: false,
		items: 4,
		responsiveClass: true,
		responsive: {
			0: {
				items: 1,
				nav: true
			},
			600: {
				items: 2,
				nav: false
			},
			1000: {
				items: 4,
				nav: true,
				loop: true
			}
		}
	});
});
$('#thumbs img').click(function() {
	$('#largeImage').attr('src', $(this).attr('src').replace('thumb', 'large'));
	if ($(this).hasClass("active")) {
		$("#thumbs img").removeClass("active");
	} else {
		$("#thumbs img").removeClass("active");
		$(this).addClass("active");
	}
});
wow = new WOW({
	animateClass: "animated",
	offset: 100,
	mobile: false
});
wow.init();
$(window).on("scroll", function() {
	if ($(this).scrollTop() > 100) {
		$("#scroll-up").fadeIn()
	} else {
		$("#scroll-up").fadeOut()
	}
});
$("#scroll-up").on("click", function() {
	$("html, body").animate({
		scrollTop: 0
	}, 600);
	return false
});
$('.caratRange_one').css('display', 'flex');
$("#carat_1").click(function() {
	$('.caratRange_one').css('display', 'flex');
	$(".caratRange_two").hide();
});
$('.caratRange_two').css('display', 'none');
$("#carat_2").click(function() {
	$('.caratRange_two').css('display', 'flex');
	$(".caratRange_one").hide();
});
$(document).ready(function() {
	$(".product_grade_wrapper li").click(function() {
		$(".product_grade_wrapper li").removeClass("active");
		$(this).addClass("active");
	});
});
$(document).ready(function() {
	$(".metal_color li").click(function() {
		$(".metal_color li").removeClass("active");
		$(this).addClass("active");
	});
});
$(document).ready(function() {
	$(".newCarat_div li").click(function() {
		$(".newCarat_div li").removeClass("active");
		$(this).addClass("active");
	});
});
$(document).ready(function() {
	$(".product_grade_wrapper li").click(function() {
		$(".product_grade_wrapper li").removeClass("active");
		$(this).addClass("active");
	});
});
$(document).ready(function() {
	$(".diamondcolor_wrap li").click(function() {
		$(".diamondcolor_wrap li").removeClass("active");
		$(this).addClass("active");
	});
});
$(document).ready(function() {
	$(".product_size_wrapper li").click(function() {
		$(".product_size_wrapper li").removeClass("active");
		$(this).addClass("active");
	});
});
$(document).ready(function() {
	$(".metalColour_grade li").click(function() {
		$(".metalColour_grade li").removeClass("active");
		$(this).addClass("active");
	});
});
$('.smallThumbs .imgItem').on('click', function() {
	$(this).closest('.singleGallery').find('.largeImage img').attr('src', this.src);
	if ($(this).hasClass("active")) {
		$(".smallThumbs .imgItem").removeClass("active");
	} else {
		$(".smallThumbs .imgItem").removeClass("active");
		$(this).addClass("active");
	}
});