1 2$(document).ready(function () { 3 if (!String.prototype.includes) { 4 String.prototype.includes = function (search, start) { 5 'use strict' 6 if (typeof start != 'number') { 7 start = 0; 8 } 9 10 if (start + start.length > this.length) { 11 return false; 12 } else { 13 return this.indexOf(search, start) !== -1; 14 } 15 }; 16 } 17 18 if (typeof pageRequestManager !== 'undefined' && pageRequestManager !== null) { 19 pageRequestManager.add_pageLoaded(function (sender, args) { 20 pageLoaded(); 21 }); 22 }; 23 pageLoaded(); 24 25 //Remove sessionStorage.clickSubmitButton if not on ShowProduct page 26 if (!window.location.pathname.includes("/ShowProduct") && !window.location.pathname.includes("/p-")) { 27 delete sessionStorage.clickedSubmitButton; 28 } 29 30 //ewtn product image styling 31 if ($('.dsproductpage').length) { 32 $('#soSidebar').addClass('topmargin'); 33 $('#soContent').addClass('topmargin'); 34 } 35 36 $(document).on('change', '.hasDatepicker', function () { 37 $(this).datepicker("setDate", $(this).datepicker("getDate")); 38 }); 39 jQuery("#soMiniCart:has(div)").wrap("<div class='soMiniCartPopped'></div>"); 40 jQuery("#soCartLink").HoverDialog(); 41 42 $(".slideDownLink").click(function () { 43 $(".soSlideDown").slideToggle(500) 44 }); 45 $(".soContainerCloseBtn a").click(function () { 46 $(".soSlideDown").slideToggle(500) 47 }); 48 49 //<!-- SIDEBAR MENU JAVASCRIPT --> 50 jQuery('#soSideBarMenu li.soMenuItem').click(function () { 51 jQuery('#soSideBarMenu ul li').removeClass('active'); 52 jQuery('#soSideBarMenu ul.soMenuItems').removeClass('active'); 53 jQuery(this).next('ul.soMenuItems').addClass('active'); 54 jQuery(this).next('ul.soMenuItems').slideToggle("normal"); 55 jQuery('#soSideBarMenu ul.soMenuItems:not(.active)').not(jQuery(this).parents()).hide("fast"); 56 }); 57 var url = window.location.href; 58 jQuery('div#soSideBarMenu ul li a').each(function () { 59 if (this.href.toLowerCase().replace(/\/$/, '') == url.toLowerCase()) { 60 jQuery(this).parents('.soMenuItems').addClass('active').show("fast"); 61 jQuery(this).parent().addClass('current'); 62 } 63 }); 64}); 65 66function pageLoaded() { 67 //forgot password 68 $("#forgotPass").off('click').on('click', function () { 69 //forgot password popup 70 var $passwordDialog = $("[sodialog][sodialogname='password']"); 71 $passwordDialog.dialog('option', 'position', { 72 my: "center", 73 at: "center", 74 of: window, 75 collision: "fit", 76 using: function (pos) { 77 var topOffset = $(this).css(pos).offset().top; 78 if (topOffset < 0) { 79 $(this).css("top", pos.top - topOffset); 80 } 81 } 82 }); 83 $passwordDialog.dialog("open"); 84 85 //forgot password link slidedown 86 var checkbox = $("[sotogglechild=\"[data-role='passwordRecoveryDiv']\"]"); 87 checkbox.click(); 88 }); 89}; 90 91$(document).ready(function () { //browser detection 92 var enabled = $('div#browserDetect'); //set by appconfig 93 var msg = enabled.innerText; 94 if (enabled.length > 0) { 95 var msgContainer = document.createElement('div'); 96 msgContainer.innerHTML = '<div id="oldBrowserMsg" style="text-align:center;background:#ff0000;padding:5px 0">' + msg + '</div>'; 97 var browser = ''; 98 99 var ua = navigator.userAgent, tem, 100 M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 101 if (/trident/i.test(M[1])) { 102 tem = /\brv[ :]+(\d+)/g.exec(ua) || []; 103 browser = 'IE ' + (tem[1] || ''); 104 } 105 if (M[1] === 'Chrome') { 106 tem = ua.match(/\bOPR\/(\d+)/) 107 if (tem != null) 108 browser = 'Opera ' + tem[1]; 109 } 110 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; 111 if ((tem = ua.match(/version\/(\d+)/i)) != null) 112 M.splice(1, 1, tem[1]); 113 114 browser = browser == '' ? M.join(' ') : browser; 115 116 if (browser.indexOf('MSIE') > -1) { 117 //get IE version 118 var ver = parseInt(browser.substring(browser.indexOf(' ') + 1)); 119 if (ver <= 8) 120 document.body.insertBefore(msgContainer, document.body.firstChild); 121 } 122 } 123}); 124 125$(document).ready(function () { //show or hide state not required message 126 var countryddl = $('[data-address-fieldtype="Country"]'); 127 128 if (countryddl.length) { 129 var required = countryddl.find('option:selected').attr('data-postalcode-required'); 130 131 if (required == 'true') 132 $('stateNotRequired').css('display', 'none'); 133 else 134 $('stateNotRequired').css('display', 'block'); 135 } 136 137}); 138 139$(document).ready(function () {//product image gallery viewer 140 $('.dsproductimage .GalleryImgContainer').click(function () { 141 var singleImage = $('#jqGallery0 .GalleryHolder'); 142 var leftArrow = "<div class='galleryarrow left'></div>"; 143 var rightArrow = "<div class='galleryarrow right'></div>"; 144 var image = $(this).html(); 145 146 if (singleImage.css('display') != 'none')
147 $('#imageViewerDialog').html(leftArrow + image + rightArrow); 148 else 149 $('#imageViewerDialog').html(image); 150 151 var dialogWidth = $(window).width() * .9 > 900 ? 900 : $(window).width() * .9; 152 153 var $imgDialog = $("[sodialog][sodialogname='imageviewer']"); 154 155 $imgDialog.dialog('option', 'position', { 156 my: "center", 157 at: "center", 158 of: window, 159 collision: "fit", 160 using: function (pos) { 161 var topOffset = $(this).css(pos).offset().top; 162 if (topOffset < 0) { 163 $(this).css("top", pos.top - topOffset); 164 } 165 } 166 }); 167 $imgDialog.dialog('option', 'width', dialogWidth); 168 $imgDialog.dialog('option', 'height', 'auto'); 169 $imgDialog.dialog("open"); 170 171 var currentimgId; 172 $('.galleryarrow').click(function () { 173 var currentimg = $('#imageViewerDialog').find('img'); 174 var gallery = $('.GalleryHolder').find('.GalleryItem'); 175 var nextimgId = 0; 176 var imgLocations = new Array(); 177 178 $.each(gallery, function () { 179 var imgsrc = $(this).find('img').attr('src'); 180 if (typeof currentimgId == 'undefined' && currentimg.attr('src').indexOf(imgsrc) >= 0) { 181 currentimgId = parseInt($(this).attr('id').slice(-1)); 182 } 183 imgLocations.push(imgsrc); 184 }); 185 186 if (currentimgId == null || currentimgId < 0 || currentimgId > gallery.length) 187 currentimgId = 0; 188 189 if ($(this).hasClass('right')) { 190 if (currentimgId < gallery.length - 1) 191 nextimgId = currentimgId + 1; 192 else 193 nextimgId = 0; 194 } else { 195 if (currentimgId > 0) 196 nextimgId = currentimgId - 1; 197 else 198 nextimgId = gallery.length - 1; 199 } 200 201 currentimg.attr('src', imgLocations[nextimgId]); 202 currentimgId = nextimgId; 203 }); 204 }); 205}); 206 207$(document).ready(function () {//single image viewer 208 $('.singleImageViewer').click(function () { 209 var image = $(this).html(); 210 211 $('#imageViewerDialog').html(image); 212 213 var dialogWidth = $(window).width() * .9 > 900 ? 900 : $(window).width() * .9; 214 215 var $imgDialog = $("[sodialog][sodialogname='imageviewer']"); 216 217 $imgDialog.dialog('option', 'position', { 218 my: "center", 219 at: "center", 220 of: window, 221 collision: "fit", 222 using: function (pos) { 223 var topOffset = $(this).css(pos).offset().top; 224 if (topOffset < 0) { 225 $(this).css("top", pos.top - topOffset); 226 } 227 } 228 }); 229 $imgDialog.dialog('option', 'width', dialogWidth); 230 $imgDialog.dialog('option', 'height', 'auto'); 231 $imgDialog.dialog("open"); 232 }); 233}); 234 235$(document).ready(function () { 236 $('#AddressDropDown').change(function () { 237 var address = addresses[eval($(this).val())]; 238 $('#ddlTitle').val(address.Title); 239 $('#tbFirstName').val(address.FirstName); 240 $('#tbLastName').val(address.LastName); 241 $('#ddlSuffix').val(address.Suffix); 242 $('#tbAddress1').val(address.Address1); 243 $('#tbAddress2').val(address.Address2); 244 $('#tbSuite').val(address.Suite); 245 $('#ddlCountry').val(address.Country); 246 $('#tbCity').val(address.City); 247 $('#tbZip').val(address.Zip); 248 $('#ddlState').val(address.State); 249 }); 250}); 251 252// ------- 253// allow floating numbers values to be entered only 254// ------- 255function allowFloat(event) { 256 var keyval = window.event ? window.event.keyCode : event.which; 257 258 if (!(((keyval >= 48) && (keyval <= 57)) || (keyval == 46))) { 259 // if value not digit, suppress this (code depends on browser) 260 if (!window.XMLHttpRequest) { 261 window.event.keyCode = null; 262 } 263 else if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) { 264 window.event.keyCode = null; 265 } 266 else { 267 if (!((keyval === 0) || (keyval <= 8))) { 268 event.preventDefault(); 269 } 270 } 271 } 272} 273// ------- 274// allow numeric values to be entered only 275// ------- 276function allowNumber(event) { 277 var keyval = window.event ? window.event.keyCode : event.which; 278 279 if (!(keyval >= 48 && keyval <= 57)) { 280 // if value not digit, suppress this (code depends on browser) 281 if (!window.XMLHttpRequest) { 282 window.event.keyCode = null; 283 } 284 else if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) { 285 window.event.keyCode = null; 286 } 287 else { 288 if (!((keyval === 0) || (keyval <= 8))) { 289 event.preventDefault(); 290 } 291 } 292 } 293} 294 295function AccountMaritalStatus_OnChange() { 296 if ($("select[id*='ddlMarital']").val() == 'Single') { 297 $("[id*='trSpouse']").hide(); 298 } 299 else { 300 $("[id*='trSpouse']").show(); 301 302 // default last name 303 var currentLastName = $("input[id$='txtSpouseLastName']").val(); 304 if (currentLastName !== undefined && currentLastName.length === 0) { 305 var lastName = $("input[id$='_txtLastName']").val(); 306 $("input[id$='txtSpouseLastName']").val(lastName); 307 } 308 } 309} 310 311$(document).ready(function () { 312 $("[id*='txtSuite']").attr('autocomplete', 'off'); 313}); 314 315function CheckPledgeOverpayment() { 316 $("#pledgesHistoryTable").find("input[id$='txtMakeADonation']").css("background-color", ""); 317 var exceeds100 = false; 318 $("#pledgesHistoryTable tr").each(function (index) { 319 var checked = $(this).find("input[id$='chkMakeADonation']").is(':checked'); 320 var amount = parseFloat($(this).find("input[id$='txtMakeADonation']").val()); 321 if (checked && amount > 0) { 322 var pledged = parseFloat($(this).find("input[id$='hdnPledgedAmount']").val()); 323 var donated = parseFloat($(this).find("input[id$='hdnDonatedAmount']").val()); 324 if (pledged === 0 || (donated + amount) / pledged > 1) { 325 $(this).find("input[id$='txtMakeADonation']").css("background-color", "#FF6347"); 326 exceeds100 = true; 327 } 328 } 329 });
330 if (exceeds100) { 331 if (typeof pledgeExceeds100Warning === 'undefined') { 332 return confirm("You are about to exceed 100% on one or more of your pledges."); 333 } 334 else { 335 return confirm(pledgeExceeds100Warning); 336 } 337 } 338 return true; 339} 340 341function PaymentTypeCheckCheckoutValidation(includesRecurring, recurringOnly) { 342 if (includesRecurring == 'True') { 343 if (recurringOnly == 'True') { 344 alert(jsRecurringOnlyWarning); 345 return false; 346 } 347 else 348 return confirm(jsIncludesRecurringWarning); 349 } 350 return true; 351} 352 353function createCookie(name, value, days) { 354 if (days) { 355 var date = new Date(); 356 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 357 var expires = "; expires=" + date.toGMTString(); 358 } 359 else var expires = ""; 360 document.cookie = name + "=" + value + expires + "; path=/"; 361} 362 363function readCookie(name) { 364 var nameEQ = name + "="; 365 var ca = document.cookie.split(';'); 366 for (var i = 0; i < ca.length; i++) { 367 var c = ca[i]; 368 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 369 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 370 } 371 return null; 372} 373 374function eraseCookie(name) { 375 createCookie(name, "", -1); 376} 377 378function balanceAmount(element, minimumAmount) { 379 var amount = accounting.unformat($(element).val()); 380 if ((typeof minimumAmount !== "undefined") && (isNaN(amount) || amount < minimumAmount)) { 381 amount = minimumAmount; 382 } 383 if (!isNaN(amount)) { 384 var finalAmt = accounting.formatNumber(amount, 2, ",", "."); 385 $(element).val(finalAmt); 386 } 387} 388 389function shoppingCartValidateOffer() 390{ 391 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () 392 { 393 if($(this).data("href") !== undefined) 394 { 395 $(this).attr("href", $(this).data("href")); 396 $(this).removeClass('disabled'); 397 } 398 }) 399 400 var cartItems = $('#dsShoppingCartPage input[data-role="quantity"]').parent().parent(); 401 402 cartItems.each(function () 403 { 404 var quantityElement = $(this).find('input[data-role="quantity"]'); 405 quantity = parseInt($(quantityElement).val(), 10) == 0 ? 1 : parseInt($(quantityElement).val(), 10); 406 var maxQuantity = parseInt($(quantityElement).attr("data-variant-max-quantity"), 10) || Number.MAX_VALUE; 407 var variantPrice = parseFloat($(quantityElement).attr("data-variant-price")); 408 var subTotalElement = $(this).find('input[data-role="subTotal"]'); 409 410 $(this).find('p.offerErrorMessage').remove(); 411 412 if (subTotalElement.length > 0) 413 { 414 var subTotal = Math.round(parseFloat($(subTotalElement).val().replace(',', '')) * 100) / 100; 415 416 var quantityHistory = parseInt($(subTotalElement).attr("data-offer-history-quantity"), 10); 417 var currentCartMaxQuantity = Math.max(maxQuantity - quantityHistory, 0); 418 var salePrice = parseFloat($(subTotalElement).attr("data-offer-sale-price")); 419 420 $(subTotalElement).val(accounting.formatNumber(subTotal, 2, ",", ".")); 421 422 if ((quantity + quantityHistory) <= maxQuantity) 423 { 424 if (subTotal < (quantity * variantPrice)) 425 { 426 $(this).append("<p class='offerErrorMessage errorLg'>" 427 + GetStringResource('SO.PremiumOffers.MinimumPriceErrorMessage') 428 .replace("{minimumOfferPrice}", accounting.formatNumber(variantPrice, 2, ",", ".")) 429 + "</p>") 430 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () 431 { 432 $(this).data("href", $(this).attr("href")).removeAttr("href").addClass('disabled'); 433 }); 434 } 435 } 436 else 437 { 438 if (salePrice == -1) 439 { 440 if (subTotal < (currentCartMaxQuantity * variantPrice)) 441 { 442 if (quantityHistory == 0) 443 { 444 $(this).append("<p class='offerErrorMessage errorLg'>" 445 + GetStringResource('SO.PremiumOffers.MaxQuantityMinimumPriceErrorMessage') 446 .replace("{minimumOfferPrice}", accounting.formatNumber(variantPrice, 2, ",", ".")) 447 .replace("{maxQuantity}", maxQuantity) 448 + "</p>") 449 } 450 else 451 { 452 $(this).append("<p class='offerErrorMessage errorLg'>" 453 + GetStringResource('SO.PremiumOffers.MaxQuantityMinimumPricePurchaseHistoryErrorMessage') 454 .replace("{minimumOfferPrice}", accounting.formatNumber(variantPrice, 2, ",", ".")) 455 .replace("{maxQuantity}", maxQuantity) 456 .replace("{quantityHistory}", quantityHistory) 457 + "</p>") 458 } 459 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () 460 { 461 $(this).data("href", $(this).attr("href")).removeAttr("href").addClass('disabled'); 462 });
463 return; 464 } 465 if (quantityHistory == 0) 466 { 467 $(this).append("<p class='offerErrorMessage errorLg'>" 468 + GetStringResource('SO.PremiumOffers.MaxQuantityExceededErrorMessage') 469 .replace("{maxQuantity}", maxQuantity) 470 + "</p>") 471 } 472 else 473 { 474 $(this).append("<p class='offerErrorMessage errorLg'>" 475 + GetStringResource('SO.PremiumOffers.MaxQuantityExceededPurchaseHistoryErrorMessage') 476 .replace("{maxQuantity}", maxQuantity) 477 .replace("{quantityHistory}", quantityHistory) 478 + "</p>") 479 } 480 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () 481 { 482 $(this).data("href", $(this).attr("href")).removeAttr("href").addClass('disabled'); 483 }); 484 } 485 else 486 { 487 var minSubTotal = ((currentCartMaxQuantity * variantPrice) + ((quantity - currentCartMaxQuantity) * salePrice)) 488 if (subTotal < minSubTotal) 489 { 490 if (quantityHistory == 0) 491 { 492 $(this).append("<p class='offerErrorMessage errorLg'>" 493 + GetStringResource('SO.PremiumOffers.MinimumOfferAndSalePriceErrorMessage') 494 .replace("{minimumSubTotal}", accounting.formatNumber(minSubTotal, 2, ",", ".")) 495 .replace("{desiredQuantity}", quantity) 496 .replace("{maxQuantity}", maxQuantity) 497 .replace("{minimumOfferPrice}", accounting.formatNumber(variantPrice, 2, ",", ".")) 498 .replace("{salePrice}", accounting.formatNumber(salePrice, 2, ",", ".")) 499 + "</p>") 500 } 501 else 502 { 503 $(this).append("<p class='offerErrorMessage errorLg'>" 504 + GetStringResource('SO.PremiumOffers.MinimumOfferAndSalePricePurchaseHistoryErrorMessage') 505 .replace("{minimumSubTotal}", accounting.formatNumber(minSubTotal, 2, ",", ".")) 506 .replace("{desiredQuantity}", quantity) 507 .replace("{maxQuantity}", maxQuantity) 508 .replace("{minimumOfferPrice}", accounting.formatNumber(variantPrice, 2, ",", ".")) 509 .replace("{salePrice}", accounting.formatNumber(salePrice, 2, ",", ".")) 510 .replace("{quantityHistory}", quantityHistory) 511 + "</p>") 512 } 513 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () 514 { 515 $(this).data("href", $(this).attr("href")).removeAttr("href").addClass('disabled'); 516 }); 517 } 518 } 519 } 520 } 521 522 var productCount = parseInt($(quantityElement).attr("data-product-count"), 10); 523 var productMaxQuantity = parseInt($(quantityElement).attr("data-product-max-quantity"), 10) || Number.MAX_VALUE; 524 525 if ((quantity + productCount) > maxQuantity || (quantity + productCount) > productMaxQuantity) { 526 var MaxQuantityExceededSetToMaximum = $('[id*="hndMaxQuantityExceededSetToMaximum"]'); 527 if (MaxQuantityExceededSetToMaximum && (MaxQuantityExceededSetToMaximum.val() == "true" || MaxQuantityExceededSetToMaximum.val() == "false")) { 528 if (MaxQuantityExceededSetToMaximum.val() == "true") { 529 //Set quantity to maximum 530 quantityElement.val(productMaxQuantity); 531 alert(GetStringResource('SO.MaxQuantityExceededErrorMessage').replace("{maxQuantity}", Math.min(maxQuantity, productMaxQuantity))); 532 } 533 else { 534 //Set quantity to 1 535 quantityElement.val(1); 536 alert(GetStringResource('SO.MaxQuantityExceededErrorMessage').replace("{maxQuantity}", Math.min(maxQuantity, productMaxQuantity))); 537 } 538 } 539 else { 540 $(this).append("<p class='offerErrorMessage errorLg'>" + GetStringResource('SO.MaxQuantityExceededErrorMessage').replace("{maxQuantity}", Math.min(maxQuantity, productMaxQuantity)) + "</p>") 541 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () { 542 $(this).data("href", $(this).attr("href")).removeAttr("href").addClass('disabled'); 543 }); 544 } 545 } 546 547 if (variantPrice == 0) { 548 if (freeProductMax >
548 0 && freeProductMax < (quantity + productCount)) { 549 $(this).append("<p class='offerErrorMessage errorLg'>" + GetStringResource('DS.FreeProduct.ErrorMessage').replace("{maxQuantity}", freeProductMax) + "</p>") 550 $('a.dsCheckoutButton.button3L.soActionBtn').each(function () { 551 $(this).data("href", $(this).attr("href")).removeAttr("href").addClass('disabled'); 552 }); 553 } 554 } 555 }); 556} 557 558function multipleEventRegistrationsWarning() { 559 var showWarning = $('[id$=hdnMultipleEventRegistrationsWarning]').val(); 560 561 if (showWarning == 'True') { 562 var warningMessage = GetStringResource("SO.Events.MultipleRegistrationsWarningMessage"); 563 564 if (!confirm(warningMessage)) { 565 return false; 566 } 567 } 568 569 return true; 570} 571 572function GetStringResource(key) { 573 var stringResource = key; 574 575 $.ajax({ 576 type: "POST", 577 url: "ClientScriptHelper.asmx/GetString", 578 contentType: "application/json; charset=utf-8", 579 dataType: "json", 580 data: '{"key":"' + key + '"}', 581 async: false, 582 timeout: 5000, 583 success: function (data) { 584 stringResource = data.d.toString(); 585 } 586 }); 587 588 return stringResource; 589} 590 591function toggleCollapsibleSection(currentLink) { 592 var $currentLink = $(currentLink); 593 var $entitySummary = $currentLink.parent(); 594 595 if ($entitySummary.length <= 0) { 596 return; 597 } 598 599 var $collapsibleSection = $entitySummary.find($(".collapsibleSection")); 600 var $expandLink = $entitySummary.find($(".expandLink")); 601 var $collapseLink = $entitySummary.find($(".collapseLink")); 602 603 if ($collapsibleSection.length <= 0 || $expandLink.length <= 0 || $collapseLink.length <= 0) { 604 return; 605 } 606 607 if ($entitySummary.hasClass("expanded")) { 608 $collapsibleSection.removeClass("open"); 609 $expandLink.removeClass("open"); 610 $collapseLink.removeClass("open"); 611 612 $entitySummary.removeClass("expanded"); 613 } 614 else { 615 $collapsibleSection.addClass("open"); 616 $expandLink.addClass("open"); 617 $collapseLink.addClass("open"); 618 619 $entitySummary.addClass("expanded"); 620 } 621} 622 623function productTermsAgreement(productTerms, confirmButton, callbackFunction) { 624 if (productTerms) { 625 var options = { 626 prompt: productTerms, 627 okButtonText: GetStringResource('SO.CustomPrompt.ProductTerms.OkText'), 628 okCallback: callbackFunction, 629 cancelButtonText: GetStringResource('SO.CustomPrompt.ProductTerms.CancelText') 630 }; 631 632 return customPrompt(confirmButton, options); 633 } 634 635 return true; 636} 637 638function GetAccountTypeSelectorValue() { 639 $('[data-required]').each(function () { 640 $(this).qtip('destroy'); 641 }); 642 643 var accountType = $("[id$='accountTypeRadioList'] input:checked").val(); 644 645 if (accountType === 'Personal') { 646 $("[id$='txtOrganizationName']").removeAttr('data-required'); 647 $("[id$='ddlOrganizationType']").removeAttr('data-required'); 648 $("[id$='OrgName']").hide(); 649 $("[id$='OrgType']").hide(); 650 } 651 else if (accountType === 'Organization') { 652 $("[id$='txtOrganizationName']").attr('data-required', 'true'); 653 $("[id$='ddlOrganizationType']").attr('data-required', 'true'); 654 $("[id$='OrgName']").show(); 655 $("[id$='OrgType']").show(); 656 } 657} 658 659function customPrompt(element, options) { 660 options = options || {}; 661 662 var prompt = options.prompt; 663 var okButtonText = options.okButtonText; 664 var cancelButtonText = options.cancelButtonText; 665 666 var okCallback = options.okCallback; 667 var okCallbackParameters = options.okCallbackParameters; 668 669 var cancelCallback = options.cancelCallback; 670 var cancelCallbackParameters = options.cancelCallbackParameters; 671 672 //If we've previously prompted, then reset and return true. 673 var $element = $(element); 674 if ($element.data('skip-prompt') === true) { 675 $element.removeData('skip-prompt'); 676 return true; 677 } 678 679 var $promptDiv = $('.promptDialog #promptContainer'); 680 if ($promptDiv.length) { 681 $promptDiv.dialog("close"); 682 } 683 684 var promptDiv = '<div id="promptContainer">' + prompt + '</div>'; 685 $promptDiv = $(promptDiv); 686 $promptDiv.appendTo(document.body); 687 688 var buttons = {}; 689 690 if (okButtonText) { 691 buttons[okButtonText] = function () { 692 var $element = $($(this).data('element')); 693 694 $(this).dialog("close"); 695 696 //If called from other javascript, use the callback info provided. 697 if (okCallback) { 698 okCallbackParameters = $.extend(okCallbackParameters || {}, { isSuccess: true });
699 okCallback(okCallbackParameters); 700 } 701 //If called from an OnClientClick, then marked as already prompted and reclick the button. 702 else if ($element.length) { 703 $element.data('skip-prompt', true); 704 $element.click(); 705 } 706 }; 707 } 708 709 if (cancelButtonText) { 710 buttons[cancelButtonText] = function () { 711 $(this).dialog("close"); 712 713 //If called from other javascript, use the callback info provided. 714 if (cancelCallback) { 715 cancelCallbackParameters = $.extend(cancelCallbackParameters || {}, { isSuccess: false }); 716 cancelCallback(cancelCallbackParameters); 717 } 718 }; 719 } 720 721 if (!Object.keys(buttons).length) { 722 return true; 723 } 724 725 $promptDiv 726 .data('element', $element) 727 .dialog({ 728 resizable: false, 729 modal: true, 730 position: { 731 my: "center", 732 at: "center", 733 of: window, 734 collision: "fit", 735 using: function (pos) { 736 var topOffset = $(this).css(pos).offset().top; 737 if (topOffset < 0) { 738 $(this).css("top", pos.top - topOffset); 739 } 740 } 741 }, 742 dialogClass: "promptDialog", 743 open: function (event, ui) { 744 $(".promptDialog .ui-dialog-titlebar-close").css('display', 'none'); 745 }, 746 close: function () { 747 $(this).dialog("destroy"); 748 $(this).empty(); 749 $(this).remove(); 750 }, 751 buttons: buttons 752 }); 753 754 return false; 755} 756 757function stripInvalidNameOnCardCharacters(element) { 758 $element = $(element); 759 760 var value = $element.val() || ''; 761 value = value.replace(/[\d]+/g, ''); 762 if (value && !value.match(/[^\s-]+/g)) { 763 // After removing all digits, if only whitespace or dash (-) 764 // characters remain, set Name On Card value to empty string 765 value = ''; 766 } 767 768 $element.val(value); 769}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.