// *** Client side DbJsBasket prototype functions // *** Copyright Roy Henderson(henderson.roy@gmail.com) 2012, All Rights Reserved. // *** v20140515-0003 DbJsBasket = function (strInitBasketObjectName) { this.Init(strInitBasketObjectName); } $.extend(DbJsBasket.prototype, { // object variables strBasketName: '', // Passed object variables strObjFunctionName: '', bitObjDestroySession: false, bitObjCheckState: false, dblObjNewTaxRateToApply: 0, intObjBasketUniqueLineNumber: 0, intObjItemsUniqueCodeNumber: 0, dblObjQuantity: 0, intObjRecentlyViewedUniqueLine: 0, strObjCountryCodeEcVatCode: '', strObjCountryCodeISO3166: '', strObjCurrencyCodeName: '', strObjCustomer_AddressLine1: '', strObjCustomer_AddressLine2: '', strObjCustomer_AddressLine3: '', strObjCustomer_AddressLine4: '', strObjCustomer_AddressLine5: '', strObjCustomer_ConditionIllness: '', strObjCustomer_EmailAddress: '', strObjCustomer_Name: '', strObjCustomerCreditAccountCode: '', strObjEcVatNumber: '', strObjUrlForwardingPageAddress: '', bitObjDisplaySummaryOnceUpdated: false, bitObjDisplaySummaryIncludeOuterDiv: false, strObjPromotionalCode: '', arrObjBulk_ItemDelete: new Array(), // regular array Storage for the bulk delete function arrObjBulk_ItemRemove: new Array(), // regular array Storage for the bulk remove function arrObjBulk_ItemQuantity_LineNumber: new Array(), // regular array Storage for the Quantity update arrObjBulk_ItemQuantity_Units: new Array(), // regular array Storage for the Quantity update // Presentation_SortList - Used by the Products Pages for sorting lists of products into Popularity, Price, Description strPresentation_SortList_ListId: '', arrPresentation_SortList_strItemId: new Array(), arrPresentation_SortList_intIndex: new Array(), arrPresentation_SortList_dblPrice: new Array(), arrPresentation_SortList_strPartDesc: new Array(), arrPresentation_SortList_strInnerHTML: new Array(), // List of object element within a Checkout form - Used for postback to server. BasketStore_strPersonalFullName: '', BasketStore_strPersonalBusinessName: '', BasketStore_strPersonalAdd1: '', BasketStore_strPersonalAdd2: '', BasketStore_strPersonalTown: '', BasketStore_strPersonalPostcode: '', BasketStore_strPersonalCountry: '', // BasketStore_strDeliveryFullName: '', BasketStore_strDeliveryBusinessName: '', BasketStore_strDeliveryAdd1: '', BasketStore_strDeliveryAdd2: '', BasketStore_strDeliveryTown: '', BasketStore_strDeliveryPostcode: '', BasketStore_strDeliveryCountry: '', // BasketStore_strContactEmail: '', BasketStore_strContactPhoneNumber: '', // BasketStore_strPaymentNumber: '', BasketStore_strPaymentNumber_Secure: '', // BasketStore_strPaymentStartMonth: '', BasketStore_strPaymentStartYear: '', BasketStore_strPaymentExpiryMonth: '', BasketStore_strPaymentExpiryYear: '', // BasketStore_strPaymentVerifyNumber: '', BasketStore_strPaymentIssueNumber: '', BasketStore_strPaymentFullName: '', BasketStore_strPaymentBusinessName: '', BasketStore_strPaymentAdd1: '', BasketStore_strPaymentAdd2: '', BasketStore_strPaymentTown: '', BasketStore_strPaymentPostcode: '', BasketStore_strPaymentCountry: '', // BasketStore_strPaymentAccountRegistrationCode: '', BasketStore_strPaymentOrderReference: '', BasketStore_strPaymentAccountCode: '', BasketStore_strPaymentAccountName: '', BasketStore_strPaymentMake: '', // BasketStore_strCheckboxRecieveInfo: '', BasketStore_strNoteFromCustomer: '', // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. objSuccessFunction: function (data) { // Redirect browser once the item has been added to the basket. // Server side procedure reply objects: objJSON.strObjFunctionName objJSON.strObjFunctionNameResponse objJSON.bitObjRunClientSideProcedure objJSON.ErrBitIn objJSON.ErrStrMessage objJSON.strObjDisplayMessage try { var objJSON = eval('(' + data + ')'); // JSON only needs to be evaluated if (objJSON.ErrBitIn == true) { // Display server side error message if ('[' + objJSON.ErrStrMessage + ']' != '[]') { alert(objJSON.ErrStrMessage) } } else { // Display Response message alert if ('[' + objJSON.strObjDisplayMessage + ']' != '[]') { alert(objJSON.strObjDisplayMessage) } if (objJSON.bitObjRunClientSideProcedure == true) { // Run procedures returned from the server side procedure // Initial calling function name held in var strObjFunctionName response function name held in strObjFunctionNameResponse switch (objJSON.strObjFunctionNameResponse) { case 'Implement_DbJsBasketAPI_DestroySession': alert('Session Destroyed'); // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_AddItem': alert(objJSON.intLineNumberAdded); // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_AddItem_WithPopupReply': // Update the RightBar-DIV section // Receives - strObjRightBarDivHtml - strObjBreadcrumbDivHtml var strRegExp = /\+/g; $("body #rightcolumn").html(unescape(String(objJSON.strObjRightBarDivHtml).replace(strRegExp, " "))); $("body #Breadcrumbbasketsummary").html(unescape(String(objJSON.strObjBreadcrumbDivHtml).replace(strRegExp, " "))); objMainSiteBasket.PopupSummary_openbuttom(3000); break; case 'Implement_DbJsBasketAPI_RequestBasketSummaryPopup': // Receives the response from the server side procedure to update the right bar product summary var strRegExp = /\+/g; $("body #rightcolumn").html(unescape(String(objJSON.strObjRightBarDivHtml).replace(strRegExp, " "))); if (objJSON.bitObjDisplaySummaryOnceUpdated == true) { objMainSiteBasket.PopupSummary_openbuttom(3000); } break; case 'Implement_DbJsBasketAPI_RequestBeadcrumbText': // Receives the response from the procedure to update the Basket Summary text within the breadcrumb. // Updates Div Breadcrumbbasketsummary in body - receives var strRegExp = /\+/g; $("body #Breadcrumbbasketsummary").html(unescape(String(objJSON.strObjBreadcrumbDivHtml).replace(strRegExp, " "))); break; case 'Implement_DbJsBasketAPI_RemoveItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_UnRemoveItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_TaxExportExempt': try { // Enable buttons document.getElementById('idFormProceed').style.background = '#666666'; document.getElementById('idFormProceed2').style.background = '#666666'; } catch (e) { } try { // Returning customer declarations - Did the procedure complete and find the code if (objJSON.bitObjCustomer_DeclarationReference_FalseCode == true) { // Code failed alert('The Declaration Reference could not be found in our records. This could be due to it not being a EU or International Declaration form. If you have a Disability or Serious Illness tax-relief declaration, please follow the link above to the correct page.'); // Fail Exit return false; } // Continue to browser page forwarding... } catch (e) { } // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_ChangeBasketCurrency': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_DeleteItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_TaxDisabledExempt': try { // Enable buttons document.getElementById('idFormProceed').style.background = '#666666'; document.getElementById('idFormProceed2').style.background = '#666666'; } catch (e) { } try { // Returning customer declarations - Did the procedure complete and find the code if (objJSON.bitObjCustomer_DeclarationReference_FalseCode == true) { // Code failed alert('The Declaration Reference could not be found in our records. This could be due to it not being a Disability or Serious Illness tax-relief form. If you have an EU or International Declaration, please follow the link above to the correct page.'); // Fail Exit return false; } // Continue to browser page forwarding... } catch (e) { } // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_EmailOutbox_Process': // This procedure does not forward any operations and does not require any further processing break; case 'Implement_DbJsBasketAPI_JSBasketNewOrderReceived_Prompt': // This procedure does not forward any operations and does not require any further processing break; case 'Implement_DbJsBasketAPI_AddPromotionalCode': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_SelectOptionlItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_CustomerCeditAccountCode': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_SelectOptionlItem_FindAndChangeDelivery': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_RecommendedItem_Approved': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_RecommendedItem_Disapproved': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_CombinationPackageItem_Approved': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_CombinationPackageItem_Disapproved': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_AddRecentlyViewedItem': // Receives an updated recently viewed list HTML - strBasketStoreRecentlyViewed_strSummaryHTML(URI Encoded) try { var strRegExp = /\+/g; $("body #recentlyvieweditems").html(unescape(String(objJSON.strBasketStoreRecentlyViewed_strSummaryHTML).replace(strRegExp, " "))); } catch (e) { } // Forward browser. Only forward if there is an address to forward to if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_RemoveRecentlyViewedItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_EmptyRecentlyViewedItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_DeleteItem_SendBulk': //alert('TotalNumberOfItemsDeleted:' + objJSON.intObjItemsCount); // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_RemoveItem_SendBulk': //alert('TotalNumberOfItemsRemoved:' + objJSON.intObjItemsCount); // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_UpdateQuantityItem_SendBulk': //alert('TotalNumberOfItemsQuantityUpdated:' + objJSON.intObjItemsCount); // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_UpdateAll_Bulk': alert('UpdateAll completed'); // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_UpdateQuantityItem': // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_Checkout_PostbackForm': // Returns the Document Number in var strObjDocumentNumberLastOrderPlaced. // Forward browser if ('[' + objJSON.strObjUrlForwardingPageAddress + ']' != '[]') { window.location = objJSON.strObjUrlForwardingPageAddress } break; case 'Implement_DbJsBasketAPI_Checkout_RequestAccountDetails': this.BasketStore_strPaymentAccountCode = unescape(objJSON.BasketStore_strPaymentAccountCode); this.BasketStore_strPaymentAccountName = unescape(objJSON.BasketStore_strPaymentAccountName); switch (this.BasketStore_strPaymentAccountCode) { case 'AcCodeInError_DisplayMessage': // Remove all Error Indicators from Text Boxes document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorWait(?!\S)/, '') document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorOk(?!\S)/, '') document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorInError(?!\S)/, '') document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorNone(?!\S)/, '') // Set error on form document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className += " CheckoutBoxInError"; document.getElementById('BasketStore_strPaymentAccountRegistrationCode').disabled = false; document.getElementById('BasketStore_strPaymentAccountRegistrationCode' + '_Message').innerHTML = '
' + this.BasketStore_strPaymentAccountName; // document.getElementById('BasketStore_strPaymentAccountCode').innerHTML = ''; document.getElementById('BasketStore_strPaymentAccountName').innerHTML = ''; // Clear values this.BasketStore_strPaymentAccountCode = ''; this.BasketStore_strPaymentAccountName = ''; break; default: // Remove all Error Indicators from Text Boxes document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorWait(?!\S)/, '') document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorOk(?!\S)/, '') document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorInError(?!\S)/, '') document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className = document.getElementById('BasketStore_strPaymentAccountRegistrationCode').className.replace(/(?:^|\s)CheckoutIndicatorNone(?!\S)/, '') // Set Values document.getElementById('BasketStore_strPaymentAccountCode').innerHTML = this.BasketStore_strPaymentAccountCode; document.getElementById('BasketStore_strPaymentAccountName').innerHTML = this.BasketStore_strPaymentAccountName; document.getElementById('BasketStore_strPaymentAccountRegistrationCode_Hidden').value = 'Completed'; } //alert('Received - Implement_DbJsBasketAPI_Checkout_RequestAccountDetails'); break; default: alert('DbJsBasketAPI: An unexpected error has occurred client side while processing the response from the server. This procedure will quit. - [' + objJSON.strObjFunctionNameResponse + '] Name not found.'); break; } // End of Switch } // End of if (objJSON.strObjRunCl } } catch (e) { alert('DbJsBasketAPI: An unexpected error has occurred client side while converting (evaluating) the JSON objects forwarded from the server. This procedure will quit. - [' + e.Message + ']'); alert(data); } }, objSuccessSubFunction_Checkout_RequestAccountDetails: function () { alert('[' + this.BasketStore_strPaymentAccountCode + '] [' + this.BasketStore_strPaymentAccountName + ']'); }, // Timers bitTimersStarted: false, bitTimersPaused: false, intAutoInterval_PopupClose: 0, Timers_Start: function (strTimerName, intInterval) { // Update interval timers - Intervals will need to be converted from 1000th seconds to 0.5 seconds switch (strTimerName) { case 'AutoInterval_PopupClose': this.intAutoInterval_PopupClose = intInterval / 500; break; case 2: //execute code block 2 break; default: alert('Client side procedure produced an error Timers_Start: [' + strTimerName + '] Timer unknown'); } // Start timer for the first time if (this.bitTimersStarted == false) { this.bitTimersStarted = true; var t = setTimeout("objMainSiteBasket.Timers_Handler();", 500); }; }, Timers_StopAll: function () { // Insert all timer names here and set them all to zero when called this.intAutoInterval_PopupClose = 0; }, Timers_Stop: function (strTimerName) { // Update interval timers switch (strTimerName) { case 'AutoInterval_PopupClose': this.intAutoInterval_PopupClose = 0; break; case 2: //execute code block 2 break; default: alert('Client side procedure produced an error Timers_Stop: [' + strTimerName + '] Timer unknown'); } }, Timers_PauseAll: function (strChange) { // Change the Pause state of the Timers start/stop/switchonoff switch (strChange) { case 'start': this.bitTimersPaused = false; break; case 'stop': this.bitTimersPaused = true; break; case 'switchonoff': if (this.bitTimersPaused == false) { this.bitTimersPaused = true } else { this.bitTimersPaused = false } break; default: } }, Timers_Running: function (strTimerName) { // Function returns a true if the procedure is currently running. Interval greater that 0. switch (strTimerName) { case 'AutoInterval_PopupClose': if (this.intAutoInterval_PopupClose == 0) { return false } else { return true } break; case 2: //execute code block 2 break; default: alert('Client side procedure produced an error Timers_Running: [' + strTimerName + '] Timer unknown'); } }, Timers_Handler: function () { // Run down timers - Are they Paused if (this.bitTimersPaused == false) { // Timer for Popup auto close if (this.intAutoInterval_PopupClose < 0) { this.intAutoInterval_PopupClose = 0 } if (this.intAutoInterval_PopupClose > 0) { this.intAutoInterval_PopupClose--; if (this.intAutoInterval_PopupClose == 0) { // Run completed procedure for AutoInterval_PopupClose $('body #rightcolumn').slideUp('slow'); } } // Add new timer procedures here } // End of if (this.bitTimersPaused == fa // Are all of the timers at zero; Add all the time intervals together. var intTotalTimer = this.intAutoInterval_PopupClose; if (intTotalTimer == 0) { this.bitTimersStarted = false; } else { // Timeout for 0.5seconds var t = setTimeout("objMainSiteBasket.Timers_Handler();", 500); } }, // Basket Functions Init: function (strBasketName) { // do initialization here this.strBasketName = strBasketName; }, // End of Init MyObjectNameIs: function () { // an example object method alert('my name is ' + this.strBasketName); }, // End of MyObjectNameIs PopupSummary_closebuttom: function () { // Close the Right Bar summary Div by sliding it up if (!$("body #rightcolumn").is(":hidden")) { $("body #rightcolumn").slideUp('slow'); } }, // End of PopupSummary_closebuttom PopupSummary_rollover: function () { // If its on a timer then stop the timer if (this.Timers_Running('AutoInterval_PopupClose') == true) { this.Timers_Stop('AutoInterval_PopupClose'); } }, // End of PopupSummary_rollover PopupSummary_rollout: function () { // Start the timer to hide the DIV section this.Timers_Start('AutoInterval_PopupClose', 1000); }, // End of PopupSummary_rollout PopupSummary_openbuttom: function (intAutoClose_Interval) { // Open the Right Bar summary Div by sliding it up // Move down the window $("body #rightcolumn").css("top", $(window).scrollTop() + 180); $("body #rightcolumn").css("visibility", "visible"); $("body #rightcolumn").slideDown('slow'); if (intAutoClose_Interval > 0) { // Auto close the item after a period //var t = setTimeout("$('body #rightcolumn').slideUp('slow');", intAutoClose_Interval); this.Timers_Start('AutoInterval_PopupClose', intAutoClose_Interval) } }, // End of PopupSummary_openbuttom PopupSummary_switchbuttom: function (intAutoClose_Interval) { // Open/Close the Right Bar summary Div by sliding it up if ($("body #rightcolumn").is(":hidden")) { // Move down the window $("body #rightcolumn").css("top", $(window).scrollTop() + 180); $("body #rightcolumn").slideDown('slow'); if (intAutoClose_Interval > 0) { // Auto close the item after a period //var t = setTimeout("$('body #rightcolumn').slideUp('slow');", intAutoClose_Interval); this.Timers_Start('AutoInterval_PopupClose', intAutoClose_Interval) } } else { $("body #rightcolumn").slideUp('slow'); } }, // End of PopupSummary_switchbuttom // --- Manage items in basket Add, Remove, Update quantity,... DestroySession: function (strUrlForwardingPageAddress) { // This function is used to fully destroy the users Session Objects. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_DestroySession'); this.bitObjDestroySession = true; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, AddItem: function (intItemsUniqueCodeNumber, intQuantity, strUrlForwardingPageAddress) { // Function to add an item to the basket then forward onto another page or reload existing page. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_AddItem'); this.intObjItemsUniqueCodeNumber = intItemsUniqueCodeNumber; this.dblObjQuantity = intQuantity; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of AddItem AddItem_WithPopupReply: function (intItemsUniqueCodeNumber, intQuantity) { // Function to add an item to the basket then forward onto another page or reload existing page. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_AddItem_WithPopupReply'); this.intObjItemsUniqueCodeNumber = intItemsUniqueCodeNumber; this.dblObjQuantity = intQuantity; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of AddItem_WithPopupReply RemoveItem: function (intBasketUniqueLineNumber, strUrlForwardingPageAddress) { // Function temporally removes the item from the basket showing it as a struck through item and displaying delete option. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RemoveItem'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of RemoveItem UnRemoveItem: function (intBasketUniqueLineNumber, strUrlForwardingPageAddress) { // Function places a removed item back into the basket. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_UnRemoveItem'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of UnRemoveItem RemoveItem_SendBulk: function (strUrlForwardingPageAddress) { // Function temporally removes the item from the basket showing it as a struck through item and displaying delete option. // It acts on a comma separated list of intBasketUniqueLineNumber’s to remove in one bulk block. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RemoveItem_SendBulk'); // Are there any items in the array - Nothing just go to the forwarding page. if (this.arrObjBulk_ItemRemove.length == 0) { window.location = strUrlForwardingPageAddress; return } this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // The array has already been prepared for transmission. String + UrlEncode by send function. // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of RemoveItem_Bulk RemoveItem_Empty_SendBulk: function () { this.arrObjBulk_ItemRemove = []; }, // End of RemoveItem_Empty_SendBulk RemoveItem_AddToRemoveFrom_Bulk: function (intBasketUniqueLineNumber, bitCheckState) { // Function to accumulate a list of items from web page check boxes or buttons. See RemoveItem_Bulk for transmission of a bulk list. // Creates a public variable of strBasketUniqueLineNumberListCSV for later transmission via RemoveItem_Bulk. // Is the item already set to delete - Locate its index var intInArray = $.inArray(intBasketUniqueLineNumber, this.arrObjBulk_ItemRemove); if (intInArray == -1) { if (bitCheckState == true) { this.arrObjBulk_ItemRemove.push(intBasketUniqueLineNumber) } // Add it to the array return true } else { if (bitCheckState == false) { this.arrObjBulk_ItemRemove.splice(intInArray, 1) } // Remove from the array return false } // End of if (intInArray == -1 }, // End of RemoveItem_AddToRemoveFrom_Bulk RemoveItem_Switch_Bulk: function (intBasketUniqueLineNumber, bitCheckState) { // Function to accumulate a list of items from web page check boxes or buttons. See RemoveItem_Bulk for transmission of a bulk list. // Is the item already set to delete - Locate its index var intInArray = $.inArray(intBasketUniqueLineNumber, this.arrObjBulk_ItemRemove); if (intInArray == -1) { return this.RemoveItem_AddToRemoveFrom_Bulk(intBasketUniqueLineNumber, true) // Add it to the array } else { return this.RemoveItem_AddToRemoveFrom_Bulk(intBasketUniqueLineNumber, false) // Remove from the array } // End of if (intInArray == -1 }, // End of RemoveItem_Switch_Bulk RemoveItem_Count_Bulk: function (intBasketUniqueLineNumber, bitCheckState) { // Function to accumulate a list of items from web page check boxes or buttons. See RemoveItem_Bulk for transmission of a bulk list. return this.arrObjBulk_ItemRemove.length }, // End of RemoveItem_Switch_Bulk DeleteItem: function (intBasketUniqueLineNumber, strUrlForwardingPageAddress) { // Function fully removes an item from the basket so that it cannot be see again. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_DeleteItem'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of DeleteItem DeleteItem_SendBulk: function (strUrlForwardingPageAddress) { // Function fully removes an item from the basket so that it cannot be see again. // It acts on a comma separated list of ---’s to delete in one bulk block. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_DeleteItem_SendBulk'); // Are there any items in the array - Nothing just go to the forwarding page. if (this.arrObjBulk_ItemDelete.length == 0) { window.location = strUrlForwardingPageAddress; return } this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // The array has already been prepared for transmission. String + UrlEncode by send function. // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of DeleteItem_SendBulk DeleteItem_Empty_SendBulk: function () { this.arrObjBulk_ItemDelete = []; }, // End of DeleteItem_Empty_SendBulk DeleteItem_AddToRemoveFrom_Bulk: function (intBasketUniqueLineNumber, bitCheckState) { // Function to accumulate a list of items from web page check boxes or buttons. See DeleteItem_SendBulk for transmission of a bulk list. // Creates a public variable of --- for later transmission via DeleteItem_SendBulk. // Is the item already set to delete - Locate its index var intInArray = $.inArray(intBasketUniqueLineNumber, this.arrObjBulk_ItemDelete); if (intInArray == -1) { if (bitCheckState == true) { this.arrObjBulk_ItemDelete.push(intBasketUniqueLineNumber) } // Add it to the array return true } else { if (bitCheckState == false) { this.arrObjBulk_ItemDelete.splice(intInArray, 1) } // Remove from the array return false } // End of if (intInArray == -1 }, // End of DeleteItem_AddToRemoveFrom_Bulk DeleteItem_Switch_Bulk: function (intBasketUniqueLineNumber) { // Function to accumulate a list of items from web page check boxes or buttons. See DeleteItem_SendBulk for transmission of a bulk list. // Is the item already set to delete - Locate its index var intInArray = $.inArray(intBasketUniqueLineNumber, this.arrObjBulk_ItemDelete); if (intInArray == -1) { return this.DeleteItem_AddToRemoveFrom_Bulk(intBasketUniqueLineNumber, true) // Add it to the array } else { return this.DeleteItem_AddToRemoveFrom_Bulk(intBasketUniqueLineNumber, false) // Remove from the array } // End of if (intInArray == -1 }, // End of DeleteItem_Switch_Bulk DeleteItem_Count_SendBulk: function () { // Function fully removes an item from the basket so that it cannot be see again. return this.arrObjBulk_ItemDelete.length }, // End of DeleteItem_Count_SendBulk UpdateQuantityItem: function (intBasketUniqueLineNumber, intQuantity, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_UpdateQuantityItem'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.dblObjQuantity = intQuantity; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of UpdateQuantityItem UpdateQuantityItem_SendBulk: function (strUrlForwardingPageAddress) { // It acts on a comma separated list of ---’s to update quantities in one bulk block. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_UpdateQuantityItem_SendBulk'); // Are there any items in the array - Nothing just go to the forwarding page. if (this.arrObjBulk_ItemQuantity_LineNumber.length == 0) { window.location = strUrlForwardingPageAddress; return } this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // The array has already been prepared for transmission. String + UrlEncode by send function. // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of UpdateQuantityItem_SendBulk UpdateQuantityItem_Empty_SendBulk: function () { // It acts on a comma separated list of ---’s to update quantities in one bulk block. this.arrObjBulk_ItemQuantity_LineNumber = []; this.arrObjBulk_ItemQuantity_Units = [] }, // End of UpdateQuantityItem_Empty_SendBulk UpdateQuantityItem_AddToRemoveFrom_Bulk: function (intBasketUniqueLineNumber, intQuantity, bitCheckState) { // Function to accumulate a list of items from web page check boxes or buttons. See DeleteItem_SendBulk for transmission of a bulk list. // Creates a public variable of --- for later transmission via DeleteItem_SendBulk. // Is the item already set to delete - Locate its index var intInArray = $.inArray(intBasketUniqueLineNumber, this.arrObjBulk_ItemQuantity_LineNumber); if (intInArray == -1) { if (bitCheckState == true) { this.arrObjBulk_ItemQuantity_LineNumber.push(intBasketUniqueLineNumber); this.arrObjBulk_ItemQuantity_Units.push(intQuantity) } // Add it to the array return true } else { if (bitCheckState == true) { // Amend item quantity this.arrObjBulk_ItemQuantity_Units[intInArray] = intQuantity; return true } else { // Remove from array this.arrObjBulk_ItemDelete.splice(intInArray, 1); this.arrObjBulk_ItemQuantity_Units.splice(intInArray, 1) } // Remove from the array return false } // End of if (intInArray == -1 }, // End of UpdateQuantityItem_AddToRemoveFrom_Bulk UpdateQuantityItem_Count_Bulk: function () { // Function to accumulate a list of items from web page check boxes or buttons. See DeleteItem_SendBulk for transmission of a bulk list. return this.arrObjBulk_ItemQuantity_LineNumber.length }, // End of UpdateQuantityItem_Count_Bulk UpdateAll_Bulk: function (strUrlForwardingPageAddress) { // Update all bulk procedures for the basket summary procedure. Delete_Bulk / Remove_Bulk / Quantity_bulk update procedures. // RemoveItem_SendBulk // DeleteItem_SendBulk // UpdateQuantityItem_SendBulk this.ReceiverServerSideAPI_Init('DbJsBasketAPI_UpdateAll_Bulk'); // Are there any items in the array - Nothing just go to the forwarding page. var intSumUpdates = 0; if (this.arrObjBulk_ItemDelete.length != 0) { intSumUpdates++ } if (this.arrObjBulk_ItemRemove.length != 0) { intSumUpdates++ } if (this.arrObjBulk_ItemQuantity_LineNumber.length != 0) { intSumUpdates++ } if (intSumUpdates == 0) { window.location = strUrlForwardingPageAddress; return } this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // The array has already been prepared for transmission. String + UrlEncode by send function. // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, RequestBeadcrumbText: function () { // Function to force an update to the breadcrumb basket summary line displayed below the title bar. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RequestBeadcrumbText'); // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE - Implement_DbJsBasketAPI_RequestBeadcrumbText }, // End of RequestBeadcrumbText RequestBasketSummaryPopup: function (bitDisplaySummaryOnceUpdated, bitDisplaySummaryIncludeOuterDiv) { // Function to refresh the popup summary in the right bar. // Variabe bitDisplaySummaryOnceUpdated is used to tell the client to display the popup once the server has responded. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RequestBasketSummaryPopup'); this.bitObjDisplaySummaryOnceUpdated = bitDisplaySummaryOnceUpdated; this.bitObjDisplaySummaryIncludeOuterDiv = bitDisplaySummaryIncludeOuterDiv; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE - Implement_DbJsBasketAPI_RequestBasketSummaryPopup }, // End of RequestBasketSummaryPopup ChangeBasketCurrency: function (strCurrencyCodeName, strUrlForwardingPageAddress) { // Function to change the basket and display currency, options GB(Great British pounds), EU(European Union Euros), and USD(United States Dollars). this.ReceiverServerSideAPI_Init('DbJsBasketAPI_ChangeBasketCurrency'); this.strObjCurrencyCodeName = strCurrencyCodeName; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of ChangeBasketCurrency TaxExportExempt: function (strCountryCodeISO3166, strCountryCodeEcVatCode, strEcVatNumber, dblNewTaxRateToApply, strCustomer_Name, strCustomer_AddressLine1, strCustomer_AddressLine2, strCustomer_AddressLine3, strCustomer_AddressLine4, strCustomer_AddressLine5, strCustomer_EmailAddress, strUrlForwardingPageAddress) { // Function to apply an export tax exempt code. // Not all countries may be exempt e.g. the business might be over the threshold for tax within a country // and will need to charge tax to forward it onto that countries excise collector. // However the business might still need an EC Vat number for the customer. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_TaxExportExempt'); this.strObjCountryCodeISO3166 = strCountryCodeISO3166; this.strObjCountryCodeEcVatCode = strCountryCodeEcVatCode; this.strObjEcVatNumber = strEcVatNumber; this.dblObjNewTaxRateToApply = dblNewTaxRateToApply; this.strObjCustomer_Name = strCustomer_Name; this.strObjCustomer_AddressLine1 = strCustomer_AddressLine1; this.strObjCustomer_AddressLine2 = strCustomer_AddressLine2; this.strObjCustomer_AddressLine3 = strCustomer_AddressLine3; this.strObjCustomer_AddressLine4 = strCustomer_AddressLine4; this.strObjCustomer_AddressLine5 = strCustomer_AddressLine5; this.strObjCustomer_EmailAddress = strCustomer_EmailAddress; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of TaxExportExempt TaxDisabledExempt: function (strCustomer_Name, strCustomer_AddressLine1, strCustomer_AddressLine2, strCustomer_AddressLine3, strCustomer_AddressLine4, strCustomer_AddressLine5, strCustomer_ConditionIllness, strCustomer_EmailAddress, strUrlForwardingPageAddress) { // Function to set a zero rate for select Disabled tax free items within the basket. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_TaxDisabledExempt'); this.strObjCustomer_Name = strCustomer_Name; this.strObjCustomer_AddressLine1 = strCustomer_AddressLine1; this.strObjCustomer_AddressLine2 = strCustomer_AddressLine2; this.strObjCustomer_AddressLine3 = strCustomer_AddressLine3; this.strObjCustomer_AddressLine4 = strCustomer_AddressLine4; this.strObjCustomer_AddressLine5 = strCustomer_AddressLine5; this.strObjCustomer_ConditionIllness = strCustomer_ConditionIllness; this.strObjCustomer_EmailAddress = strCustomer_EmailAddress; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of TaxDisabledExempt AddPromotionalCode: function (strPromotionalCode, strUrlForwardingPageAddress) { // Function to add a new Promotional code to the basket. Inserts a promotional code item into the basket, like Add Item. The Code is processed each time the basket is recalculated by the server side code. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_AddPromotionalCode'); this.strObjPromotionalCode = strPromotionalCode; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of AddPromotionalCode EmailOutbox_Process: function () { // Function to force the server to send all pending emails this.ReceiverServerSideAPI_Init('DbJsBasketAPI_EmailOutbox_Process'); this.strObjUrlForwardingPageAddress = ''; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of JSBasketNewOrderReceived_Prompt: function () { // Function to force the server to send all pending emails this.ReceiverServerSideAPI_Init('DbJsBasketAPI_JSBasketNewOrderReceived_Prompt'); this.strObjUrlForwardingPageAddress = ''; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of CustomerCeditAccountCode: function (strCustomerCreditAccountCode, strUrlForwardingPageAddress) { // Function to select a credit account. The accounts are entered in an encoded form published to the customer i.e. 1234-5678 format. They are not the sales ledger account code, which is found server side by the database. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_CustomerCeditAccountCode'); this.strObjCustomerCreditAccountCode = strCustomerCreditAccountCode; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of CustomerCeditAccountCode // --- End of Manage items in basket Add, Remove, Update quantity,... // --- Basket CHECKOUT page functions + Verify + Post Back Checkout_PostbackCompleteForm: function (strFormId, bitPayPal) { var bitStop = false; this.ReceiverServerSideAPI_Init('DbJsBasketAPI_Checkout_PostbackForm'); objFrm = document.getElementById(strFormId); // Load object from form this.BasketStore_bitPayPal = bitPayPal; try { this.BasketStore_strPersonalFullName = objFrm.elements["BasketStore_strPersonalFullName"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPersonalFullName'); } try { this.BasketStore_strPersonalBusinessName = objFrm.elements["BasketStore_strPersonalBusinessName"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPersonalBusinessName'); } try { this.BasketStore_strPersonalAdd1 = objFrm.elements["BasketStore_strPersonalAdd1"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPersonalAdd1'); } try { this.BasketStore_strPersonalAdd2 = objFrm.elements["BasketStore_strPersonalAdd2"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPersonalAdd2'); } try { this.BasketStore_strPersonalTown = objFrm.elements["BasketStore_strPersonalTown"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPersonalTown'); } try { this.BasketStore_strPersonalPostcode = objFrm.elements["BasketStore_strPersonalPostcode"].value; } catch (e) { bitStop = true; alert('BasketStore_strPersonalPostcode'); } try { this.BasketStore_strPersonalCountry = objFrm.elements["BasketStore_strPersonalCountry"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPersonalCountry'); } // try { this.BasketStore_strDeliveryFullName = objFrm.elements["BasketStore_strDeliveryFullName"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strDeliveryFullName'); } try { this.BasketStore_strDeliveryBusinessName = objFrm.elements["BasketStore_strDeliveryBusinessName"].value; } catch (e) { alert('Missing BasketStore_strDeliveryBusinessName'); } try { this.BasketStore_strDeliveryAdd1 = objFrm.elements["BasketStore_strDeliveryAdd1"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strDeliveryAdd1'); } try { this.BasketStore_strDeliveryAdd2 = objFrm.elements["BasketStore_strDeliveryAdd2"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strDeliveryAdd2'); } try { this.BasketStore_strDeliveryTown = objFrm.elements["BasketStore_strDeliveryTown"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strDeliveryTown'); } try { this.BasketStore_strDeliveryPostcode = objFrm.elements["BasketStore_strDeliveryPostcode"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strDeliveryPostcode'); } try { this.BasketStore_strDeliveryCountry = objFrm.elements["BasketStore_strDeliveryCountry"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strDeliveryCountry'); } // try { this.BasketStore_strContactEmail = objFrm.elements["BasketStore_strContactEmail"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strContactEmail'); } try { this.BasketStore_strContactPhoneNumber = objFrm.elements["BasketStore_strContactPhoneNumber"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strContactPhoneNumber'); } // try { this.BasketStore_strPaymentNumber = objFrm.elements["BasketStore_strPaymentNumber"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentNumber'); } } try { this.BasketStore_strPaymentNumber_Secure = objFrm.elements["BasketStore_strPaymentNumber_Secure"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentNumber_Secure'); } } // try { this.BasketStore_strPaymentStartMonth = objFrm.elements["BasketStore_strPaymentStartMonth"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentStartMonth'); } } try { this.BasketStore_strPaymentStartYear = objFrm.elements["BasketStore_strPaymentStartYear"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentStartYear'); } } try { this.BasketStore_strPaymentExpiryMonth = objFrm.elements["BasketStore_strPaymentExpiryMonth"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentExpiryMonth'); } } try { this.BasketStore_strPaymentExpiryYear = objFrm.elements["BasketStore_strPaymentExpiryYear"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('BasketStore_strPaymentExpiryYear'); } } // try { this.BasketStore_strPaymentVerifyNumber = objFrm.elements["BasketStore_strPaymentVerifyNumber"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentVerifyNumber'); } } try { this.BasketStore_strPaymentIssueNumber = objFrm.elements["BasketStore_strPaymentIssueNumber"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentIssueNumber'); } } try { this.BasketStore_strPaymentFullName = objFrm.elements["BasketStore_strPaymentFullName"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentFullName'); } } try { this.BasketStore_strPaymentBusinessName = objFrm.elements["BasketStore_strPaymentBusinessName"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentBusinessName'); } } try { this.BasketStore_strPaymentAdd1 = objFrm.elements["BasketStore_strPaymentAdd1"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentAdd1'); } } try { this.BasketStore_strPaymentAdd2 = objFrm.elements["BasketStore_strPaymentAdd2"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentAdd2'); } } try { this.BasketStore_strPaymentTown = objFrm.elements["BasketStore_strPaymentTown"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentTown'); } } try { this.BasketStore_strPaymentPostcode = objFrm.elements["BasketStore_strPaymentPostcode"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentPostcode'); } } try { this.BasketStore_strPaymentCountry = objFrm.elements["BasketStore_strPaymentCountry"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentCountry'); } } // try { this.BasketStore_strPaymentAccountRegistrationCode = objFrm.elements["BasketStore_strPaymentAccountRegistrationCode"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentAccountRegistrationCode'); } } try { this.BasketStore_strPaymentOrderReference = objFrm.elements["BasketStore_strPaymentOrderReference"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strPaymentOrderReference'); } } // Payment Method try { if (bitPayPal == false) { this.BasketStore_strPaymentMake = "ER"; if (objFrm.elements["idRadioPaymentMakeCC"].checked == true) { this.BasketStore_strPaymentMake = "CC"; } if (objFrm.elements["idRadioPaymentMakeAC"].checked == true) { this.BasketStore_strPaymentMake = "AC"; } } else { this.BasketStore_strPaymentMake = "PP"; } } catch (e) { this.BasketStore_strPaymentMake = "ER"; } // Note try { if (objFrm.elements["BasketStore_strCheckboxRecieveInfo"].checked == true) { this.BasketStore_strCheckboxRecieveInfo = "true"; } else { this.BasketStore_strCheckboxRecieveInfo = "false"; } } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strCheckboxRecieveInfo'); } } try { this.BasketStore_strNoteFromCustomer = objFrm.elements["BasketStore_strNoteFromCustomer"].value; } catch (e) { if (bitPayPal == false) { bitStop = true; alert('Missing BasketStore_strNoteFromCustomer'); } } if (bitStop == true) { alert('Unexpected errors have occurred: The form is missing field objects that must be complete for post back to be successful. Post back stopped.'); return false; } // postback to server // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, Checkout_RequestAccountDetails: function (strFormId) { var bitStop = false; this.ReceiverServerSideAPI_Init('DbJsBasketAPI_Checkout_RequestAccountDetails'); objFrm = document.getElementById(strFormId); // Load object from form try { this.BasketStore_strPaymentAccountRegistrationCode = objFrm.elements["BasketStore_strPaymentAccountRegistrationCode"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strPaymentAccountRegistrationCode'); } try { this.BasketStore_strContactEmail = objFrm.elements["BasketStore_strContactEmail"].value; } catch (e) { bitStop = true; alert('Missing BasketStore_strContactEmail'); } // postback to server // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, Checkout_Verify_Precheck: function (strFormName, strFieldName) { }, Checkout_Verify_BeforeCompleteCheck: function (strFormName) { }, Checkout_Verify_Perform_CreditCardNumber: function (strCreditCardNumber) { }, // --- End of Basket CHECKOUT page functions + Verify + Post Back // --- Option items in basket – Commonly used for delivery options. SelectOptionlItem: function (intBasketUniqueLineNumber, strUrlForwardingPageAddress) { // Function to select a radio option within an optional list for a basket item. // Each option is created as a basket item and then linked back to a options list item. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_SelectOptionlItem'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of SelectOptionlItem SelectOptionlItem_FindAndChangeDelivery: function (intItemsUniqueCodeNumber, strUrlForwardingPageAddress) { // Function to select a radio option within an optional list for a basket item. // Function locates item code in the basket and selects it as the active option within an optional items list. If the items is a hidden item i.e. FOC, then it will not be selected. // Note: This function is locked for FOC deliveries. Server side only function. this.ReceiverServerSideAPI_Init('DbJsBasketAPI_SelectOptionlItem_FindAndChangeDelivery'); this.intObjItemsUniqueCodeNumber = intItemsUniqueCodeNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of SelectOptionlItem_FindAndChangeDelivery // --- End of Optional items in basket – Commonly used for delivery optional. // --- Recently Viewed Items in shown in products bar AddRecentlyViewedItem: function (intItemsUniqueCodeNumber, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_AddRecentlyViewedItem'); this.intObjItemsUniqueCodeNumber = intItemsUniqueCodeNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of AddRecentlyViewedItem RemoveRecentlyViewedItem: function (intRecentlyViewedUniqueLineNumber, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RemoveRecentlyViewedItem'); this.intObjRecentlyViewedUniqueLine = intRecentlyViewedUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of RemoveRecentlyViewedItem EmptyRecentlyViewedItem: function (strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_EmptyRecentlyViewedItem'); this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of EmptyRecentlyViewedItem // --- End of Recently Viewed Items in shown in products bar // --- Recommended items added to basket in speculation due to adding another item RecommendedItem_Approved: function (intBasketUniqueLineNumber, intQuantity, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RecommendedItem_Approved'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.dblObjQuantity = intQuantity; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of RecommendedItem_Approved RecommendedItem_Disapproved: function (intBasketUniqueLineNumber, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_RecommendedItem_Disapproved'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of RecommendedItem_Disapproved // --- End of Recommended items added to basket in speculation due to adding another item // --- Combination package items added to basket in speculation due to adding another item CombinationPackageItem_Approved: function (intBasketUniqueLineNumber, intQuantity, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_CombinationPackageItem_Approved'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.dblObjQuantity = intQuantity; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of CombinationPackageItem__Approved CombinationPackageItem_Disapproved: function (intBasketUniqueLineNumber, strUrlForwardingPageAddress) { this.ReceiverServerSideAPI_Init('DbJsBasketAPI_CombinationPackageItem_Disapproved'); this.intObjBasketUniqueLineNumber = intBasketUniqueLineNumber; this.strObjUrlForwardingPageAddress = strUrlForwardingPageAddress; // Call the Basket API receiver to process the function call. Will execute success procedure when it is completed. this.ReceiverServerSideAPI_Send(this.objSuccessFunction) // SEND JSON TO SERVER SIDE PROCEDURE }, // End of CombinationPackageItem__Disapproved // --- End of Combination package items added to basket in speculation due to adding another item // --- Post to function receiver on server side. ReceiverServerSideAPI_Init: function (strFunctionName) { // Function to initiate a transmission to the server side basket API receiver. Sets the function name and initialises all of the variables. this.strObjFunctionName = strFunctionName; this.bitObjDestroySession = false; this.BasketStore_bitPayPal = false; this.bitObjCheckState = ''; this.dblObjNewTaxRateToApply = ''; this.intObjBasketUniqueLineNumber = ''; this.intObjItemsUniqueCodeNumber = ''; this.dblObjQuantity = ''; this.intObjRecentlyViewedUniqueLine = ''; this.strObjCountryCodeEcVatCode = ''; this.strObjCountryCodeISO3166 = ''; this.strObjCurrencyCodeName = ''; this.strObjCustomer_AddressLine1 = ''; this.strObjCustomer_AddressLine2 = ''; this.strObjCustomer_AddressLine3 = ''; this.strObjCustomer_AddressLine4 = ''; this.strObjCustomer_AddressLine5 = ''; this.strObjCustomer_ConditionIllness = ''; this.strObjCustomer_EmailAddress = ''; this.strObjCustomer_Name = ''; this.strObjCustomerCreditAccountCode = ''; this.strObjEcVatNumber = ''; this.strObjUrlForwardingPageAddress = ''; this.bitObjDisplaySummaryOnceUpdated = ''; this.bitObjDisplaySummaryIncludeOuterDiv = ''; this.strObjPromotionalCode = ''; // List of object element within a Checkout form - Used for postback to server. this.BasketStore_strPersonalFullName = ''; this.BasketStore_strPersonalBusinessName = ''; this.BasketStore_strPersonalAdd1 = ''; this.BasketStore_strPersonalAdd2 = ''; this.BasketStore_strPersonalTown = ''; this.BasketStore_strPersonalPostcode = ''; this.BasketStore_strPersonalCountry = ''; // this.BasketStore_strDeliveryFullName = ''; this.BasketStore_strDeliveryBusinessName = ''; this.BasketStore_strDeliveryAdd1 = ''; this.BasketStore_strDeliveryAdd2 = ''; this.BasketStore_strDeliveryTown = ''; this.BasketStore_strDeliveryPostcode = ''; this.BasketStore_strDeliveryCountry = ''; // this.BasketStore_strContactEmail = ''; this.BasketStore_strContactPhoneNumber = ''; // this.BasketStore_strPaymentNumber = ''; this.BasketStore_strPaymentNumber_Secure = ''; // this.BasketStore_strPaymentStartMonth = ''; this.BasketStore_strPaymentStartYear = ''; this.BasketStore_strPaymentExpiryMonth = ''; this.BasketStore_strPaymentExpiryYear = ''; // this.BasketStore_strPaymentVerifyNumber = ''; this.BasketStore_strPaymentIssueNumber = ''; this.BasketStore_strPaymentFullName = ''; this.BasketStore_strPaymentBusinessName = ''; this.BasketStore_strPaymentAdd1 = ''; this.BasketStore_strPaymentAdd2 = ''; this.BasketStore_strPaymentTown = ''; this.BasketStore_strPaymentPostcode = ''; this.BasketStore_strPaymentCountry = ''; // this.BasketStore_strPaymentAccountRegistrationCode = ''; this.BasketStore_strPaymentOrderReference = ''; this.BasketStore_strPaymentAccountCode = ''; this.BasketStore_strPaymentAccountName = ''; this.BasketStore_strPaymentMake = ''; // this.BasketStore_strCheckboxRecieveInfo = ''; this.BasketStore_strNoteFromCustomer = ''; // Arrays for bulk list should not to be cleared. }, // End of ReceiverServerSide_Init ReceiverServerSideAPI_Send: function (objSuccessFunction) { // Function to post all of the Basket API variables to the Basket API receiver on the server side. // Compile objects into JSON format var objSendOut = { strObjFunctionName: this.strObjFunctionName, bitObjDestroySession: this.bitObjDestroySession, BasketStore_bitPayPal: this.BasketStore_bitPayPal, bitObjCheckState: this.bitObjCheckState, dblObjNewTaxRateToApply: this.dblObjNewTaxRateToApply, intObjBasketUniqueLineNumber: this.intObjBasketUniqueLineNumber, intObjItemsUniqueCodeNumber: this.intObjItemsUniqueCodeNumber, dblObjQuantity: this.dblObjQuantity, intObjRecentlyViewedUniqueLine: this.intObjRecentlyViewedUniqueLine, strObjCountryCodeEcVatCode: this.strObjCountryCodeEcVatCode, strObjCountryCodeISO3166: this.strObjCountryCodeISO3166, strObjCurrencyCodeName: this.strObjCurrencyCodeName, strObjCustomer_AddressLine1: this.strObjCustomer_AddressLine1, strObjCustomer_AddressLine2: this.strObjCustomer_AddressLine2, strObjCustomer_AddressLine3: this.strObjCustomer_AddressLine3, strObjCustomer_AddressLine4: this.strObjCustomer_AddressLine4, strObjCustomer_AddressLine5: this.strObjCustomer_AddressLine5, strObjCustomer_ConditionIllness: this.strObjCustomer_ConditionIllness, strObjCustomer_EmailAddress: this.strObjCustomer_EmailAddress, strObjCustomer_Name: this.strObjCustomer_Name, strObjCustomerCreditAccountCode: this.strObjCustomerCreditAccountCode, strObjEcVatNumber: this.strObjEcVatNumber, strObjUrlForwardingPageAddress: this.strObjUrlForwardingPageAddress, bitObjDisplaySummaryOnceUpdated: this.bitObjDisplaySummaryOnceUpdated, bitObjDisplaySummaryIncludeOuterDiv: this.bitObjDisplaySummaryIncludeOuterDiv, strObjPromotionalCode: this.strObjPromotionalCode, arrObjBulk_ItemDelete: escape(this.arrObjBulk_ItemDelete.toString()), arrObjBulk_ItemRemove: escape(this.arrObjBulk_ItemRemove.toString()), arrObjBulk_ItemQuantity_LineNumber: escape(this.arrObjBulk_ItemQuantity_LineNumber.toString()), arrObjBulk_ItemQuantity_Units: escape(this.arrObjBulk_ItemQuantity_Units.toString()), // List of object element within a Checkout form - Used for postback to server. BasketStore_strPersonalFullName: escape(this.BasketStore_strPersonalFullName), BasketStore_strPersonalBusinessName: escape(this.BasketStore_strPersonalBusinessName), BasketStore_strPersonalAdd1: escape(this.BasketStore_strPersonalAdd1), BasketStore_strPersonalAdd2: escape(this.BasketStore_strPersonalAdd2), BasketStore_strPersonalTown: escape(this.BasketStore_strPersonalTown), BasketStore_strPersonalPostcode: escape(this.BasketStore_strPersonalPostcode), BasketStore_strPersonalCountry: escape(this.BasketStore_strPersonalCountry), // BasketStore_strDeliveryFullName: escape(this.BasketStore_strDeliveryFullName), BasketStore_strDeliveryBusinessName: escape(this.BasketStore_strDeliveryBusinessName), BasketStore_strDeliveryAdd1: escape(this.BasketStore_strDeliveryAdd1), BasketStore_strDeliveryAdd2: escape(this.BasketStore_strDeliveryAdd2), BasketStore_strDeliveryTown: escape(this.BasketStore_strDeliveryTown), BasketStore_strDeliveryPostcode: escape(this.BasketStore_strDeliveryPostcode), BasketStore_strDeliveryCountry: escape(this.BasketStore_strDeliveryCountry), // BasketStore_strContactEmail: escape(this.BasketStore_strContactEmail), BasketStore_strContactPhoneNumber: escape(this.BasketStore_strContactPhoneNumber), // BasketStore_strPaymentNumber: escape(this.BasketStore_strPaymentNumber), BasketStore_strPaymentNumber_Secure: escape(this.BasketStore_strPaymentNumber_Secure), // BasketStore_strPaymentStartMonth: escape(this.BasketStore_strPaymentStartMonth), BasketStore_strPaymentStartYear: escape(this.BasketStore_strPaymentStartYear), BasketStore_strPaymentExpiryMonth: escape(this.BasketStore_strPaymentExpiryMonth), BasketStore_strPaymentExpiryYear: escape(this.BasketStore_strPaymentExpiryYear), // BasketStore_strPaymentVerifyNumber: escape(this.BasketStore_strPaymentVerifyNumber), BasketStore_strPaymentIssueNumber: escape(this.BasketStore_strPaymentIssueNumber), BasketStore_strPaymentFullName: escape(this.BasketStore_strPaymentFullName), BasketStore_strPaymentBusinessName: escape(this.BasketStore_strPaymentBusinessName), BasketStore_strPaymentAdd1: escape(this.BasketStore_strPaymentAdd1), BasketStore_strPaymentAdd2: escape(this.BasketStore_strPaymentAdd2), BasketStore_strPaymentTown: escape(this.BasketStore_strPaymentTown), BasketStore_strPaymentPostcode: escape(this.BasketStore_strPaymentPostcode), BasketStore_strPaymentCountry: escape(this.BasketStore_strPaymentCountry), // BasketStore_strPaymentAccountRegistrationCode: escape(this.BasketStore_strPaymentAccountRegistrationCode), BasketStore_strPaymentOrderReference: escape(this.BasketStore_strPaymentOrderReference), BasketStore_strPaymentMake: escape(this.BasketStore_strPaymentMake), BasketStore_strCheckboxRecieveInfo: escape(this.BasketStore_strCheckboxRecieveInfo), BasketStore_strNoteFromCustomer: escape(this.BasketStore_strNoteFromCustomer) } var objResponce = $.ajax({ type: 'POST', url: 'DbJsReceiverAPI', data: objSendOut, success: objSuccessFunction // function (data) { alert("data Loaded: " + data); } }); // Clear bulk transmission arrays - Should clear when the page is forwarded, but clear anyway. this.arrObjBulk_ItemDelete = []; this.arrObjBulk_ItemRemove = []; this.arrObjBulk_ItemQuantity_LineNumber = []; this.arrObjBulk_ItemQuantity_Units = []; }, // End of ReceiverServerSideAPI_Send // --- End of Post to function receiver on server side. // --- Presentation functions used by Products Lists and pages. Presentation_SortList_AddItem: function (strItemId, intIndex, dblPrice, strPartDesc) { function urldecode(str) { return decodeURIComponent((str + '').replace(/\+/g, '%20')); } //alert('[' + strItemId + '] [' + intIndex + '] [' + dblPrice + '] [' + strPartDesc + ']'); //alert(document.getElementById[strItemId].innerHTML); //alert(document.getElementById["ProductCode58"].innerHTML); this.arrPresentation_SortList_strItemId.push(strItemId); this.arrPresentation_SortList_intIndex.push([strItemId, intIndex]); this.arrPresentation_SortList_dblPrice.push([strItemId, dblPrice]); this.arrPresentation_SortList_strPartDesc.push([strItemId, urldecode(strPartDesc)]); }, Presentation_SortList_StoreItemsInnerHTML: function (strListULid) { // strPresentation_SortList_ListId: '', // arrPresentation_SortList_strInnerHTML: new Array(), this.strPresentation_SortList_ListId = strListULid; if (typeof strListULid == "string") strListULid = document.getElementById(strListULid); var objListItems = strListULid.getElementsByTagName("LI"); for (i = 0; i < objListItems.length; i++) { //alert(objListItems[i].id); // alert(objListItems[i].innerHTML); strHTML = escape(objListItems[i].innerHTML); this.arrPresentation_SortList_strInnerHTML.push([objListItems[i].id, strHTML]); } }, Presentation_SortList: function (intPerformSortNumber) { // // // // arrSorted = new Array(); bitReverse = false; switch (intPerformSortNumber) { case '0': //Popularity arrSorted = this.arrPresentation_SortList_intIndex; break; case '1': //Price: Lowest first arrSorted = this.arrPresentation_SortList_dblPrice; break; case '2': //Price: Highest first arrSorted = this.arrPresentation_SortList_dblPrice; bitReverse = true; break; case '3': //Product Title arrSorted = this.arrPresentation_SortList_strPartDesc; break; default: return false; } function sortMultiDimensional(a, b) { // this sorts the array using the second element return ((a[1] < b[1]) ? -1 : ((a[1] > b[1]) ? 1 : 0)); } arrSorted.sort(sortMultiDimensional); if (bitReverse == true) { arrSorted.reverse(); } // Delete all of the existing tags function RemoveItems(strListULid) { if (typeof strListULid == "string") { objListULid = document.getElementById(strListULid); } // Delete all child nodes var intItems = objListULid.getElementsByTagName('li').length; if (intItems >= 1) { for (var i = intItems; i > 0; i--) { objListULid.removeChild(objListULid.getElementsByTagName("li")[i - 1]); } } } // End of RemoveItems function AddItems(strListULid, arrSorted, arrHTML) { function InArray(arr, strValue) { for (var i = 0; i < arr.length; i++) { if (arr[i][0] == strValue) return true; } return false; } function InArrayValue(arr, strValue) { for (var i = 0; i < arr.length; i++) { if (arr[i][0] == strValue) return arr[i][1]; } return ''; } if (typeof strListULid == "string") { objListULid = document.getElementById(strListULid); } for (var i = arrSorted.length; i > 0; i--) { intItem = i - 1; // Add the new nodes if (InArray(arrHTML, arrSorted[intItem][0]) == true) { var li = document.createElement("li"); objListULid.insertBefore(li, objListULid.getElementsByTagName("li")[0]); objListULid.getElementsByTagName("li")[0].innerHTML = unescape(InArrayValue(arrHTML, arrSorted[intItem][0])); objListULid.getElementsByTagName("li")[0].setAttribute('id', arrSorted[intItem][0]); } } } // End of AddItems // Run Procedure RemoveItems(this.strPresentation_SortList_ListId); AddItems(this.strPresentation_SortList_ListId, arrSorted, this.arrPresentation_SortList_strInnerHTML); } // End of Presentation_SortList // --- End of Presentation functions used by Products Lists and pages. }); // End of $.extend(DbJsBasket.prototype // Create the main instance of the Basket API object for use by the function on the web site page. // *** NOTE: THE OBJECT NAME [objMainSiteBasket] IS USED WITHIN THE CALLS OBJECT DURING EVALUATED POST RESPONSE FUNCTIONS AND CANNOT BE CHANGED *** var objMainSiteBasket = new DbJsBasket('objMainSiteBasket'); //objMainSiteBasket.MyObjectNameIs();