/* if(typeof CartForm._initialized == "undefined") { */ CartForm.prototype.submit = function() { if(this.payType == '2' || this.payType == '3') { //this.submitSecurePay(); } else { var sComments = this.getHiddenCommentText(); alert(sComments); /* if(this.payType == "3") { this.changeInputsForPayType3(); } */ this.loadHiddenInputs(sComments); alert('test'); document.forms['SubmitOrder'].Comments.value="teste2"; if(getCookie('MacmillanDetailsNew'))delCookie('MacmillanDetailsNew'); } }; CartForm.prototype.loadHiddenInputs = function(comments) { var oForm = document.forms['SubmitOrder']; oForm.Comments.value = comments; alert(oForm.Comments.value); //Load order price if((typeof checkTC != "undefined")&& (checkTC == true)) { oForm.OrderPrice.value = "$" + oCart.getEClubTotal(); } else { oForm.OrderPrice.value = "$" + oCart.getTotal(); } oForm.Quantity.value = oCart.getItemsQuantity(); //----------oForm.SpecialOffer.value = ""; }; CartForm.prototype.attachItemsToForm = function() { if(!oCart.loaded)return false; var oForm = document.forms['SubmitOrder']; for(var i=0; i < oCart.items.length; i++) { var oInput = document.createElement('input'); oInput.setAttribute('type','hidden'); oInput.setAttribute('name','ISBN' + i); oInput.setAttribute('id','ISBN' + i); oInput.value = oCart.items[i].isbn; oForm.appendChild(oInput); var oInput = document.createElement('input'); oInput.setAttribute('type','hidden'); oInput.setAttribute('name','Title' + i); oInput.setAttribute('id','Title' + i); oInput.value = oCart.items[i].title; oForm.appendChild(oInput); var oInput = document.createElement('input'); oInput.setAttribute('type','hidden'); oInput.setAttribute('name','Price' + i); oInput.setAttribute('id','Price' + i); if(oCart.items[i].price.indexOf("$") == -1) { oInput.value = "$" + oCart.items[i].price; } else { oInput.value = oCart.items[i].price; } oForm.appendChild(oInput); } } CartForm.prototype.changeInputsForPayType3 = function() { var oForm = document.forms['SubmitOrder']; var fElements = new Array(); fElements.push(['CardType','S_CType',oForm.CardType.value]); fElements.push(['CardNumber','S_CNumber',oForm.CardNumber.value]); fElements.push(['CardName','S_CName',oForm.CardName.value]); fElements.push(['CardMonth','S_CMonth',oForm.CardMonth.value]); fElements.push(['CardYear','S_CYear',oForm.CardYear.value]); fElements.push(['Inv_Order_Number','Card_ONumber',oForm.Inv_Order_Number.value]); fElements.push(['Inv_Order_AccountCode','Card_OAccountCode',oForm.Inv_Order_AccountCode.value]); for(var i=0; i < fElements.length; i++) { var oElement = oForm.eval(fElements[i][0]); oElement.name = fElements[i][1]; oElement.id = fElements[i][1]; oElement.value = fElements[i][2]; } }; CartForm.prototype.getHiddenCommentText = function() { var oForm = document.forms['SubmitOrder']; var sComments = "Teacher e-club discount applied: No\n\n"; if((typeof checkTC != "undefined")&& (checkTC == true)) { sComments = "Teacher e-club discount applied: Yes\n\n"; } //Load items for(var i=0; i < oCart.items.length; i++) { sComments += "Order: " + (i+1) + "\n"; sComments += "ISBN: " + oCart.items[i].isbn + "\n"; sComments += "Title: " + oCart.items[i].title + "\n"; if(oCart.items[i].buyInspect.substring(1) == "I") { sComments += "Price: -" + "\n"; sComments += "Type: Inspection Copy" + "\n"; } else { if(oCart.items[i].isEClub()&&((typeof checkTC != "undefined")&&(checkTC == true))) { sComments += "Price: $" + oCart.eClubPrice(i) + " (eClub)\n"; } else { sComments += "Price: $" + oCart.items[i].price + "\n"; } sComments += "Type: Buy Copy" + "\n"; } sComments += "Quantity: " + oCart.items[i].quantity + "\n\n"; } sComments += "====================================\n\n\n"; sComments += "Special offer\n"; sComments += "====================================\n"; //---------sComments += oForm.SpecialOffer.value + " \n\n\n"; sComments += "Other information\n"; sComments += "====================================\n"; sComments += "Position: " + oForm.CustomField_2.value + " \n"; sComments += "Fax: " + oForm.CustomField_3.value + " \n\n"; sComments += "Additional comments: \n"; sComments += "====================================\n"; sComments += oForm.Comments_1.value + "\n\n\n"; sComments += "Payment details\n"; sComments += "====================================\n"; if(this.payType == "2")//credit card payment { sComments += "Payment method: Personal Credit Card\n\n"; if((typeof checkTC != "undefined")&& (checkTC == true)) { sComments += "TOTAL PURCHASE PRICE = $" + oCart.getEClubTotal() + "\n"; } else { sComments += "TOTAL PURCHASE PRICE = $" + oCart.getTotal() + "\n"; } if (!checkTC) { sComments += "Handling fee of $" + oCart.handlingCharge + " applied to this order.\n\n"; } else { sComments += "No handling fee applies to this order.\n\n"; } sComments += "Card Type: " + oForm.CardType.value + " \n"; sComments += "Card Holder Name: " + oForm.CardName.value + " \n"; sComments += "Card Number: " + oForm.CardNumber.value + " \n"; sComments += "Card Expiry: " + oForm.CardMonth.value + " / " + oForm.CardYear.value + " \n\n"; } else if(this.payType == "4")//invoice payment { sComments += "Payment method: Invoice\n\n"; if((typeof checkTC != "undefined")&& (checkTC == true)) { sComments += "TOTAL PURCHASE PRICE = $" + oCart.getEClubTotal() + "\n"; } else { sComments += "TOTAL PURCHASE PRICE = $" + oCart.getTotal() + "\n"; } sComments += "Customer Order Number: " + oForm.Inv_Order_Number.value + " \n\n"; sComments += "Account Code: " + oForm.Inv_Order_AccountCode.value + " \n\n"; } else if(this.payType == "3")//credit card + invoice payment { sComments += "Payment method: School Credit Card\n\n"; if((typeof checkTC != "undefined")&& (checkTC == true)) { sComments += "TOTAL PURCHASE PRICE = $" + oCart.getEClubTotal() + "\n"; } else { sComments += "TOTAL PURCHASE PRICE = $" + oCart.getTotal() + "\n"; } sComments += "\nCard Type: " + oForm.CardType.value + " \n"; sComments += "Card Holder Name: " + oForm.CardName.value + " \n"; sComments += "Card Number: " + oForm.CardNumber.value + " \n"; sComments += "Card Expiry: " + oForm.CardMonth.value + " / " + document.forms['SubmitOrder'].CardYear.value + " \n\n"; sComments += "Customer Order Number: " + oForm.Inv_Order_Number.value + " \n\n"; sComments += "Account Code: " + oForm.Inv_Order_AccountCode.value + " \n\n"; } if (oForm.MoreInfo.checked == true) { sComments += "Please send me further info on Macmillan products? Yes\n"; } else { sComments += "Please send me further info on Macmillan products? No\n"; } return sComments; }; /* } CartForm._initialized = true; */ function HiddenInput(id,val) { this.id = id; this.val = val; }