// TKO: 02/16/2006 // Used to remove a store item from the cart // This function is also used to remove order items created from (buy-more-of-same) functionality. function removeOrderItem(theForm, oriId, siId, oriType) { theForm.action = "/edealinv/servlet/DeleteStoreOrderItem"; theForm.nurl.value = "control/AddOrder.vm"; theForm.ori_id.value = oriId; theForm.ori_type.value = oriType; theForm.siId.value = siId; theForm.method = "post"; theForm.submit(); } function removeStorePurchase(theForm, stpId) { // note that for standard checkout, on store purchases can be removed theForm.action = "/edealinv/servlet/DeleteStoreOrderItem"; theForm.nurl.value = "control/AddOrder.vm"; theForm.stpId.value = stpId; theForm.method = "post"; theForm.submit(); } function updateShopCart(theForm) { theForm.action = "/edealinv/servlet/UpdateShoppingCart"; theForm.nurl.value = "control/AddOrder.vm"; theForm.method = "post"; theForm.submit(); } // wrapper function used to submit the form from button press function goSubmitAddOrder(theForm) { theForm.action = "/edealinv/servlet/CheckoutItems"; theForm.checkoutMethod.value = "Store"; theForm.method = "post"; theForm.submit(); } // wrapper function used to invoke PayPal Express Checkout function goSubmitAddOrderPayPalExpress(theForm, usePayLater) { theForm.action = "/edealinv/servlet/CheckoutItems"; theForm.checkoutMethod.value = "PayPal"; //By setting this flag to Y, PayLater will appear as an alternate payment option on PayPal if(usePayLater == "Y") { theForm.usePayLater.value = "Y"; } else { theForm.usePayLater.value = "N"; } theForm.method = "post"; theForm.submit(); } // wrapper function used to invoke PayPal Pay Later function goPayLater(theForm) { theForm.action = "/edealinv/servlet/CheckoutItems"; theForm.checkoutMethod.value = "PayLater"; theForm.usePayLater.value = "Y"; theForm.method = "post"; theForm.submit(); } function winPopup(mypage, myname, w, h, sc) { if (navigator.appVersion.indexOf("AOL") != -1) { newHeight = h + 25; newWidth = w + 25; winprops = 'height=' + newHeight + ',width=' + newWidth win = window.open(mypage, myname, winprops); } else { if (parseInt(navigator.appVersion) >= 4) { var offsetW = (screen.width - w) / 2; var offsetH = (screen.height - h) / 2; winprops = 'height='+ h +',width='+ w +',top='+ offsetH +',left='+ offsetW + ',scrollbars='+sc win = window.open(mypage, myname, winprops) win.window.focus(); } else { newHeight = h + 25; newWidth = w + 25; winprops = 'height=' + newHeight + ',width=' + newWidth win = window.open(mypage, myname, winprops); } } } // TKO: 02/16/2006 // This function is to add (buy-more-of-same) up-sell items, from the shopping cart page. function buyUpSellItem(form, cskuId, itemPrice, itemCurrency, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN") { alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); return; }//if form.action = "/edealinv/servlet/AddUpSellItem"; form.cskuId.value = cskuId; form.itemPrice.value = itemPrice; form.itemCurrency.value = itemCurrency; form.itemQty.value = qty; form.method = "post"; form.submit(); } //SL Dec 2006: A function to logon using the shopping cart form function doCheckoutLoginSubmit(form) { form.action = "/edealinv/servlet/StoreLogon"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreLogon.vm"; form.rurl.value = "control/AddOrder.vm"; form.method="post"; form.submit(); } //END of JS from ADD ORDER //START of JS from CHECKOUT SHIP TO function refreshAddr(selector) { selector.form.action = "/edealinv/servlet/ExecMacro"; selector.form.nurl.value = "control/CheckoutShipTo.vm"; selector.form.pageAnchor.value = "address"; selector.form.method = "post"; selector.form.submit(); } // wrapper function used to submit the form from button press function goSubmitCheckoutShipTo(theForm) { theForm.action = "/edealinv/servlet/CheckoutShipTo"; theForm.method = "post"; theForm.submit(); } // note that address validation will be done on the server side function checkAddress(f) { var doUpd = false; doUpd = f.fname.value!=f.old_fname.value || f.lname.value!=f.old_lname.value || f.addr1.value!=f.old_addr1.value || f.addr2.value!=f.old_addr2.value || f.city.value!=f.old_city.value || f.zipc.value!=f.old_zipc.value || f.phone.value!=f.old_phone.value || f.email.value!=f.old_email.value; //Better check, whether the custom fields are used if(f.addressCustomField_0&&f.old_addressCustomField_0) doUpd = doUpd || f.addressCustomField_0.value!=f.old_addressCustomField_0.value || f.addressCustomField_1.value!=f.old_addressCustomField_1.value || f.addressCustomField_2.value!=f.old_addressCustomField_2.value || f.addressCustomField_3.value!=f.old_addressCustomField_3.value || f.addressCustomField_4.value!=f.old_addressCustomField_4.value || f.addressCustomField_5.value!=f.old_addressCustomField_5.value || f.addressCustomField_6.value!=f.old_addressCustomField_6.value || f.addressCustomField_7.value!=f.old_addressCustomField_7.value || f.addressCustomField_8.value!=f.old_addressCustomField_8.value || f.addressCustomField_9.value!=f.old_addressCustomField_9.value; if(f.state.type=="text") doUpd = doUpd || f.state.value!=f.old_state.value; else doUpd = doUpd || f.state.options[f.state.selectedIndex].value!=f.old_state.value; //doUpd = doUpd || f.cntry.options[f.cntry.selectedIndex].value!=f.old_cntry.value; if(doUpd) f.doUpdAddr.value = "Y"; } // clear all the input fields function clearAddressForm(f) { f.vca_name.value = ""; f.company_name.value = ""; f.add_title.value = ""; f.fname.value = ""; f.lname.value = ""; f.addr1.value = ""; f.addr2.value = ""; f.city.value = ""; f.zipc.value = ""; f.phone.value = ""; f.email.value = ""; f.state.value = ""; if(f.addressCustomField_0){ f.addressCustomField_0.value = ""; f.addressCustomField_1.value = ""; f.addressCustomField_2.value = ""; f.addressCustomField_3.value = ""; f.addressCustomField_4.value = ""; f.addressCustomField_5.value = ""; f.addressCustomField_6.value = ""; f.addressCustomField_7.value = ""; f.addressCustomField_8.value = ""; f.addressCustomField_9.value = ""; } } function addNewAddressForm(f) { clearAddressForm(f); f.action = "/edealinv/servlet/ExecMacro"; f.nurl.value = "control/CheckoutShipTo.vm"; f.addNewAddr.value = "Y"; f.pageAnchor.value = "address"; f.submit(); } function useOldAddressForm(f) { f.action = "/edealinv/servlet/ExecMacro"; f.nurl.value = "control/CheckoutShipTo.vm"; f.addNewAddr.value = "N"; f.pageAnchor.value = "address"; f.submit(); } function textCounterOrdInstruct(field, countfield, maxlimit) { if (field.value.length > maxlimit){ // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter } else{ countfield.value = maxlimit - field.value.length; } } function textCharacterCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit){ // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter } else{ countfield.value = maxlimit - field.value.length; } } //END of JS from CHECKOUT SHIP TO //START of JS from CHECKOUT SHIP METHOD // wrapper function used to submit the form from button press function goSubmitCheckoutShipMethod(theForm) { theForm.action = "/edealinv/servlet/ExecMacro"; theForm.nurl.value = "control/ViewOrderCustomer.vm" theForm.method = "get"; theForm.submit(); } // wrapper function used to update the contents of the page on shipping method change function updateShipMeth(theForm) { theForm.action = "/edealinv/servlet/ExecMacro"; theForm.nurl.value = "control/CheckoutShipMethod.vm" theForm.pageAnchor.value = "shipmeth"; theForm.method = "post"; theForm.submit(); } // wrapper function used to remove non-combinable items for the shopping cart display function removeNonCombineItems(theForm) { theForm.action = "/edealinv/servlet/RemoveNonCombineItems"; theForm.nurl.value = "control/CheckoutShipMethod.vm" theForm.pageAnchor.value = "shipmeth"; theForm.method = "post"; theForm.submit(); } // Used to update page when insurance option is checked or unchecked function setInsuranceInclude(theForm){ var chooseIns = theForm.chooseIns.checked if (chooseIns){ theForm.insInclude.value ="Y" theForm.insIncludeUpdate.value ="Y" }else{ theForm.insInclude.value ="N" theForm.insIncludeUpdate.value ="N" } theForm.action = "/edealinv/servlet/ExecMacro"; theForm.nurl.value = "control/CheckoutShipMethod.vm" theForm.method = "post"; theForm.submit(); } //END of JS from CHECKOUT SHIP METHOD //START of JS from VIEW ORDER CUSTOMER // enable continue button function toggleOn() { var theForm = document.CreateOrder; // hide the payment message document.getElementById('paymentSubmittedMessage').className='hide'; // enable button if(theForm.ordButton) theForm.ordButton.disabled = false; } // disable continue button function toggleOff() { var theForm = document.CreateOrder; // show the payment message document.getElementById('paymentSubmittedMessage').className='show'; // disable button if(theForm.ordButton) theForm.ordButton.disabled = true; } function changeBillToAddr(selector) { selector.form.action = "/edealinv/servlet/ExecMacro"; selector.form.nurl.value = "control/ViewOrderCustomer.vm"; selector.form.method = "post"; selector.form.submit(); } function changeAuctionBillToAddr(selector) { selector.form.action = "/edealinv/servlet/ExecMacro"; selector.form.nurl.value = "control/AuctionPaymentCreditCard.vm"; selector.form.method = "post"; selector.form.submit(); } // note that address validation will be done on the server side // this indicates the billing address needs to be updated function checkAddressBillTo(f) { var doUpd = false; doUpd = f.billing_fname.value!=f.old_fname.value || f.billing_lname.value!=f.old_lname.value || f.billing_addr1.value!=f.old_addr1.value || f.billing_addr2.value!=f.old_addr2.value || f.billing_city.value!=f.old_city.value || f.billing_zipc.value!=f.old_zipc.value || f.billing_phone.value!=f.old_phone.value || f.billing_email.value!=f.old_email.value; if(f.billing_state.type=="text") doUpd = doUpd || f.billing_state.value!=f.old_state.value; else doUpd = doUpd || f.billing_state.options[f.billing_state.selectedIndex].value!=f.old_state.value; doUpd = doUpd || f.billing_cntry.options[f.billing_cntry.selectedIndex].value!=f.old_cntry.value; if(doUpd) f.doUpdBillAddr.value = "Y"; } // clear all the input fields function clearAddressFormBillTo(f) { f.billing_vca_name.value = ""; f.billing_company_name.value = ""; f.billing_fname.value = ""; f.billing_lname.value = ""; f.billing_addr1.value = ""; f.billing_addr2.value = ""; f.billing_city.value = ""; f.billing_zipc.value = ""; f.billing_phone.value = ""; f.billing_email.value = ""; f.billing_state.value = "" } // clear all the input fields function clearAuctionAddressFormBillTo(f) { f.auction_billing_company_name.value = ""; f.auction_billing_title.value = ""; f.auction_billing_fname.value = ""; f.auction_billing_lname.value = ""; f.auction_billing_addr1.value = ""; f.auction_billing_addr2.value = ""; f.auction_billing_city.value = ""; f.auction_billing_zipc.value = ""; f.auction_billing_phone.value = ""; f.auction_billing_state.value = "" } function addNewAddressFormBillTo(f) { clearAddressFormBillTo(f); f.action = "/edealinv/servlet/ExecMacro"; f.nurl.value = "control/ViewOrderCustomer.vm"; f.addNewAddr.value = "Y"; f.pageAnchor.value = "address"; f.submit(); } function addNewAuctionAddressFormBillTo(f) { clearAuctionAddressFormBillTo(f); f.action = "/edealinv/servlet/ExecMacro"; f.nurl.value = "control/AuctionPaymentCreditCard.vm"; f.addNewAddr.value = "Y"; f.pageAnchor.value = "address"; f.submit(); } function useOldAddressFormBillTo(f) { f.action = "/edealinv/servlet/ExecMacro"; f.nurl.value = "control/ViewOrderCustomer.vm"; f.addNewAddr.value = "N"; f.pageAnchor.value = "address"; f.submit(); } function useOldAuctionAddressFormBillTo(f) { f.action = "/edealinv/servlet/ExecMacro"; f.nurl.value = "control/AuctionPaymentCreditCard.vm"; f.addNewAddr.value = "N"; f.pageAnchor.value = "address"; f.submit(); } function refreshAddrBillTo(selector) { selector.form.action = "/edealinv/servlet/ExecMacro"; selector.form.nurl.value = "control/ViewOrderCustomer.vm"; selector.form.pageAnchor.value = "billto"; selector.form.method = "post"; selector.form.submit(); } function refreshAuctionAddrBillTo(selector) { selector.form.action = "/edealinv/servlet/ExecMacro"; selector.form.nurl.value = "control/AuctionPaymentCreditCard.vm"; selector.form.pageAnchor.value = "billto"; selector.form.method = "post"; selector.form.submit(); } function refreshPaymentMethod(theForm) { // reset the shipping address value, only if the variable is there if(theForm.useShipAddr) { theForm.useShipAddr.value = "Y"; } theForm.action = "/edealinv/servlet/CheckoutPayMethod"; theForm.nurl.value = "control/ViewOrderCustomer.vm"; theForm.method = "post"; theForm.submit(); } function goSubmitPaymentReview(theForm) { if(jQuery('input[name="useShipAddr"]:checked').val() == 'N' && jQuery('input[name="old_fname"]', theForm).size() > 0) checkAddressBillTo(theForm); if(theForm.ordTotalValNew != null && theForm.ord_store_credit_redeemed != null && theForm.ordTotalValNew.value == "0" && parseFloat(theForm.ord_store_credit_redeemed.value) > 0 ){ submitOK = false; alert("Please 'Recalculate Order' to apply store credits before placing order."); }else if(theForm.ord_store_credit_redeemed != null && theForm.ord_store_credit_redeemed.value != ""){ if(parseFloat(theForm.ord_store_credit_redeemed.value) >= 0){ if(theForm.ord_id_value != ""){ submitOK = true; }else{ if(theForm.ordTotalValNew != null && parseFloat(theForm.ordTotalValNew.value) < 0 ){ submitOK = false; alert("The maximum store credit redeemable has been exceeded.\n\nPlease adjust the amount of store credit used."); }else if((parseFloat(theForm.ordTotalValue.value) - parseFloat(theForm.ord_store_credit_redeemed.value)) < 0){ submitOK = false; alert("The maximum store credit redeemable has been exceeded.\n\nPlease adjust the amount of store credit used."); }else{ submitOK = true; } } }else if(theForm.ordTotalValNew != null && parseFloat(theForm.ordTotalValue.value) < 0){ submitOK = false; alert("Cannot create a negative total order."); }else{ submitOK = false; alert("Please Recalculate Order to apply store credit or clear the field"); } }else{ submitOK = true; } if(jQuery('#shipToStoreTaxAcknowledgement').size() > 0 && jQuery('#shipToStoreTaxAcknowledgement:checked').size() == 0){ submitOK = false; alert("You have to acknowledge that that you are aware of taxes being charged during store pick up."); } if(submitOK){ // disable the button toggleOff(); theForm.action = "/edealinv/servlet/CreateOrder"; theForm.nurl.value = "control/ViewOrderCustomer.vm" theForm.method = "post"; theForm.submit(); } } function printReceipt(theForm) { theForm.action = "/edealinv/servlet/PrintOrders"; theForm.method = "post"; theForm.target = "_receipt"; theForm.submit(); return; } //END of JS from VIEW ORDER CUSTOMER //START of JS from ORDER HISTORY CUSTOMER function rmaRedirect(ordID) { document.rmaRedirect.action="/edealinv/servlet/ExecMacro?nurl=control/ReqRMACustomer.vm&ctl_nbr=&ord_id=" + ordID; document.rmaRedirect.submit(); } //END of JS from ORDER HISTORY CUSTOMER