$(document).ready(function(){ $("form[name=productDetailsStockAlertForm]").validVal({ errorClass: "validationError" }); $("form[name=productDetailsStockAlertForm] input:submit").click(function(event){ event.preventDefault(); var form_data=$("form[name=productDetailsStockAlertForm]").triggerHandler("submitForm"); if(form_data){ $.get( base_href+'ajax.php?m=productStockAlert', form_data, function(result){ if(result.success==1){ var tmp='Many thanks!
We can also send you an SMS when the product is back in stock. Enter your mobile phone number below.

'; $(".stockalert").html(tmp); $("form[name=productDetailsStockAlertPhoneForm]").validVal({ errorClass: "validationError" }); $("form[name=productDetailsStockAlertPhoneForm] input:submit").click(function(event){ event.preventDefault(); var form_data=$("form[name=productDetailsStockAlertPhoneForm]").triggerHandler("submitForm"); if(form_data){ $.get( base_href+'ajax.php?m=productStockAlertPhone', form_data, function(result){ if(result.success==1){ $(".stockalert").html('We will notify you as soon as the product is back in stock.'); } }, 'json' ); } }); } }, 'json' ); } }); //product images $("#imagesThumbs .carousel").jCarouselLite({ btnNext: "#imagesThumbs .carouselNext", btnPrev: "#imagesThumbs .carouselPrev", circular: false, visible: 4 }); /*$('#mainImage>a').easyZoom({ parent: '#mainImage' });*/ $('#imagesThumbs .imgThumb a').mouseover(function(){ $('#imagesThumbs .sel').removeClass('sel'); $(this).addClass('sel'); /*$('#mainImage').html(''); $('#mainImage>a').easyZoom({ parent: '#mainImage' });*/ $('#mainImage a').attr('href', $(this).attr('data-rel-big')); $('#mainImage a').html(''); }); //product videos $('#videosThumbs .videoThumb a').mouseover(function(){ $('#videosThumbs .sel').removeClass('sel'); $(this).addClass('sel'); }); $('#videosThumbs .videoThumb a').click(function(event){ event.preventDefault(); $.colorbox({ href: $(this).attr('rel'), width: '600px', height: '400px', iframe: true }); }); //related products $("#productDetailsSimilar .carousel").jCarouselLite({ btnNext: "#productDetailsSimilar .carouselNext", btnPrev: "#productDetailsSimilar .carouselPrev", circular: false, visible: 5, start: 0, scroll: 5 }); //bundles $("#productDetailsBundles .carousel").jCarouselLite({ btnNext: "#productDetailsBundles .carouselNext", btnPrev: "#productDetailsBundles .carouselPrev", circular: false, visible: 1, start: 0, scroll: 1 }); //reviews by rating $("#productReviewsByRating li").click(function(event){ event.preventDefault(); $.post(base_href+'ajax.php?m=productReviewsByRating', {pid: $(this).attr('data-pid'), rating: $(this).attr('data-rating')}, function(data){ if(!data.success){ return; } $("#productReviewsListPages").hide(); $('#productReviewsList').html(''); for(var i in data.reviews){ $('#productReviewsList').append( '
'+data.reviews[i].user+'
'+data.reviews[i].title+'
'+data.reviews[i].date+(data.reviews[i].bought?'Verified user':'')+'
'+data.reviews[i].body+'
Review of '+data.reviews[i].product+'
'); } }, 'json'); }); //reviews by page $("#productReviewsListPages a").click(function(event){ event.preventDefault(); if($(this).hasClass('currentPage')){ return; } $('#productReviewsListPages .currentPage').removeClass('currentPage').addClass('pageNumber'); $(this).removeClass('pageNumber'); $(this).addClass('currentPage'); $.post(base_href+'ajax.php?m=productReviewsByPage', {pid: $(this).attr('data-pid'), page: $(this).attr('data-page')}, function(data){ if(!data.success){ return; } $('#productReviewsList').html(''); for(var i in data.reviews){ $('#productReviewsList').append( '
'+data.reviews[i].user+'
'+data.reviews[i].title+'
'+data.reviews[i].date+(data.reviews[i].bought?'Verified user':'')+'
'+data.reviews[i].body+'
Review of '+data.reviews[i].product+'
'); } $('html, body').animate({ scrollTop: (parseInt($("#productReviews").offset().top)-50) }, 1000); }, 'json'); }); //review guidelines $('#productReviewsFormGuidelines').click(function(event){ event.preventDefault(); $.colorbox({ html: '
Important review guidelines:
', scrolling: false, width: '600px', height: '400px' }); }); //reviews form $("#productReviewsFormRatingMap area").mouseover(function(){ $("#productReviewsFormRatingMapMsg").html($(this).attr('alt')); $("#productReviewsFormRatingMapSel img").css('background-position', (-100+$(this).attr('rating')*20)+'px -30px'); }); $("#productReviewsFormRatingMap").mouseout(function(){ if($("form[name=productReviewsForm] input[name=rate]").attr('data-saved-alt')){ $("#productReviewsFormRatingMapMsg").html($("form[name=productReviewsForm] input[name=rate]").attr('data-saved-alt')); } else{ $("#productReviewsFormRatingMapMsg").html(''); } $("#productReviewsFormRatingMapSel img").css('background-position', (-100+$("form[name=productReviewsForm] input[name=rate]").val()*20)+'px -30px'); }); $("#productReviewsFormRatingMap area").click(function(){ $("form[name=productReviewsForm] input[name=rate]").attr('data-saved-alt', $(this).attr('alt')); $("form[name=productReviewsForm] input[name=rate]").val($(this).attr('rating')); }); $("#productReviewsFormRatingMap area.sel").each(function(){ $("#productReviewsFormRatingMapMsg").html($(this).attr('alt')); $("#productReviewsFormRatingMapSel img").css('background-position', (-100+$(this).attr('rating')*20)+'px -30px'); $("form[name=productReviewsForm] input[name=rate]").val($(this).attr('rating')); }); $('#productReviewsFormText').keyup(function() { var length=100-$(this).val().length; if(length>0){ $('#productReviewsFormTextChars').html('Write '+length+' more characters to earn 100 points'); $('#productReviewsFormTextChars').removeClass('productReviewsFormTextCharsWithReward'); } else{ $('#productReviewsFormTextChars').html('This review earns you 100 points'); $('#productReviewsFormTextChars').addClass('productReviewsFormTextCharsWithReward'); } }); $('form[name=productReviewsForm]').validVal({ errorClass: "validationError", validate: { onKeyup: "valid", fields: { hidden: true } }, customValidations: { "validRate": function(val){ if(val!='0'){ return true; } else{ return false; } }, "validMessage": function(val){ if(val.length>3){ return true; } else{ return false; } } }, form: { onValidSubmit: function(form_data){ form_data.anonymous=$('form[name=productReviewsForm] input[name=anonymous]:checked').val(); if(parseInt(form_data.userId)>0){ $.post( base_href+'ajax.php?m=productReviewsAdd', form_data, function(data){ if(data.success){ $("#productReviewsFormContainer").html('
'); } else{ alert(data.error); } }, "json" ); } else{ $.colorbox({ href: $('#productReviewsFormContainer a.userLoggedHide').attr('href')+'?ajaxPop=1', width: '990px', height: '400px', iframe: true }); } } } }); // //variants // $('#productVariants ul li').hover(function(){ // var variant=productVariants[$(this).attr('variant-id')]; // $('#productTopSection .centerright .right .discount').remove(); // $('#productTopSection .centerright .right .discountTxt').remove(); // if(variant.hasDiscount){ // $('#productTopSection .centerright .right').prepend('
'+variant.discount+'
'+variant.discountTxt+'
'); // } // //change image // $('#mainImage img').attr('src', base_href+variant.img); // $('#imagesThumbs .sel').removeClass('sel'); // //change stock // $('#stockText').html(variant.stock); // $('#stockContainer').removeClass('instock outofstock ondemand'); // if(variant.stock_cls=='outofstock'){ // $('#productTopSection .centerright .right .stockalert').show(); // $('#productTopSection .centerright .right .shipping').hide(); // } // else{ // $('#productTopSection .centerright .right .shipping').show(); // $('#productTopSection .centerright .right .stockalert').hide(); // } // $('#stockContainer').addClass(variant.stock_cls); // //change price // $('#priceContainer').html(variant.price); // }); // $('#productVariants ul li').mouseout(function(){ // var variant=productVariants[$('#productVariants ul li.sel').attr('variant-id')]; // $('#productTopSection .centerright .right .discount').remove(); // $('#productTopSection .centerright .right .discountTxt').remove(); // if(variant.hasDiscount){ // $('#productTopSection .centerright .right').prepend('
'+variant.discount+'
'+variant.discountTxt+'
'); // } // //change image // $('#mainImage img').attr('src', base_href+variant.img); // $('#imagesThumbs .sel').removeClass('sel'); // //change stock // $('#stockText').html(variant.stock); // $('#stockContainer').removeClass('instock outofstock ondemand'); // if(variant.stock_cls=='outofstock'){ // $('#productTopSection .centerright .right .stockalert').show(); // $('#productTopSection .centerright .right .shipping').hide(); // } // else{ // $('#productTopSection .centerright .right .shipping').show(); // $('#productTopSection .centerright .right .stockalert').hide(); // } // $('#stockContainer').addClass(variant.stock_cls); // //change price // $('#priceContainer').html(variant.price); // }); // $('#productVariants ul li').click(function(){ // document.location.href=productVariants[$(this).attr('variant-id')].href; // }); $('.productAnchors').click(function(event){ event.preventDefault(); $('html,body').animate({ scrollTop: parseInt($($(this).attr('rel')).offset().top)-($('body.scroll').length?100:160) }, 'slow'); }); $('.productAnchorsTrack').click(function(event){ try{ dataLayer.push({ 'event': 'productClick', 'ecommerce': { 'click': { 'products': [{ 'name': 'productAnchors' }] } } }); } catch(e){}; }); });