 Your World of WellnessAscend4Life offers you the nutritional solutions you need to enjoy the optimum health you seek. Select any product to make your purchase or learn more. |
Would you like to
ATTACH YOUR ORDER
TO A DISTRIBUTOR
Click below to proceed to the site
without attaching your order
to a distributor. you may select
a distributor at checkout if you change your mind.
XSelect a DISTRIBUTOR
We found multiple distributors matching your request.
Please select one from the list below.
Or
click here
to start over.
Distributors NEAR YOU
Please select a distributor from the list below.
Or
click here
to start over.
Find a DISTRIBUTOR
To find a distributor in your area, enter your search criteria(s) and click search.
-or-
-and-
");
}
jQuery('#cboxLoadingGraphic').hide();
fnAttachOrderShowProgress(false);
/*Added by Jam for the popup to resize*/
/*jQuery.colorbox.resize();*/
updateParentColorBoxHeight(jQuery('#divAttachedOrder').outerHeight());
/*End of add by Jam*/
},
error: function (response) {
jQuery('#cboxLoadingGraphic').hide();
fnAttachOrderShowProgress(false);
/*Added by Jam for the popup to resize*/
/*jQuery.colorbox.resize();*/
updateParentColorBoxHeight(jQuery('#divAttachedOrder').outerHeight());
/*End of add by Jam*/
alert('Unable to fetch records due to time-out error, please try again.');
//alert('Error occurred while retrieving merchants: ' + response.Message + ' ' + response.statusText);
}
});
}
else {
jQuery('#tblSearchResult').html("
Please Enter Search Criteria(s)
");
}
return false;
} catch (e) {
jQuery('#cboxLoadingGraphic').hide();
fnAttachOrderShowProgress(false);
return false;
}
}
function HideShowDiv(id) {
jQuery('.divContent').hide();
jQuery('#' + id).show();
clearDataAttachOrder(id);
/*jQuery.colorbox.resize();*/
updateParentColorBoxHeight(jQuery('#divAttachedOrder').outerHeight());
}
function clearDataAttachOrder(id) {
if (id == 'div1') {
jQuery('#divNoRecordFoundMsg').html('');
jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_txtUserName").val('')
}
if (id == "div3") {
jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_txtSearchPostalCode").val('');
jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlCountry").val('00000000-0000-0000-0000-000000000000');
jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlRegion").val('00000000-0000-0000-0000-000000000000');
jQuery('#divNoRecordFound').html('');
}
}
function setDropdownValue() {
if (jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlCountry").val() != '00000000-0000-0000-0000-000000000000') {
ASP.WebServices.WSApplicationUsers.GetRegions(jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlCountry").val(), GetRegion_onSuccess, null, null);
}
else {
var ddlCountryListID1 = 'ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlRegion';
var ddlRegion = document.getElementById(ddlCountryListID1);
ddlRegion.options.length = 0;
ddlRegion.options[0] = new Option(State, '');
}
}
function fnSearchSponsorByRegion() {
try {
var btnWidth = jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_btnSearch").width();
btnWidth = btnWidth + 25;
var postalcode = jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_txtSearchPostalCode").val();
var CountryId = jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlCountry").val();
var RegionId = jQuery("#ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlRegion").val();
var strFilterExpression = '1=1,';
var isFilter = false;
//if (RegionId != '' && RegionId != '00000000-0000-0000-0000-000000000000') {
// strFilterExpression = strFilterExpression + ',Region=' + RegionId;
// isFilter = true;
//}
//if (CountryId != '' && CountryId != '00000000-0000-0000-0000-000000000000') {
// strFilterExpression = strFilterExpression + ',Country=' + CountryId;
// isFilter = true;
//}
if (CountryId != '' && CountryId != '00000000-0000-0000-0000-000000000000' && RegionId != '' && RegionId != '00000000-0000-0000-0000-000000000000') {
strFilterExpression = strFilterExpression + ',Region=' + RegionId;
strFilterExpression = strFilterExpression + ',Country=' + CountryId;
isFilter = true;
}
if (postalcode) {
strFilterExpression = strFilterExpression + ',POSTALCODE=' + postalcode;
isFilter = true;
}
//strFilterExpression = strFilterExpression + ',Common Id=110305' ;
if (isFilter) {
jQuery('#cboxLoadingGraphic').show();
fnAttachOrderShowProgress(true);
jQuery.ajax({
type: "POST",
url: "/WebServices/WSApplicationUsers.asmx/GetApplicationUsersForSearchRandomEnrollmentAnonymousUser",
data: "{strFilterExpression: '" + strFilterExpression + "', sortExpression: '',sortDirection: ''}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
jQuery('#tblSearchResult').html('');
var dist = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
if (dist.length == 1) {
__doPostBack('ctl00$CPH$ctl11$BM$ctrlAttachOrder$lnkSelectSponsor', dist[0].ItemId);
}
else if (dist.length >= 2) {
HideShowDiv('div2');
jQuery("#divDistributorsNearYou").show();
/*Modified by Jam to add a thead element to have the tablesorter to work*/
jQuery("#tblSearchResult").append("
| ID | Name | City | State |
---|
");
/*End Modify By Jam*/
jQuery("#tblSearchResult").append(jQuery("#ListViewSponsors").tmpl(dist));
/*Added by Jam for the tablesorter init*/
jQuery('#tblSearchResult').tablesorter();
/*End of add by Jam*/
}
else {
jQuery('#divNoRecordFound').html('No matching results.
Please enter a new name.');
}
jQuery('#cboxLoadingGraphic').hide();
fnAttachOrderShowProgress(false);
/*Added by Jam for the popup to resize*/
jQuery.colorbox.resize();
/*End of add by Jam*/
},
error: function (response) {
jQuery('#cboxLoadingGraphic').hide();
fnAttachOrderShowProgress(false);
//alert('Error occurred while retrieving merchants: ' + response.Message + ' ' + response.statusText);
alert('Unable to fetch records due to time-out error, please try again.');
}
});
}
else {
if (CountryId != '' && CountryId != '00000000-0000-0000-0000-000000000000' && (RegionId == '' || RegionId != '00000000-0000-0000-0000-000000000000')) {
jQuery('#divNoRecordFound').html("Please Select State");
}
else {
jQuery('#divNoRecordFound').html("Please Enter Search Criteria(s)");
}
}
return false;
} catch (e) {
jQuery('#cboxLoadingGraphic').hide();
fnAttachOrderShowProgress(false);
return false;
}
}
function fnAttachOrderShowProgress(show) {
try {
if (show) {
jQuery('#divAttachedOrder').parent().parent().find('#cboxLoadingGraphic').show();
}
else {
jQuery('#divAttachedOrder').parent().parent().find('#cboxLoadingGraphic').hide();
}
} catch (e) {
if (show) {
jQuery('#cboxLoadingGraphic').show();
}
else {
jQuery('#cboxLoadingGraphic').hide();
}
}
}
function GetRegion_onSuccess(arg) {
try {
var ddlCountryListID1 = 'ctl00_CPH_ctl11_BM_ctrlAttachOrder_ddlRegion';
var ddlRegion = document.getElementById(ddlCountryListID1);
ddlRegion.options.length = 0;
ddlRegion.options[0] = new Option(State, '');
if (arg == null || arg.length Please enter a new name.');
}
else {
fnSponsorClick(response.data.rows.cells[0]);
}
}
}
function onOkClick(obj) {
fnClosePopup();
if (jQuery(obj).attr("url") != '') {
window.location.href = jQuery(obj).attr("url");
}
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i #divAttachedOrder a[href*="doPostBack"]:not([id$="ELinkButton2"]), .distributors-near-you #DivSearchResult.sponsorGrid table tbody tr.alt td > a.pushbutton[onclick], .fa-drop-down:before, table.tablesorter thead tr th, table.tablesorter tfoot tr th { background-color: ' + color + ' !important; } #divAttachedOrder .divContent .divRow>a[onclick]:not(.pushbutton) { color: ' + color + ' !important; }');
} catch (sessionStorageError) { }
});
' ;
html+= '

