"); document.getElementById('discount_msg').innerHTML = discMsg; return; } } var discMsg = ("Sorry... '" + coupval + "' is not a valid discount code."); document.getElementById('discount_msg').innerHTML = discMsg; } function Dollar (val) { // force to valid dollar amount var str,pos,rnd=0; if (val < .995) rnd = 1; // for old Netscape browsers str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape pos = str.indexOf ("."); if (pos > 0) str = str.substring (rnd, pos + 3); return str; } function ReadForm (obj1) { // apply the discount var amt,des,inm; // var obj2 = document.getElementById('varsitem1'); // TEMPORARY KLUDGE! - Added by BW because PayPal doesn't like extra vars in the button form amt = obj1.baseamt.value*1.0; // base amount des = obj1.basedes.value; // base description inm = obj1.item_number.value; // item number -- Added by BW to allow for validation done by DigiSell script; if (discnt > 0) { // only if discount is active // amt = Dollar (amt - (amt * discnt/100.0)); amt = Dollar (amt - discnt); // des = des + ", $" + discnt + " discount, COUP = " + coupval; des = des + ", with discount"; inm = parseInt(inm) + 1; // item number -- Added by BW to allow for validation done by DigiSell script; // Item numbers for discounted items are 1 higher than their non-discounted counterpart. // To keep things orderly, full-price items should have ODD NUMBERS, while // discounted items should have EVEN NUMBERS. } obj1.amount.value = Dollar (amt); obj1.item_number.value = inm; obj1.item_name.value = des; } //-->
|
||||||||||||||||||||||||||||||||||||||||||||||