/*! jQuery UI - v1.8.23 - 2012-08-15 * https://github.com/jquery/jquery-ui * Includes: jquery.ui.core.js * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ function initProductDetails(){$(".productDetails .mainThumbs li a").on("click",onThumbClick);$(".productDetails .mainThumbs li a.clickMeOnload").trigger("click");$(".mainImageControls .largerBtn").click(function(e){var parentDiv=$(this).closest(".productDetails"),selIndex=parentDiv.find(".mainThumbs li.selected").index()+1;parentDiv.find(".fancyThumbs li:nth-child("+selIndex+") a").trigger("click");e.preventDefault()});$(".skuRow.dim1 select").change(function(){var val=$(this).val();updateGallery(galleryData,val)});$(".productDetails .cartLink").on("click",onAddToCartClick);$(".productDetails .wishListLink").on("click",onAddToWishlistClick);$availabilityTypesContainer=$(".avaialbilityTypes");$cartButton=$(".productDetails .cartLink");$dim1DropDown=$(".dim1DropDown");$dim2DropDown=$(".dim2DropDown");$dim3DropDown=$(".dim3DropDown");$quantityDropDown=$(".quantDropDown");$quantityDropDown.change(function(){skuman.quantity=parseInt($quantityDropDown.val())});initSkuValidation()}function initSkuValidation(){if(typeof productDetailsData!="undefined"){skuman=new SKUManager(productDetailsData);var dim1val="",dim2val="",dim3val="";$dim1DropDown.length>0&&(dim1val=$dim1DropDown.val(),$dim1DropDown.change(onDimentionValueChange));$dim2DropDown.length>0&&(dim2val=$dim2DropDown.val(),$dim2DropDown.change(onDimentionValueChange));$dim3DropDown.length>0&&(dim3val=$dim3DropDown.val(),$dim3DropDown.change(onDimentionValueChange));skuman.setValues(dim1val,dim2val,dim3val,parseInt($quantityDropDown.val()));skuman.updateView=function(){updateView()}}}function onDimentionValueChange(){var val=$(this).val(),$icon,$activeLi;$(this).is($dim1DropDown)?($icon=$('.color-cont .color > a[data-color="'+val+'"]'),$icon.length>0?$icon.parent().hasClass("active")||$icon.trigger("click"):($activeLi=$(".color-cont .color.active"),$activeLi.removeClass("active")),skuman.setValues(val,null,null,null),updateSetValues(val)):$(this).is($dim2DropDown)?skuman.setValues(null,val,null,null):$(this).is($dim3DropDown)&&skuman.setValues(null,null,val,null);updateView()}function updateView(){updatePriceView(skuman.unitPrice,skuman.deletedPrice);updateQuantityView(skuman.canAddToCart,skuman.stock,skuman.maxQuantity);updatAvailabilityView(skuman.availabilityTypeId,skuman.canAddToCart)}function updateSetValues(dim1SetValueId){var selectedDim1,dim2,selectedDim2,dim3;dim1SetValueId!=null&&(selectedDim1=_.filter(productDetailsData.skuData,function(x){return x.dim1==dim1SetValueId}),$("option",$dim2DropDown).each(function(){var val=$(this).val();_.find(selectedDim1,function(x){return x.dim2==val})===undefined?$(this).attr("disabled","disabled"):$(this).removeAttr("disabled")}),dim2=_.find($("option",$dim2DropDown),function(x){return!$(x).attr("disabled")}),dim2!==undefined&&($dim2DropDown.val(dim2.value),skuman.setValues(null,dim2.value,null,null)));dim2!=null&&(selectedDim2=_.filter(selectedDim1,function(x){return x.dim2==dim2.value}),$("option",$dim3DropDown).each(function(){var val=$(this).val();_.find(selectedDim2,function(x){return x.dim3==val})===undefined?$(this).attr("disabled","disabled"):$(this).removeAttr("disabled")}),dim3=_.find($("option",$dim3DropDown),function(x){return!$(x).attr("disabled")}),dim3!==undefined&&($dim3DropDown.val(dim3.value),skuman.setValues(null,null,dim3.value,null)))}function updatePriceView(normalPrice,deletedPrice){var $normPrice,$delPrice;normalPrice!=null&&($normPrice=$(".price .normal"),normalPrice>0&&($normPrice.html(LhApp.Function.renderPrice(normalPrice)),$normPrice.show()));deletedPrice!=null&&($delPrice=$(".price .deleted"),deletedPrice>0&&($delPrice.html(LhApp.Function.renderPrice(deletedPrice)),$delPrice.show()))}function updateQuantityView(canAddToCart,stock,max){var update=!0,i;if(stock==0&&canAddToCart>0&&(stock=1),$options=$quantityDropDown.children(),stock==0&&$options.length==1&&$options.first().val()=="0"&&(update=!1),$options.length==stock&&stock>1&&(update=!1),update){for($options.remove(),i=1;i<=10;i++)if($quantityDropDown.append($("