';
PreviewHtmlInNewWindowImage(html,'height=600,width=450,resizable=no,scrollbars=yes');
return false;*/
}
function PreviewHtmlInNewWindowImage(bodyText, params) {
var w = window.open('', '_blank', params, true);
var res, pattern;
pattern = /__quote__/g;
res = bodyText.replace(pattern, "'");
pattern = /__dblquote__/g;
res = res.replace(pattern, "\"");
w.document.write(res);
if (br_ie) {
status = "";
//remove_loading();
}
return false;
}
var zoomImage;// = 'http://localhost/ImageZoomer/ImageZoomr_files/_5699981-large.jpg';
var bolOddEven = false;
var zoom = 5;
var pos;
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curleft, curtop];
}
}
function fnProductFinance(skuID) {
//alert("called");
var url = document.getElementById("ctl00_CPH_ctl11_BM_hidUrl").value;
url = url.replace(/SKUID/, skuID);
//alert(url);
var oWnd = window.radopen(url, 'winProductImage');
oWnd.SetUrl(oWnd.GetUrl());
oWnd.Center();
}
var uiDialogChecker = false;
// Added By Divya to view Associated SKUs
//Updated By Divya on 17th May, 2011 for task# 2547 - Added PurchaseArea parameter
//function OpenDialogToViewAssociatedSKUByUser(SKUId,ViewType,ModuleType,UserId)
function OpenDialogToViewAssociatedSKUByUser(SKUId, ViewType, ModuleType, UserId, PurchaseArea) {
try {
//var redirectto = document.getElementById("ctl00_CPH_ctl11_BM_hdnAssociatedSKUPath").value + "?SKUId="+SKUId+"&ViewType="+ViewType+"&ModuleType="+ModuleType+"&UserId="+UserId;
//var redirectto = document.getElementById("ctl00_CPH_ctl11_BM_hdnAssociatedSKUPath").value + "?SKUId=" + SKUId + "&ViewType=" + ViewType + "&ModuleType=" + ModuleType + "&UserId=" + UserId + "&PurchaseArea=" + PurchaseArea;
var redirectto = document.getElementById("ctl00_CPH_ctl11_BM_hdnAssociatedSKUPath").value;
if (redirectto.indexOf('?') > 0) {
redirectto += "&";
} else {
redirectto += "?";
}
redirectto += "SKUId=" + SKUId + "&ViewType=" + ViewType + "&ModuleType=" + ModuleType + "&UserId=" + UserId + "&PurchaseArea=" + PurchaseArea;
/*added by Jam for switching from radopen to jQuery ui but disabled as I need to know if this will not break any additional function*/
jQuery('#associate-autoship-url-wrapper').html('
').dialog({
modal: true,
maxWidth: '90%',
width: 600,
height: 450,
draggable: false,
dialogClass: "no-close",
title: 'Mandatory Associated Recurring Product',
create: function (event, ui) {
jQuery(this).parent('.ui-dialog').css("maxWidth", "90%");
},
open: function () {
uiDialogChecker = true;
jQuery('#associate-autoship-url-wrapper iframe').on('load', function () {
jQuery(this).contents().find('html').addClass('ui-dialog');
});
},
/*buttons: [{
text: "Close",
click: function () {
jQuery(this).dialog("close");
}
}]*/
});
/*end added by Jam*/
/*var oWnd = window.radopen(redirectto, "radProductImage");
oWnd.SetUrl(oWnd.GetUrl());
oWnd.SetWidth(800); //Added By Divya on 24th July, 2014 for Task# 10528
oWnd.Center(); Commented out by Jam to replace the radopen script with jQuery ui*/
return false;
}
catch (exception) { }
}
//Updated By Divya on 17th May, 2011 for task# 2547 - Added PurchaseArea parameter
//function OpenDialogToViewAssociatedSKU(SKUId,ViewType,ModuleType)
function OpenDialogToViewAssociatedSKU(SKUId, ViewType, ModuleType, PurchaseArea) {
try {
//var redirectto = document.getElementById("ctl00_CPH_ctl11_BM_hdnAssociatedSKUPath").value + "?SKUId="+SKUId+"&ViewType="+ViewType+"&ModuleType="+ModuleType;
//var redirectto = document.getElementById("ctl00_CPH_ctl11_BM_hdnAssociatedSKUPath").value + "?SKUId=" + SKUId + "&ViewType=" + ViewType + "&ModuleType=" + ModuleType + "&PurchaseArea=" + PurchaseArea;
//End Updated -
var redirectto = document.getElementById("ctl00_CPH_ctl11_BM_hdnAssociatedSKUPath").value;
if (redirectto.indexOf('?') > 0) {
redirectto += "&";
} else {
redirectto += "?";
}
redirectto += "SKUId=" + SKUId + "&ViewType=" + ViewType + "&ModuleType=" + ModuleType + "&PurchaseArea=" + PurchaseArea;
/*added by Jam for switching from radopen to jQuery ui but disabled as I need to know if this will not break any additional function*/
jQuery('#associate-autoship-url-wrapper').html('
').dialog({
modal: true,
maxWidth: '90%',
width: 600,
height: 450,
draggable: false,
dialogClass: "no-close",
title: 'Mandatory Associated Recurring Product',
create: function (event, ui) {
jQuery(this).parent('.ui-dialog').css("maxWidth", "90%");
},
open: function () {
uiDialogChecker = true;
jQuery('#associate-autoship-url-wrapper iframe').on('load', function () {
jQuery(this).contents().find('html').addClass('ui-dialog');
});
},
/*buttons: [{
text: "Close",
click: function () {
jQuery(this).dialog("close");
}
}]*/
});
/*end added by Jam*/
/*var oWnd = window.radopen(redirectto, "radProductImage");
oWnd.SetUrl(oWnd.GetUrl());
oWnd.SetWidth(650);//Added By Divya on 24th July, 2014 for Task# 10528
oWnd.Center(); Commented out by Jam to replace the radopen script with jQuery ui*/
return false;
}
catch (exception) { }
}
function ChangeImage(url, j) {
var myimage = document.getElementById('ctl00_CPH_ctl11_BM_myimage');
myimage.src = url;
myimage.removeAttribute('data-zoomsrc');
myimage.setAttribute('data-zoomsrc', zoomImageUrls[j]);
//zoomSrc=zoomImageUrls[j];
//var myZoomImage=getElementsByClassName('mojozoom_img');
// if(myZoomImage.length > 0)
// {
// zoomSrc=zoomImageUrls[j];
// setTimeout(function()
// {
// myZoomImage[0].removeAttribute('src');
// myZoomImage[0].src=zoomImageUrls[j];
// }, 1);
// }
imageIndex = j;
i = j; //added by john 03/19/2014 task#8409 note:var i is used in zoom image
MojoZoom.init(myimage, zoomImageUrls[j]);
}
function getElementsByClassName(classname, node) {
if (!node) node = document.getElementsByTagName("body")[0];
var a = [];
var re = new RegExp('\\b' + classname + '\\b');
var els = node.getElementsByTagName("*");
for (var i = 0, j = els.length; i -1 || urlToCheck.indexOf('1934d231-af6e-4b19-be41-fc734936cd8c') > -1) {
addToCartButtons = jQuery('.ProductCardButtons a[id*="btnAddToCart"]');
viewAssociatedSKUs = jQuery('.ProductCardButtons a[id*="btnViewAssociatedSKU"]');
viewAssociatedSKUsText = jQuery('.ProductCardButtons a[id*="btnViewAssociatedSKU"] .tdBottomButtonMiddle');
itemQuantities = jQuery('.ProductCardButtons input[id*="numQuantity"]');
itemPlusMinusQuantities = jQuery('.ProductCardButtons input[id*="numPlusMinusQuantity"]'); // Added by Kevin on 9th Sept, 2015 for Task# 18711 - Add to cart quantity format
priceTexts = jQuery('.grid tr:has(span[id*="lblYourPrice"])');
jQuery.each(addToCartButtons, function (index, addToCartButton) {
viewAssociatedSKUsText[index].innerHTML = addToCartButton.text;
});
addToCartButtons.css('cssText', 'display: none !important');
itemQuantities.css('cssText', 'display: none !important');
itemPlusMinusQuantities.css('cssText', 'display: none !important'); // Added by Kevin on 9th Sept, 2015 for Task# 18711 - Add to cart quantity format
priceTexts.css('cssText', 'display: none !important');
}
}
}
function AutoAddToCart(skuId) {
jQuery.each(viewAssociatedSKUs, function (index, viewAssociatedSKU) {
if (viewAssociatedSKU.getAttributeNode('onclick').nodeValue.indexOf(skuId) > -1) {
addToCartButtons[index].click();
}
});
}
AutoAddToCartEndRequestHandler();
//end add Richard Chico for task #11612: VineIT Shopping Page Modification
//Added by Kevin on 9th Sept, 2015 for Task# 18711 - Add to cart quantity format
function QuantityPlusMinus(_this, evt) {
// console.log(jQuery(_this).parent().parent().find("input[id$='tb']"));
var Quantity = parseInt(jQuery(_this).parent().parent().find("input[id$='tb']").val());
console.log('1');
if (evt == 'Plus') {
if (!(_this.attributes["disabled"] != null && _this.attributes["disabled"].value == "disabled") && Quantity >= 1) {
Quantity = Quantity + 1;
jQuery(_this).parent().parent().find("input[id$='tb']").val(Quantity);
}
else
jQuery(_this).parent().parent().find("input[id$='tb']").val(1);
}
else if (evt == 'Minus') {
if (!(_this.attributes["disabled"] != null && _this.attributes["disabled"].value == "disabled") && '1' 1)
jQuery(_this).parent().parent().find("input[id$='tb']").val(Quantity - 1);
}
}
return false;
}
function isNumberKey(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode 57)) {
return false;
}
return true;
}
function comparePrices(num1, num2) {
if (parseFloat(num1.replace(/[^0-9\.]/g, ''), 10) === parseFloat(num2.replace(/[^0-9\.]/g, ''), 10)) {
return true;
} else {
return false;
}
}
function moveBackToCatalog() {
if (jQuery('[id$="tblSimpleSearch"] .search-button').length > 0) {
var targetElement = jQuery('[id$="tblSimpleSearch"] .search-button').parent();
jQuery('.divCategoryCrumb + .ProductCardBackToCatalog .catalog-button').detach().prependTo(targetElement);
}
}
//End Added by Kevin on 9th Sept, 2015 for Task# 18711 - Add to cart quantity format
/*Added by Jam to change the dropdown design*/
function dropKickInit() {
jQuery('.autoship-information-wrapper .select-arrow-wrapper select, .product-card-custom-attributes .gridCustomAttribute select,.dropkick-select').dropkick();
}
/*New Product DropDown*/
var changeFromDropKickToQuantity = false,
changeFromDropKickToShipping = false,
requestFromBottomSkuList = false,
requestFromTopSkuList = false;
function updateNewDropDownBottom() {
if (jQuery('[id$="divSKUContentBottom"]').length > 0) {
if (jQuery('#product-card .product-item-buttons').length == 1) {
jQuery('#product-card').addClass('sku-1');
}
jQuery('#product-card').addClass('varSKUasQuantity');
var prsSelectedIndex = 0;
jQuery('#product-card').addClass('new-dropdown-enabled');
jQuery('[id$="divSKUContentBottom"] .grid [id$="_lblSKUName"]').each(function (index) {
var skuText = jQuery(this).text(),
//skuId = jQuery(this).attr('id').replace('_lblSKUCode','');
skuId = jQuery(this).attr('id').replace('_lblSKUName', '');
skuButton = skuId + '_btnAddToCart';
buttonHref = jQuery('#' + skuButton).attr('href');
jQuery('#sku-list-bottom').append('
');
if (index == 0) {
jQuery('[id*="' + skuId + '"]').each(function () {
//jQuery(this).parents('[class*="product-"]').show();
//jQuery(this).parents('.quantity-wrapper').show();
if (jQuery(this).parents('.quantity-wrapper').length != 1) {
jQuery(this).parents('[class*="product-"]').show();
}
});
jQuery('#add-to-cart-selected-sku-bottom').attr('href', buttonHref);
}
});
jQuery('[id$="divSKUContentBottom"] .autoship-information-wrapper [id$="_autoshipInformation"]').each(function () {
var baseId = jQuery(this).attr('id').replace('_autoshipInformation', ''),
targetId = baseId + '_dropkick-wrapper',
targetButtonId = baseId + '_pushbutton-wrapper';
jQuery(this).parent().find('.target-new-dropdown-location').attr('id', targetId);
jQuery(this).parent().find('.target-new-pushbutton-location').attr('id', targetButtonId);
});
/*For moving the new dropdown*/
var selectedOption = jQuery('#sku-list-bottom').prop('selectedIndex'),
dataId = jQuery("#sku-list-bottom option").eq(selectedOption).attr('data-attributes-id');
/*End for moving new dropdown*/
jQuery('[id$="divSKUContentBottom"] .autoship-information-wrapper .select-arrow-wrapper select, [id$="divSKUContentBottom"] .product-card-custom-attributes .gridCustomAttribute select').on('change', function (index) {
prsSelectedIndex = jQuery(this).prop('selectedIndex');
}).dropkick('select', 0);
jQuery('#sku-list-bottom').on('change', function () {
var skuButton = jQuery('option:selected', this).attr('data-button-id'),
skuID = jQuery('option:selected', this).attr('data-attributes-id'),
buttonHref = jQuery('#' + skuButton).attr('href'),
selectedOption = jQuery('#sku-list-bottom').prop('selectedIndex'),
dataId = jQuery("#sku-list-bottom option").eq(selectedOption).attr('data-attributes-id');
jQuery('#add-to-cart-selected-sku-bottom').attr('href', buttonHref).removeClass('button-disabled');
/*Script to move the new dropdown and button to their new location*/
jQuery('[id$="sku-list-bottom"]').detach().appendTo('#' + dataId + '_dropkick-wrapper');
jQuery('#add-to-cart-selected-sku-bottom').detach().appendTo('#' + dataId + '_pushbutton-wrapper');
/*End Script to move the new dropdown and button to their new location*/
jQuery('[id$="divSKUContentBottom"] .product-card-item-name,[id$="divSKUContentBottom"] .product-card-item-price,[id$="divSKUContentBottom"] .product-card-custom-attributes,[id$="divSKUContentBottom"] .product-item-buttons,[id$="divSKUContentBottom"] .quantity-wrapper,[id$="divSKUContentBottom"] .autoship-information-wrapper,[id$="divSKUContentBottom"] .product-card-item-separator').hide();
requestFromBottomSkuList = true;
jQuery('#' + skuID + '_ddrAutoshipFrequency').dropkick('select', prsSelectedIndex);
/*For changing the sku-list-top*/
if (jQuery('#sku-list-top option').length > 0 && changeFromDropKickToQuantity == false) {
changeFromDropKickToQuantity = true;
jQuery('#sku-list-top').dropkick('select', selectedOption);
}
/*End for changing the sku-list-top*/
jQuery('[id*="' + skuID + '"]').each(function () {
//jQuery(this).parents('[class*="product-"]').show();
//jQuery(this).parents('.quantity-wrapper').show();
if (jQuery(this).parents('.quantity-wrapper').length != 1) {
jQuery(this).parents('[class*="product-"]').show();
}
});
if (buttonHref == undefined) {
jQuery('#add-to-cart-selected-sku-bottom').removeAttr('href').addClass('button-disabled');
}
changeFromDropKickToQuantity = false;
}).dropkick();
/*Script to move the new dropdown and button to their new location*/
jQuery('[id$="sku-list-bottom"]').detach().appendTo('#' + dataId + '_dropkick-wrapper');
jQuery('#add-to-cart-selected-sku-bottom').detach().appendTo('#' + dataId + '_pushbutton-wrapper');
/*End Script to move the new dropdown and button to their new location*/
jQuery('.target-new-pushbutton-location,.target-new-dropdown-wrapper').show();
}
}
function updateNewDropDownTop() {
if (jQuery('[id$="divSKUContentTop"]').length > 0) {
jQuery('#product-card').addClass('varSKUasQuantity');
var prsSelectedIndex = 0;
jQuery('#product-card').addClass('new-dropdown-enabled');
jQuery('[id$="divSKUContentTop"] .grid [id$="_lblSKUName"]').each(function (index) {
var skuText = jQuery(this).text(),
//skuId = jQuery(this).attr('id').replace('_lblSKUCode','');
skuId = jQuery(this).attr('id').replace('_lblSKUName', '');
skuButton = skuId + '_btnAddToCart';
buttonHref = jQuery('#' + skuButton).attr('href');
jQuery('#sku-list-top').append('
');
if (index == 0) {
jQuery('[id*="' + skuId + '"]').each(function () {
//jQuery(this).parents('[class*="product-"]').show();
//jQuery(this).parents('.quantity-wrapper').show();
if (jQuery(this).parents('.quantity-wrapper').length != 1) {
jQuery(this).parents('[class*="product-"]').show();
}
});
jQuery('#add-to-cart-selected-sku-top').attr('href', buttonHref);
}
});
jQuery('[id$="divSKUContentTop"] .autoship-information-wrapper [id$="_autoshipInformation"]').each(function () {
var baseId = jQuery(this).attr('id').replace('_autoshipInformation', ''),
targetId = baseId + '_dropkick-wrapper',
targetButtonId = baseId + '_pushbutton-wrapper';
jQuery(this).parent().find('.target-new-dropdown-location').attr('id', targetId);
jQuery(this).parent().find('.target-new-pushbutton-location').attr('id', targetButtonId);
});
/*For moving the new dropdown*/
var selectedOption = jQuery('#sku-list-top').prop('selectedIndex'),
dataId = jQuery("#sku-list-top option").eq(selectedOption).attr('data-attributes-id');
/*End for moving new dropdown*/
jQuery('[id$="divSKUContentTop"] .autoship-information-wrapper .select-arrow-wrapper select, [id$="divSKUContentTop"] .product-card-custom-attributes .gridCustomAttribute select').on('change', function (index) {
prsSelectedIndex = jQuery(this).prop('selectedIndex');
}).dropkick('select', 0);
jQuery('#sku-list-top').on('change', function () {
var skuButton = jQuery('option:selected', this).attr('data-button-id'),
skuID = jQuery('option:selected', this).attr('data-attributes-id'),
buttonHref = jQuery('#' + skuButton).attr('href'),
selectedOption = jQuery('#sku-list-top').prop('selectedIndex'),
dataId = jQuery("#sku-list-top option").eq(selectedOption).attr('data-attributes-id');
jQuery('#add-to-cart-selected-sku-top').attr('href', buttonHref).removeClass('button-disabled');
/*Script to move the new dropdown and button to their new location*/
jQuery('[id$="sku-list-top"]').detach().appendTo('#' + dataId + '_dropkick-wrapper');
jQuery('#add-to-cart-selected-sku-top').detach().appendTo('#' + dataId + '_pushbutton-wrapper');
/*End Script to move the new dropdown and button to their new location*/
jQuery('[id$="divSKUContentTop"] .product-card-item-name,[id$="divSKUContentTop"] .product-card-item-price,[id$="divSKUContentTop"] .product-card-custom-attributes,[id$="divSKUContentTop"] .product-item-buttons,[id$="divSKUContentTop"] .quantity-wrapper,[id$="divSKUContentTop"] .autoship-information-wrapper,[id$="divSKUContentTop"] .product-card-item-separator').hide();
requestFromTopSkuList = true;
jQuery('#' + skuID + '_ddrAutoshipFrequency').dropkick('select', prsSelectedIndex);
/*For changing the sku-list-bottom*/
if (jQuery('#sku-list-bottom option').length > 0 && changeFromDropKickToQuantity == false) {
changeFromDropKickToQuantity = true;
jQuery('#sku-list-bottom').dropkick('select', selectedOption);
}
/*End for changing the sku-list-bottom*/
jQuery('[id*="' + skuID + '"]').each(function () {
//jQuery(this).parents('[class*="product-"]').show();
//jQuery(this).parents('.quantity-wrapper').show();
if (jQuery(this).parents('.quantity-wrapper').length != 1) {
jQuery(this).parents('[class*="product-"]').show();
}
});
if (buttonHref == undefined) {
jQuery('#add-to-cart-selected-sku-top').removeAttr('href').addClass('button-disabled');
}
changeFromDropKickToQuantity = false;
}).dropkick();
/*Script to move the new dropdown and button to their new location*/
jQuery('[id$="sku-list-top"]').detach().appendTo('#' + dataId + '_dropkick-wrapper');
jQuery('#add-to-cart-selected-sku-top').detach().appendTo('#' + dataId + '_pushbutton-wrapper');
/*End Script to move the new dropdown and button to their new location*/
jQuery('.target-new-pushbutton-location,.target-new-dropdown-wrapper').show();
}
}
function showOldDropDownUI() {
jQuery('#product-card .product-card-item-name,#product-card .product-card-item-price,#product-card .product-card-custom-attributes,#product-card .product-item-buttons,#product-card .quantity-wrapper,#product-card .autoship-information-wrapper,#product-card .product-card-item-separator').show();
}
function copyAutoShipFrequencyDate() {
if (jQuery('[id$="divSKUContentTop"] [id$="lblSKUName"]').length > 0 && jQuery('[id$="divSKUContentBottom"] [id$="lblSKUName"]').length > 0) {
jQuery('[id$="divSKUContentTop"] select[id$="ddrAutoshipFrequency"]').on('change', function () {
if (requestFromBottomSkuList != true) {
var elementId = jQuery(this).attr('id'),
targetElementId = elementId.split('dgSKUTop')[0] + 'dgSKU' + elementId.split('dgSKUTop')[1],
selectedOption = jQuery('#' + elementId).prop('selectedIndex');
if (changeFromDropKickToShipping == false) {
changeFromDropKickToShipping = true;
jQuery('[id$="autoshipInformation"] select#' + targetElementId).dropkick('select', selectedOption);
}
changeFromDropKickToShipping = false;
}
requestFromBottomSkuList = false;
});
jQuery('[id$="divSKUContentBottom"] select[id$="ddrAutoshipFrequency"]').on('change', function () {
if (requestFromTopSkuList != true) {
var elementId = jQuery(this).attr('id'),
targetElementId = elementId.split('dgSKU')[0] + 'dgSKUTop' + elementId.split('dgSKU')[1],
selectedOption = jQuery('#' + elementId).prop('selectedIndex');
if (changeFromDropKickToShipping == false) {
changeFromDropKickToShipping = true;
jQuery('[id$="autoshipInformation"] select#' + targetElementId).dropkick('select', selectedOption);
}
changeFromDropKickToShipping = false;
}
requestFromTopSkuList = false;
});
jQuery('[id*="divSKUContentTop"] .quantity-wrapper select[id$="ddrQuantity"]').on('change', function () {
var selectedOption = jQuery(this).prop('selectedIndex'),
targetId = jQuery(this).attr('id').split('dgSKUTop'),
targetElement = targetId[0] + 'dgSKU' + targetId[1];
if (jQuery('#' + targetElement).length > 0 && changeFromDropKickToQuantity == false) {
changeFromDropKickToQuantity = true;
jQuery('#' + targetElement).dropkick('select', selectedOption);
}
changeFromDropKickToQuantity = false;
});
jQuery('[id*="divSKUContentBottom"] .quantity-wrapper select[id$="ddrQuantity"]').on('change', function () {
var selectedOption = jQuery(this).prop('selectedIndex'),
targetId = jQuery(this).attr('id').split('dgSKU'),
targetElement = targetId[0] + 'dgSKUTop' + targetId[1];
if (jQuery('#' + targetElement).length > 0 && changeFromDropKickToQuantity == false) {
changeFromDropKickToQuantity = true;
jQuery('#' + targetElement).dropkick('select', selectedOption);
}
changeFromDropKickToQuantity = false;
});
}
}
function dateSelected(sender, eventArgs) {
var pickerID = sender.get_id();
if (pickerID.includes('dgSKUTop')) {
pickerID = pickerID.replace("dgSKUTop", "dgSKU");
}
else {
pickerID = pickerID.replace("dgSKU", "dgSKUTop");
}
var picker = $find(pickerID);
if (picker && picker.get_dateInput().get_value() != eventArgs.get_newValue()) {
picker.set_selectedDate(eventArgs.get_newDate());
}
UpdateAutoshipLabel(sender.get_id());
}
function initNewDropDownUI() {
if (typeof (varSKUasQuantity) != "undefined" && varSKUasQuantity.toLowerCase() == 'true') {
if (jQuery('[id$="divSKUContentTop"] .grid [id$="_lblSKUName"]').length > 0 || jQuery('[id$="divSKUContentBottom"] .grid [id$="_lblSKUName"]').length > 0) {
updateNewDropDownTop();
updateNewDropDownBottom();
copyAutoShipFrequencyDate();
} else {
showOldDropDownUI();
}
} else {
showOldDropDownUI();
}
}
function applyElevateZoomNew() {
var bigimage = jQuery('.fancybox.shown').attr('href');
jQuery('#product-card .myimage').elevateZoom({
zoomType: zoom_type,
cursor: zoom_cursor_type,
zoomWindowFadeIn: zoom_fade_in,
zoomWindowFadeOut: zoom_fade_out,
scrollZoom: zoom_scroll,
easing: zoom_easing,
lensOpacity: zoom_lens_opacity,
lensShape: zoom_lens_shape,
lensSize: zoom_lens_size,
zoomImage: bigimage,
zoomWindowWidth: zoom_win_width,
zoomWindowHeight: zoom_win_height,
borderSize: zoom_win_border,
});
}
function restartElevateZoomNew() {
jQuery(".zoomContainer").remove();
applyElevateZoomNew();
}
function newcustomElevateZoom() {
jQuery('#product-card #views_block li a').off();
jQuery('#product-card #views_block li a').mouseenter(function () {
var largeImgSrc = '';
jQuery('#ctl00_CPH_ctl11_BM_spViewLargeImage').hide();
jQuery('#ctl00_CPH_ctl11_BM_spPlayVideo').hide();
if (jQuery(this).attr('isvideo') == "1") {
largeImgSrc = jQuery(this).attr('imageurl');
jQuery('#product-card #image-block #view_full_size').addClass('video-thumbnail');
jQuery('#ctl00_CPH_ctl11_BM_myimage').removeClass('myimage');
jQuery('#ctl00_CPH_ctl11_BM_spPlayVideo').show();
}
else {
largeImgSrc = jQuery(this).attr('href');
jQuery('#product-card #image-block #view_full_size').removeClass('video-thumbnail');
jQuery('#ctl00_CPH_ctl11_BM_myimage').addClass('myimage');
jQuery('#ctl00_CPH_ctl11_BM_spViewLargeImage').show();
}
jQuery('#product-card #image-block img').attr('src', largeImgSrc);
jQuery('#product-card #views_block li a').removeClass('shown');
jQuery(this).addClass('shown');
restartElevateZoomNew();
});
jQuery("#product-card #views_block li a").first().trigger("mouseover");
jQuery('#product-card .primary_block').fadeIn();
limitThumbnailImage();
}
function limitThumbnailImage() {
if (jQuery('#product-card[productthumbnailview="leftvertical"]').length > 0) {
var thumbListHeight = (jQuery('#thumbs_list li').outerHeight() * 3) + 20;
console.log(thumbListHeight);
jQuery('#thumbs_list').height(thumbListHeight + 'px');
}
}
/*End added by Jam*/
jQuery(document).ready(function () {
initNewDropDownUI();
dropKickInit();
loadColorThief();
moveBackToCatalog();
var salesPrice = jQuery('.grid td[id$="tdSalesPrice"] .label').text(), yourPrice = jQuery('.grid td[id$="tdYourPrice"] .label').text();
var isEqual = comparePrices(salesPrice, yourPrice);
console.log(isEqual);
if (isEqual == true) {
jQuery('.grid td[id$="tdYourPrice"]').hide();
}
InitAutoshipPopover();
initFlavorPickupPopup(); // Added by Kevin for Task#46330
BindPopoverCart();
});
jQuery(window).on('load', function () {
newcustomElevateZoom();
try {
var color = sessionStorage.getItem('colorThiefRgb');
jQuery('head').append('');
jQuery('head').append('');
} catch (colorThiefError) { }
});
function autoshipDropdownListChange(autoshipddlClientId, autoshipDateSelectorClientId, tdYousaveClientId, tdSalesPriceClientId, tdYousave_AutoshipClientId, tdAutoshipPriceClientId) {
var autoshipddl = jQuery('#' + autoshipddlClientId);
var autoshipdateselector = jQuery('#' + autoshipDateSelectorClientId);
var tdYousaveElement = jQuery('#' + tdYousaveClientId);
var tdSalesPriceElement = jQuery('#' + tdSalesPriceClientId);
var tdYousave_AutoshipElement = jQuery('#' + tdYousave_AutoshipClientId);
var tdAutoshipPriceElement = jQuery('#' + tdAutoshipPriceClientId);
var AddtoCartTop = jQuery('#add-to-cart-selected-sku-top');
var AddtoCartBottom = jQuery('#add-to-cart-selected-sku-bottom');
if (autoshipddl != null) {
if (autoshipddl.val() == "-1") {
AddtoCartTop.text()
autoshipdateselector.hide();
AddtoCartTop.html('Add to Cart');
AddtoCartBottom.html('Add to Cart');
if (tdYousaveElement.length > 0) {
tdYousaveElement.show();
}
if (tdSalesPriceElement.length > 0) {
tdSalesPriceElement.find('span.label').removeClass('linethrough')
}
if (tdYousave_AutoshipElement.length > 0) {
tdYousave_AutoshipElement.hide();
}
if (tdAutoshipPriceElement != null) {
tdAutoshipPriceElement.find('span.label').addClass('linethrough')
}
}
else {
autoshipdateselector.show();
AddtoCartTop.html('
Add Preferred Membership');
AddtoCartBottom.html('
Add Preferred Membership');
if (tdYousaveElement.length > 0 && tdYousave_AutoshipElement.length > 0) {
tdYousaveElement.hide();
}
if (tdSalesPriceElement.length > 0 && tdAutoshipPriceElement.length > 0) {
tdSalesPriceElement.find('span.label').addClass('linethrough')
}
if (tdYousave_AutoshipElement.length > 0) {
tdYousave_AutoshipElement.show();
}
if (tdAutoshipPriceElement.length > 0) {
tdAutoshipPriceElement.find('span.label').removeClass('linethrough')
}
}
}
}
function autoshipRadioButtonListChange(autoshipddlClientId, autoshipDateSelectorClientId, tdYousaveClientId, tdSalesPriceClientId, tdYousave_AutoshipClientId, tdAutoshipPriceClientId, defaultDate) {
var autoshipddl = jQuery('#' + autoshipddlClientId);
var autoshipdateselector = jQuery('#' + autoshipDateSelectorClientId);
var tdYousaveElement = jQuery('#' + tdYousaveClientId);
var tdSalesPriceElement = jQuery('#' + tdSalesPriceClientId);
var tdYousave_AutoshipElement = jQuery('#' + tdYousave_AutoshipClientId);
var tdAutoshipPriceElement = jQuery('#' + tdAutoshipPriceClientId);
var AddtoCartTop = jQuery('#add-to-cart-selected-sku-top');
var AddtoCartBottom = jQuery('#add-to-cart-selected-sku-bottom');
jQuery('#' + autoshipddlClientId).find('td').css({ "background-color": "#fff" });
jQuery('#' + autoshipddlClientId + ' input:checked').parent('td').css({ "background-color": "#f3f3f3" });
var calStartDateId = autoshipDateSelectorClientId.replace('dvStartDate', 'calStartDate_dateInput');
jQuery('#' + autoshipddlClientId).find('.autoshiplabel').empty();
var addtoCartButton = autoshipddlClientId.replace('rblAutoshipFrequency', 'btnAddToCart');
if (autoshipddl != null) {
if (jQuery('#' + autoshipddlClientId + ' input:checked').val() == "-1") {
AddtoCartTop.text()
autoshipdateselector.hide();
jQuery('#' + addtoCartButton).html('Add to Cart');
if (tdYousaveElement.length > 0) {
tdYousaveElement.show();
}
if (tdSalesPriceElement.length > 0) {
tdSalesPriceElement.find('span.label').removeClass('linethrough')
}
if (tdYousave_AutoshipElement.length > 0) {
tdYousave_AutoshipElement.hide();
}
if (tdAutoshipPriceElement != null) {
tdAutoshipPriceElement.find('span.label').addClass('linethrough')
}
}
else {
autoshipdateselector.show();
jQuery('#' + addtoCartButton).html('
Add Preferred Membership');
if (tdYousaveElement.length > 0 && tdYousave_AutoshipElement.length > 0) {
tdYousaveElement.hide();
}
if (tdSalesPriceElement.length > 0 && tdAutoshipPriceElement.length > 0) {
tdSalesPriceElement.find('span.label').addClass('linethrough')
}
if (tdYousave_AutoshipElement.length > 0) {
tdYousave_AutoshipElement.show();
}
if (tdAutoshipPriceElement.length > 0) {
tdAutoshipPriceElement.find('span.label').removeClass('linethrough')
}
var autoshipStartDate = defaultDate;
if (jQuery('#' + calStartDateId).length > 0) {
autoshipStartDate = jQuery('#' + calStartDateId).val();
}
var label = '
';
jQuery('#' + autoshipddlClientId + ' input:checked').parent('td').append(label);
}
}
}
function UpdateAutoshipLabel(calStartDateId) {
var radioAutoship = calStartDateId.replace('calStartDate', 'rblAutoshipFrequency');
var calStartDateInputId = calStartDateId.replace('calStartDate', 'calStartDate_dateInput');
jQuery('#' + radioAutoship).find('.autoshiplabel').empty();
var autoshipStartDate = autoshipStartDate = jQuery('#' + calStartDateInputId).val();
var label = '
';
jQuery('#' + radioAutoship + ' input:checked').parent('td').append(label);
}
function InitAutoshipPopover() {
try {
jQuery(".autoship-popover").each(function () {
jQuery(this).popover({
html: true,
placement: 'bottom',
trigger: 'hover',
container: jQuery(this),
delay: { "show": 100, "hide": 0 },
content: function () {
return jQuery('#ctl00_CPH_ctl11_BM_autoshippopovercontent').html();
}
});
});
jQuery(".autoship-popover").on('shown.bs.popover', function () {
var currentTop = parseInt(jQuery('.popover').css('top'));
var currentLeft = parseInt(jQuery('.popover').css('left'));
jQuery('.popover').css({
top: (currentTop + 5) + 'px',
left: (currentLeft + 65) + 'px'
});
});
}
catch (exception) { }
}
// Added by Kevin for Task#46330
function initFlavorPickupPopup() {
jQuery('[data-hook="hasflavors"]').bind('click', function (e) {
e.preventDefault();
var mainskuqty = 1;
if ('1' == 1) {
mainskuqty = jQuery(this).parent().find('input[id*="numPlusMinusQuantity"]').val();
}
else if ('1' == 2) {
mainskuqty = jQuery(this).parent().find('select[id$="ddrQuantity"]').val();
}
else if ('1' == 3 || '1' == 4) {
mainskuqty = jQuery(this).parent().find('input[id*="numQuantity"]').val()
}
var skuId = jQuery(this).attr("skuid").toString();
var hrefValue = jQuery(this).attr("href");
fnBindSKUFlavors(skuId, 'dvSKUFlavorPickupDialog', hrefValue, mainskuqty, 'Shop');
});
}
// End Added by Kevin for Task#46330
{{if IsAutoshipItem == false}}
${RetailPriceFormatted}
{{else}}
${AutoshipPriceFormatted}
{{/if}}
${SelectedAutoshipItemText}