VariantSwatchesProductVariations_variantGroup_928_4 = { SwatchArray: { 3093: { SwatchURL: '/Shared/images/Product/AFT1443P-R13-TPA.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3094: { SwatchURL: '/Shared/images/Product/AFT1443S-R13-PBL.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3095: { SwatchURL: '/Shared/images/Product/AFT1443S-C13-TFI.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3097: { SwatchURL: '/Shared/images/Product/AFT1443S-R13-OXF.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3098: { SwatchURL: '/Shared/images/Product/AFT1443S-C13-SNT.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3099: { SwatchURL: '/Shared/images/Product/AFT1443S-R13-WTM.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3100: { SwatchURL: '/Shared/images/Product/AFT1443P-C13-TYE.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3101: { SwatchURL: '/Shared/images/Product/AFT1443P-R13-WZB.jpg', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3230: { SwatchURL: '', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3231: { SwatchURL: '', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3232: { SwatchURL: '', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3233: { SwatchURL: '', ControlPath: 'ProductVariations_variantGroup_928_4' }, 3234: { SwatchURL: '', ControlPath: 'ProductVariations_variantGroup_928_4' } }, ImagingMode: "Resizer", ProductPhotoOverride: "", ProductThumbOverride: "", ZoomPhotoOverride: "", SetResizedImageLinks: function(img, zoom, swatchUrl, sZoomScript) { var zoomWidth = 1000; var zoomHeight = 1000; var newMainImageUrl = img.attr("src"); var newScaledUpImageUrl = ""; if(this.ImagingMode == "ExternalImaging") { var oldMainImageOptions = window.resizehelper.getExternalImageOptionsFromUrl(this.ProductPhotoOverride, img.attr("src")); newMainImageUrl = window.resizehelper.getExternalImageUrl(this.ProductPhotoOverride, swatchUrl, oldMainImageOptions.width, oldMainImageOptions.height); newScaledUpImageUrl = window.resizehelper.getExternalImageUrl(this.ZoomPhotoOverride, swatchUrl, zoomWidth, zoomHeight); } else { var baseResizerPath = window.resizehelper.getBaseResizerPath(swatchUrl); var oldParams = ""; if(baseResizerPath.indexOf('?') > -1) { oldParams = baseResizerPath.substring(baseResizerPath.indexOf('?') + 1); var poStartIndex = oldParams.indexOf("po="); if(poStartIndex < 0) poStartIndex = oldParams.indexOf("path="); if(poStartIndex > -1) { var ampAfterIndex = oldParams.substring(poStartIndex).indexOf("&"); if(ampAfterIndex > -1) oldParams = oldParams.substring(poStartIndex + ampAfterIndex + 1); } } newMainImageUrl = img.attr("src").replace(/\/resize\/.+(\?.*)/, baseResizerPath + oldParams); newScaledUpImageUrl = baseResizerPath + "lr=t&bw=" + zoomWidth + "&w=" + zoomWidth + "&bh=" + zoomHeight + "&h=" + zoomHeight } img.attr("src", newMainImageUrl); img.siblings("img").attr("src", newScaledUpImageUrl); zoom.attr("href", newScaledUpImageUrl) .attr("onclick", sZoomScript); }, SelectVariant: function (groupID, variantID, setDropDown) { var mainPhotoPresent = false; //if (typeof msPhotoImgCtl != 'undefined') // mainPhotoPresent = true; var $img = $("#PhotoThumbnails_imgPhoto"); if ($img.length > 0) mainPhotoPresent = true; var sZoomScript = ( $("#PhotoThumbnails_dlPicture").length ) ? "return hs.expand(this, config1);" : "return hs.expand(this);" $(".varpicmax_img[id^='varswatch_" + groupID + "_" + "']").removeClass("ProductDetailsSelectedVariant"); var o = VariantSwatchesProductVariations_variantGroup_928_4.SwatchArray[variantID]; if (o) { if (setDropDown) $("[id$='" + o.ControlPath + "']").val(variantID).change(); if (mainPhotoPresent) $zoomlink = $img.parent(); if (o.SwatchURL != "" && mainPhotoPresent) { if(this.ImagingMode == "ExternalImaging") { this.SetResizedImageLinks($img, $zoomlink, o.SwatchURL, sZoomScript); } else { if ( $img.attr("src").indexOf("path=") != -1){ if ($img.attr("src").indexOf("&") != -1){ $img.attr("src", $img.attr("src").replace(new RegExp("path=.+?&"), "path=" + o.SwatchURL + "&")).attr("alt","").attr("title", ""); $img.siblings("img").attr("src", o.SwatchURL); $zoomlink .attr("href", $zoomlink.attr("href").replace(new RegExp("path=.+?&"), "path=" + o.SwatchURL + "&")) .attr("onclick", sZoomScript); }else{ $img.attr("src", $img.attr("src").replace(new RegExp("path=.+"), "path=" + o.SwatchURL)).attr("alt","").attr("title", ""); $zoomlink .attr("href", $zoomlink.attr("href").replace(new RegExp("path=.+"), "path=" + o.SwatchURL)) .attr("onclick", sZoomScript); } } else if ( $img.attr("src").indexOf("/resize/") != -1){ this.SetResizedImageLinks($img, $zoomlink, o.SwatchURL, sZoomScript); } else{ $img.attr("src", o.SwatchURL ).attr("alt", "").attr("title", ""); $img.siblings("img").attr("src", o.SwatchURL); $zoomlink.attr("href", o.SwatchURL).attr("onclick", sZoomScript); } } } else if (setDropDown) { var groupVars = []; var hasSwatch = false; $("[id$='" + o.ControlPath + "']").val(variantID).change(); } if (mainPhotoPresent) { if (o.SwatchURL != ""){ if(this.ImagingMode == "ExternalImaging") { this.SetResizedImageLinks($img, $zoomlink, o.SwatchURL, sZoomScript); } else { if ( $img.attr("src").indexOf("path=") != -1){ $zoomlink = $img.parent(); if ($img.attr("src").indexOf("&") != -1){ $img.attr("src", $img.attr("src").replace(new RegExp("path=.+?&"), "path=" + o.SwatchURL + "&")).attr("alt","").attr("title", ""); $img.siblings("img").attr("src", o.SwatchURL); $zoomlink .attr("href", $zoomlink.attr("href").replace(new RegExp("path=.+?&"), "path=" + o.SwatchURL + "&")) .attr("onclick", sZoomScript); }else{ $img.attr("src", $img.attr("src").replace(new RegExp("path=.+"), "path=" + o.SwatchURL)).attr("alt","").attr("title", ""); $img.siblings("img").attr("src", o.SwatchURL); $zoomlink .attr("href", $zoomlink.attr("href").replace(new RegExp("path=.+"), "path=" + o.SwatchURL)) .attr("onclick", sZoomScript); } } else if ( $img.attr("src").indexOf("/resize/") != -1){ this.SetResizedImageLinks($img, $zoomlink, o.SwatchURL, sZoomScript); } else{ $img.attr("src", o.SwatchURL ).attr("alt", "").attr("title", ""); $img.siblings("img").attr("src", o.SwatchURL); $zoomlink.attr("href", o.SwatchURL).attr("onclick", sZoomScript); } } } else { var groupVars = []; var hasSwatch = false; $("#" + o.ControlPath).children().each(function () { var v = VariantSwatches.SwatchArray[$(this).val()]; if (v && v.SwatchURL !== "") { hasSwatch = true; } }); if(typeof ResetImage == 'function' && hasSwatch) ResetImage(); } } else if(typeof ResetImage == 'function' ) ResetImage(); } $(".varpicmax_img[id^='varswatch_" + groupID + "_" + variantID + "_" + "']").addClass("ProductDetailsSelectedVariant"); } } $(function(){ $("select[id$='ProductVariations_variantGroup_928_4']").change(function() { VariantSwatchesProductVariations_variantGroup_928_4.SelectVariant( $(this).parent().find("input[type=hidden]").val() , $(this).val(), false) }); })