$(function() {
var title = $('#page_title').text();
$('title').text(title);
//remove add to basket is stock = 0
$('.CRMProdItemDetailStock > span.v').each(function(){
if ($(this).text()==='0'){
$(this).parent().parent().find($('.CRMProdItemAddToBasket')).remove();
}
})
//manipulate product detail DOM to suit style requirements
$('').insertBefore('.CRMProdItemDetailRef');
$('#prod-item-detail').append($('.CRMProdItemDetailRef'));
$('#prod-item-detail').append($('.CRMProdItemDetailStock '));
$('.CRMHiddenPriceMessage').insertAfter($('.CRMProdItemDetailExDesc'));
//add slider to additional images
$('.additional-images').slick({
slidesToShow: 6,
slidesToScroll: 6,
autoplaySpeed: 2000,
arrows: true,
dots: true
});
$('.tab-title').click(function(){
// remove all active classes
$('.tab-title').each(function(){
$(this).removeClass('tab-active');
})
// make this tab active
$(this).addClass('tab-active');
// get name of tab to display
var tab = $(this).attr('id');
// hide active tab
$('.tab-detail-active').removeClass('tab-detail-active');
// show requested tab
$('.tab-detail#' + tab).addClass('tab-detail-active');
})
});