home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2003-07-15 | 29.9 KB | 1,095 lines
var rn = new Array() var rf = new Array() var serv = new Array() // BEGIN VARS var swheaders = "Product Code,,,Template,Name,Price,Short Description,Variation,Delivery Method,VAT,LBand,HBand," rn[0]='cn' rf[0]='Card Number' rn[1]='mm' rf[1]='Expiry Month' rn[2]='yy' rf[2]='Expiry Year' rn[3]='pn' rf[3]='Phone Number' rn[4]='fn' rf[4]='First Name' rn[5]='sn' rf[5]='Surname' rn[6]='a1' rf[6]='Address 1' rn[7]='st' rf[7]='State / County' rn[8]='zp' rf[8]='Zip / Postcode' rn[9]='ct' rf[9]='Country' rn[10]='em' rf[10]='Email Address' var code_col = 0 var price_col = 5 var img_col = ',' var thr_col = ',' var var_col = 7 var v_col = 2 var vdesc_col = 8 var vat_col = 9 var cur_desc = '$' var remove_text = 'Remove' var basket_empty_text = 'Sorry - Your Basket is Empty' var gotobasket = 'on' var baskethitsrow = 1 var dec = true var cfields= ",Shop ID,Product Code,Variation ID,Delivery ID,Quantity,Custom Field,Affiliate Code,Payment Type 1-5,Card Number,Issue Number,Expiry Month,Expiry Year,First Name,Surname,Company Name,Address 1,Address 2,Address 3,State / County,Zip / Postcode,Country,Email Address,Phone Number,Delivery First Name,Delivery Surname,Delivery Company,Delivery Address 1,Delivery Address 2,Delivery Address 3,Delivery State / County,Delivery Zip / Postcode,Delivery Country,Instructions,IP Address,Cart ID,EU VAT Number," var baskettable = '</td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Product Code%27</td>%0D%0A <td valign=top width=4><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Name%27</td>%0D%0A <td valign=top width=4><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top align=right><font face=arial size=-2><hr noshade size=1 width=100%25>%27Price%27</td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Short Description%27</td>%0D%0A <td valign=top width=4><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Variation%27</td>%0D%0A <td valign=top width=4><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Delivery Method%27</td>%0D%0A <td valign=top width=4><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27VAT%27</td>%0D%0A <td valign=top width=4><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Quantity%27 </td>%0D%0A <td valign=top><font face=arial size=-2<hr noshade size=1 width=100%25></td>%0D%0A <td valign=top align=right><font face=arial size=-2><hr noshade size=1 width=100%25>%27Total%27 </td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25></td>%0D%0A <td valign=top><font face=arial size=-2><hr noshade size=1 width=100%25>%27Remove%27 </td>%0D%0A' var baskettable2 = '</td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>Product Code</td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>Name</td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top align=right bgcolor=%27#aaaaaa%27 height=24><font face=arial size=-2>Price</td>%0D%0A <td valign=top width=4 bgcolor=#aaaaaa><font face=arial size=-2> </td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>Short Description</td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>Variation</td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>Delivery Method</td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>VAT</td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top bgcolor=%27#aaaaaa%27><font face=arial size=-2>Quantity </td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td valign=top align=right bgcolor=%27#aaaaaa%27><font face=arial size=-2>Total </td>%0D%0A <td valign=top width=4 bgcolor=%27#aaaaaa%27><font face=arial size=-2> </td>%0D%0A <td bgcolor=%27#aaaaaa%27></td>%0D%0A' var store_cur = 'USD' var local_cur = 'USD' var sw_s = '4071' // END VARS var cookies = true var send_once = false var ban_col = 11 var cur_url = 'https://www.swreg.org/cgi-bin/john/sw_currency3.pl' var cur_var = 1 var qr = '' var custom_col = 12 function set_country(ctr, or) { var reload = in_eu() if (document.checkout) { if (or && document.checkout.dct) { document.checkout.dct.value = ctr set_cookie('DCTR', ctr) } else if (!or && document.checkout.ct) { document.checkout.ct.value = ctr set_cookie('CTR', ctr) } } if (reload != in_eu()) { save_form() location= location.href.split('?')[0] + '?' + qr } } function in_eu() { var c = new Array() var ret = false var ctr = get_cookie('DCTR') if (!ctr) { ctr = get_cookie('CTR') } c[0] = 'United Kingdom' c[1] = 'Austria' c[2] = 'Belgium' c[3] = 'Denmark' c[4] = 'Finland' c[5] = 'France' c[6] = 'Germany' c[7] = 'Greece' c[8] = 'Ireland' c[9] = 'Italy' c[10] = 'Luxembourg' c[11] = 'Netherlands' c[12] = 'Portugal' c[13] = 'Spain' c[14] = 'Sweden' if (ctr) { for (var i=0; i < c.length; i++) { if (ctr == c[i]) { ret = true break } } } return ret } function set_currency(sel, force) { local_cur = sel if (force && !document.cookie) { alert('Sorry - you have disabled this feature by turning off cookies!\n\nPlease turn them back on!') } else if (force || location.href.indexOf('\\') > -1) { var tem = location.href.split('?') var new_location = '' if (tem.length > 1) { new_location = '&' + tem[1] } set_cookie('CURSTORE', local_cur) if (cur_desc == 'รบ') { var gb = '&gb=yes' } else if (cur_desc == '') { var gb = '&eur=yes' } else { var gb = '' } location = cur_url + '?SWCUR=' + local_cur + '&SWREF=' + escape(tem[0]) + new_location + gb } } function set_ip() { if (cookies) { var tem = location.href.split('?') var new_location = '' if (tem.length > 1) { new_location = '&' + tem[1] } location = cur_url + '?&SWREF=' + escape(tem[0]) + new_location } } function pop_form() { if (document.checkout) { var pull = false var fm = get_cookie('FORM') if (fm != '') { var tem = fm.split(':') for (var i = 0; i < tem.length; i++) { var tem2 = tem[i].split('=') if (tem2.length > 1) { if (tem2[1]) { for (var j=0; j < document.checkout.length; j++) { if (document.checkout.elements[j].name == tem2[0]) { if (tem2[0] == 'country' || tem2[0] == 'dcountry') { for (var k=0; k < document.checkout.elements[j].length; k++) { if (tem2[1] == document.checkout.elements[j].options[k].value) { document.checkout.elements[j].selectedIndex=k } } } else if (document.checkout.elements[j].value == '' || tem2[0] == 'ct' || tem2[0] == 'dct') { document.checkout.elements[j].value = tem2[1] } } } } } } } if (document.checkout.cn) { var cno = get_cookie('CN') if (cno) { document.checkout.cn.value = cno } } if (document.checkout.pt) { var pt_index = get_cookie('PT') if (!pt_index || pt_index != (1 * pt_index)) { pt_index = 0 } if (pt_index < document.checkout.pt.length) { document.checkout.pt[pt_index].checked = true } } } } function save_form() { if (document.checkout) { var pull = false var selbox = 0 var cs = '' for (var i=0; i < document.checkout.length; i++) { pull = true selbox = -1 if (document.checkout.elements[i].type) { if (document.checkout.elements[i].type == 'hidden' || document.checkout.elements[i].name == 'pt') { pull = false } } if (pull) { if (document.checkout.elements[i].name != 'cn') { var cn = document.checkout.elements[i].name if (document.checkout.elements[i].name == 'country' || document.checkout.elements[i].name == 'dcountry') { var cv = document.checkout.elements[i].options[document.checkout.elements[i].selectedIndex].value } else { var cv = document.checkout.elements[i].value } if (cv) { cs += cn + '=' cs += cv + ':' } } else { set_cookie('CN', document.checkout.elements[i].value) } } } set_cookie('FORM', cs) if (document.checkout.pt) { for (var i=0; i< document.checkout.pt.length; i++) { if (document.checkout.pt[i].checked) { set_cookie('PT', i) break } } } } } function set_cookie(cname, cvalue, exp) { cname = escape(cname) if (cname) { if (cookies) { var when = new Date() if (cvalue) { if (exp) { when.setHours(when.getHours()+23) } else { when.setMonth(when.getMonth()+6) } document.cookie = 'SW' + cname + '=' + escape(cvalue) + 'SW' + cname + 'END;expires=' + when.toGMTString() } else { when.setMonth(when.getMonth()) document.cookie = 'SW' + cname + '=;expires=' + when.toGMTString() } } if (!cookies || get_cookie(unescape(cname)) != cvalue) { var tem = qr.split('&') qr = '' for (var i=0; i < tem.length; i++) { if (tem[i] && tem[i].split('=')[0] != cname) { qr += tem[i] + '&' } } if (cvalue) { qr += cname + '=' + escape(cvalue) } if (qr.length > 2043) { alert('Sorry - you have limited the size of your basket by turning off cookies!\n\nPlease turn them back on!') qr = tem.join('&') } else { load_links() } } } } function get_cookie(cname) { cname = 'SW' + escape(cname) var cs_out = '' var cs = document.cookie if (cookies && cs.indexOf(cname + '=') > -1 && cs.indexOf(cname + 'END') > -1) { cs_out = cs.split(cname + '=')[1].split(cname + 'END')[0] } if (!cs_out) { cs_out = get_query(unescape(cname)) } return unescape(cs_out) } function get_query(cname) { cname = escape(cname) var tem = qr.split('&') var cs_out = '' if (qr) { for (var i=0; i < tem.length; i++) { if (tem[i]) { var tem2 = tem[i].split('=') if (('SW' + tem2[0] == cname || tem2[0] == cname) && tem2.length > 1) { cs_out = tem2[1] break } } } } return unescape(cs_out) } var sw_cur_old = get_cookie('CURSTORE') if (sw_cur_old) { local_cur = sw_cur_old if (document.currency) { if (document.currency.c1) { for (var i=0; i< document.currency.c1.length; i++) { if (sw_cur_old == document.currency.c1.options[i].value) { document.currency.c1.selectedIndex = i break } } } } } var sw_cur = document.location.href.split('?') if (sw_cur.length > 1) { if (sw_cur[1]) { var sw_cur2 = sw_cur[1].split('&') for (var i=0; i < sw_cur2.length; i++) { var qr2 = sw_cur2[i].split('=') if (qr2.length > 1) { qr2[0] = unescape(qr2[0]) qr2[1] = unescape(qr2[1]) if (qr2[0] == 'SWCUR') { cur_var = eval(escape(qr2[1])) set_cookie('CURVAR', cur_var, true) } else if (qr2[0] == 'SWIP') { set_cookie('SWIP', qr2[1], true) } else if (qr2[0] == 'a') { set_cookie('AFFILIATE', qr2[1], true) } } } } } var sw_ip = get_cookie('SWIP') if (!sw_ip && location.href.toLowerCase().indexOf('checkout') > 0) { set_ip() } cur_var = eval(get_cookie('CURVAR')) if (cookies && !cur_var && document.cookie && local_cur != store_cur) { set_currency(local_cur, false) } else if (!cur_var) { cur_var = 1 } if (1 * cur_var != cur_var) { cur_var = 1 } function format_basket() { var count_width = 3 var count_items = 0 var htm = '' var htm4 = '<center><table border=0 cellspacing=0 cellpadding=0 width=100%>' if (!document.checkout) { htm4 += '<form name="bask" onSubmit="return false">' } if (location.href.indexOf('Response.htm') > 0) { remove_text = '' } var tem_price = 'n/a' var htm_tem = '' var cr1 = -1 var headers = swheaders.split(',') var htm3 = '' var toprow = true var swhash = get_cookie('REGHASH').split('&') for (var i = 0; i < swhash.length; i++) { if (swhash[i]) { var tem = get_cookie(swhash[i]).split(',') if (tem.length > 1 ) { if (tem[0] == 'Shipping') { } else { count_items++ if (baskettable2 != '' && toprow) { htm3 += '<td valign=top>' + unescape(baskettable2) + '</td>' } var htm2 = unescape(baskettable) if (price_col > -1) { tem_price = tem[1] * tem[price_col] if (in_eu()) { tem[vat_col] = 0.175 * eval(tem_price) tem_price += eval(tem[vat_col]) } tem_price = CorrectPrices(tem_price, true) } for (var j = 0; j < tem.length; j++){ htm_tem = '' if (img_col.indexOf(',' + j + ',') > -1) { if (tem[j+1] != '') { htm_tem += '<img src="' + tem[j] + '" border=0>' } } else if (j == price_col) { htm_tem += CorrectPrices(tem[j], true) } else if (j == code_col && remove_text) { htm_tem += "<a " htm_tem += "href='javascript:location=(\"" + tem[tem.length - 1] + "?" + escape(qr) + "\");'>" + tem[j] + "</a>" } else if (j == vat_col) { htm_tem += CorrectPrices((eval(tem[j]) * eval(tem[1])), true) } else { htm_tem += tem[j] } if (htm_tem == '0') { htm_tem = '' } htm2 = rep(htm2, headers[j], htm_tem) } htm2 = rep(htm2, 'Remove', "<a href='javascript:remv(\"" + tem[0] + "\")'>" + remove_text + "</a>") if (document.checkout || !remove_text) { htm2 = rep(htm2, 'Quantity', '<b>' + tem[1] + '</b>') } else { htm2 = rep(htm2, 'Quantity', '<input type="text" size=5 value="' + tem[1] + '" onChange="chq()">') } htm2 = rep(htm2, 'Total', tem_price) if (cr1 <= 0) { htm2 = '<tr><td valign=top>' + htm2 + '</td>' cr1 = 0 } else { htm2 = '<td valign=top>' + htm2 + '</td>' } cr1++ if (cr1 >= baskethitsrow) { cr1 = 0 toprow = false htm2 += '</tr>' } htm += htm2 } } } } count_width-- htm += '</table><br> <br><div align=left>' var vat_no = get_cookie('VAT_NO') if (vat_no != '') { if (vat_no.indexOf('GB') < 0) { htm += 'Sold by:<P>Atlantic Coast PLC<br>The Shareware Village<br>Colyton<br>Devon EX24 6HA<br>England<P>Our VAT Reg. # GB445812740<br>Your VAT #: ' + vat_no + '<P>To obtain a refund (credit card orders only) of the VAT shown above please fax this document along with proof of VAT registration to 0044 1297 553366 and allow a few days for the refund to be applied - a confirmation will be sent by e-mail. Suitable proof might but be but not limited to a copy of your VAT registration document or a copy of your VAT return form. For qualifying non credit-card orders please fax us proof as above and send the amount less the VAT.<P>' } } htm += '</div><div align=right>eCommerce engine by <a href="http://www.swreg.org" target="swreg">SWREG</a></div></center>' if (!document.checkout) { htm += '</form>' } if (count_items < 1) { htm = '<center><font face="arial"><h3>' + basket_empty_text + '</h3></font></center>' } else { if (htm3 != '') { htm4 += '<tr>' + htm3 + '</tr>' } htm = htm4 + htm } if (remove_text == '') { var tim = null var tim = setTimeout('clear_basket()', 2000) } return htm; } function check_card (st) { var sum = 0 var mul = 1 var l = st.length if (l > 19) { return true } else if (l < 5) { return false } var dc = st.substring(0,2) if (dc == '30' || dc == '36' || dc == '38') { set_cookie('DC', 'yes') } else { set_cookie('DC', '') } for (var i = 0; i < l; i++) { digit = st.substring(l-i-1,l-i) tproduct = parseInt(digit ,10) * mul if (tproduct >= 10) { sum += (tproduct % 10) + 1 } else { sum += tproduct } if (mul == 1) { mul++ } else { mul-- } } if ((sum % 10) == 0) { return (true) } else { return (false) } } function rep (one, two, three) { var where = one.split("'" + two + "'") var out = '' if (two) { for (var i = 0; i < (where.length); i++) { out += where[i] if (i < (where.length -1)) { out += three } } } else { out = one } return out; } function CorrectPrices(thisvalue, flg){ if(!thisvalue) { thisvalue = 0 } var nvalue=thisvalue if (1 * nvalue == nvalue) { nvalue = eval(nvalue) var lvalue = nvalue * cur_var if (dec) { nvalue = (Math.round(nvalue * 100)) / 100 lvalue = (Math.round(lvalue * 100)) / 100 if (Math.floor(nvalue) == nvalue) { nvalue = nvalue + '.00' } else if (Math.floor(nvalue*10) == (nvalue*10)) { nvalue = nvalue + '0' } if (Math.floor(lvalue) == lvalue) { lvalue = lvalue + '.00' } else if (Math.floor(lvalue*10) == (lvalue*10)) { lvalue = lvalue + '0' } } else { nvalue = Math.round(nvalue) lvalue = Math.round(lvalue) } if (cur_var != 1) { nvalue = '<nobr>' + lvalue + ' ' + local_cur + ' </nobr>' } else { nvalue = cur_desc + nvalue } } return nvalue } function c_form() { var p = '' var v = '' var d = '' var q = '' // KN Add, for storing serial# var t = get_cookie('SERIAL') var a = get_cookie('AFFILIATE') var ra = cur_url + '?SEND=' var ret = true var swhash = get_cookie('REGHASH').split('&') for (var i = 0; i < swhash.length; i++) { if (swhash[i]) { var tem = get_cookie(swhash[i]).split(',') if (tem.length > 1 ) { if (tem[0] != 'Shipping') { if (tem[custom_col]) { p += sw_s + 'Custom:' } else { p += tem[code_col] + ':' } var tem2 = tem[v_col].split('&') if (tem2.length > 1) { v += tem2[0] + ':' d += tem2[1] + ':' } else { v += '0:' d += '0:' } q += tem[1] + ':' } } } } if (location.href.indexOf('/') < 0) { var spl = '\\' } else { var spl = '/' } var tem = unescape(location.href.split('?')[0]) tem = tem.split(spl) for (var i=0; i< tem.length-1; i++) { ra += tem[i] + spl } ra += 'Response.htm' if (document.checkout.vn) { var eu = new Array() eu[0] = 'GB,United Kingdom' eu[1] = 'AT,Austria' eu[2] = 'BE,Belgium' eu[3] = 'DK,Denmark' eu[4] = 'FI,Finland' eu[5] = 'FR,France' eu[6] = 'DE,Germany' eu[7] = 'EL,Greece' eu[8] = 'IE,Ireland' eu[9] = 'IT,Italy' eu[10] = 'LU,Luxembourg' eu[11] = 'NL,Netherlands' eu[12] = 'PT,Portugal' eu[13] = 'ES,Spain' eu[14] = 'SE,Sweden' var newvat = '' var ctr = '' if (document.checkout.dct) { ctr = document.checkout.dct.value } if (!ctr && document.checkout.ct) { ctr = document.checkout.ct.value } for (var i=0; i < eu.length; i++) { if (ctr == eu[i].split(',')[1]) { newvat = eu[i].split(',')[0] break } } var numbers = '0123456789' for (var i=0; i < document.checkout.vn.value.length; i++) { for (var j = 0; j<= numbers.length; j++) { if (document.checkout.vn.value.substring(i, i + 1) == numbers.substring(j, j + 1)){ newvat = newvat + document.checkout.vn.value.substring(i, i + 1) break } } } if (document.checkout.vn.value != '') { document.checkout.vn.value = newvat set_cookie('VAT_NO', newvat) } } if (p.length > 0 && document.checkout.p) { document.checkout.p.value = p.substring(0,p.length-1) } if (v.length > 0 && document.checkout.v) { document.checkout.v.value = v.substring(0,v.length-1) } if (d.length > 0 && document.checkout.d) { document.checkout.d.value = d.substring(0,d.length-1) } if (q.length > 0 && document.checkout.q) { document.checkout.q.value = q.substring(0,q.length-1) } // KN Add, for storing serial# if (t.length > 0 && document.checkout.t) { document.checkout.t.value = t } if (ra.length > 0 && document.checkout.ra) { document.checkout.ra.value = ra } if (document.checkout.a) { document.checkout.a.value = a } if (document.checkout.ip) { if (!sw_ip) { sw_ip = 'unknown' } document.checkout.ip.value = sw_ip } if (document.checkout.s) { document.checkout.s.value = unescape(sw_s) } if (document.checkout.cart && (document.cookie == '' || !cookies)) { var ext = '&FORM=' + escape(get_cookie('FORM')) var tem = get_cookie('REGHASH') ext += '®HASH=' + escape(tem) var swhash = tem.split('&') for (var i = 0; i < swhash.length; i++) { if (swhash[i]) { var tem2 = get_cookie(swhash[i]) if (tem2) { ext += '&' + escape(swhash[i]) + '=' + escape(tem2) } } } document.checkout.cart.value = ext } var pt_start = 3 if (document.checkout.pt) { if (document.checkout.pt[0].checked) { pt_start = 0 } } for (var i=0; i < document.checkout.length; i++) { for (var j=pt_start; j< rn.length; j++) { if (ret && document.checkout.elements[i].name == rn[j] && (document.checkout.elements[i].value == '' || document.checkout.elements[i].value == ' ')) { ret = false alert('Please provide the information: ' + rf[j]) document.checkout.elements[i].focus() } } } if (ret && document.checkout.pt && document.checkout.cn) { if (document.checkout.pt[0].checked) { if (send_once) { alert('Sorry - to prevent a double-charge on your card this form will not be sent twice.\n\nTo try again please refresh this page in your browser.') ret = false } else if (!check_card(document.checkout.cn.value)) { alert('Sorry - the credit card number you have used is invalid. Please check and try again!') ret = false } else if (get_cookie('DC') == 'yes') { if (!confirm('You have used a Diners Club card - a surcharge of 4% will be added to your order.\n\nDo you want to continue with the order?')) { ret = false } } } } if (document.checkout.em && ret) { var em_prompt = prompt('Please confirm your email address is correct by re-entering it here','') if (em_prompt != document.checkout.em.value) { alert('Sorry - the email address does not match!\n\nPlease check it again...') ret = false document.checkout.em.focus() } } send_once = ret return ret } function chq() { var cn = 0 var ntest = 0 var ct = 0 if (document.bask) { var swhash = get_cookie('REGHASH').split('&') for (var i = 0; i < swhash.length; i++) { if (swhash[i] && document.bask.elements[ct]) { if (swhash[i] != 'Shipping' && swhash[i] != 'Tax') { ntest = document.bask.elements[ct].value var tem = get_cookie(swhash[i]).split(',') if (ntest != '' && ntest == (1 * ntest) && tem[1] != ntest) { var thr = tem[ban_col].split(':') if (thr.length > 1) { for (var j=0; j < thr.length; j++) { if (thr[j]) { var thr2 = thr[j].split('#') if (thr2.length > 1) { if (eval(ntest) >= thr2[1] && eval(ntest) <= thr2[2] && eval(thr2[0]) > 0) { tem[price_col] = eval(thr2[0]) } } } } } tem[1] = ntest set_cookie(tem[0], tem.join(',')) } ct++ } } } } set_data() } function buy(val) { store_data(val + ',' + location.href.split('?')[0], true) set_data() } function load_document() { qr = location.search if (qr.length > 0) { qr = qr.substring(1,qr.length) } } // Modified by KN for anchor-jumping function load_links() { for (var i=0; i< document.links.length; i++) { if ((document.links[i].href.indexOf('javascript') < 0) && (document.links[i].href.indexOf('mailto') < 0) && (document.links[i].href.indexOf('ftp') < 0) && (document.links[i].href.indexOf('file/') < 0)){ hash = document.links[i].hash; if (document.links[i].href.indexOf('?') < 0) { document.links[i].href= document.links[i].href + '?' + qr + hash; } else { document.links[i].href= document.links[i].href.split('?')[0] + '?' + qr + hash; } } } } function load_checkout() { load_links() pop_form() } function set_data() { if (gotobasket == 'off' || location.href.split('?')[0].toLowerCase().indexOf('checkout') > 0) { save_form() location= location.href.split('?')[0] + '?' + qr } else { location='ShoppingBasket.htm?' + qr } } function store_data(dvalue, addorremove) { var tem = dvalue.split(',') if (addorremove && tem.length >= ban_col) { var thr = tem[ban_col].split(':') if (thr.length > 1) { for (var j=0; j < thr.length; j++) { if (thr[j]) { var thr2 = thr[j].split('#') if (thr2.length > 1) { if (eval(tem[1]) >= thr2[1] && eval(tem[1]) <= thr2[2] && eval(thr2[0]) > 0) { tem[price_col] = eval(thr2[0]) } } } } } } var swhash = get_cookie('REGHASH') var dtem = '' for (var i=0; i < document.forms.length; i++) { if (document.forms[i].name == '_' + tem[0]) { if (document.forms[i].elements[0]) { var tem3 = document.forms[i].elements[0].options[document.forms[i].elements[0].selectedIndex].value.split(':') if (tem3.length > 2) { tem[price_col] = eval(tem3[2]) tem[v_col] = tem3[0] + '&' + tem3[1] tem[vdesc_col] = document.forms[i].elements[0].options[document.forms[i].elements[0].selectedIndex].text tem[vat_col] = 0 } } } } var tem2 = swhash.split('&') for (var i=0; i < tem2.length; i++) { if (tem2[i] && unescape(tem2[i]) != tem[0]) { dtem += tem2[i] if (i < tem2.length -1) { dtem += '&' } } } if (addorremove) { if (dtem) { dtem += '&' } set_cookie('REGHASH', dtem + tem[0]) set_cookie(tem[0], tem.join(',')) } else { set_cookie('REGHASH', dtem) set_cookie(tem[0], '') } } function remv(val) { store_data(val, false) set_data() } function show_items() { var count_items = 0 var swhash = get_cookie('REGHASH').split('&') for (var i = 0; i < swhash.length; i++) { if (swhash[i]) { var tem = get_cookie(swhash[i]).split(',') if (tem.length > 1 ) { if (tem[0] != 'Shipping' && tem[0] != 'Tax' && tem[1] && tem[1] != '0' && tem[1] == (1 * tem[1])) { count_items += eval(tem[1]) } } } } return count_items } function show_cost() { var count_items = 0 var ship = 0 var tax = 0 var diners = 0 var htm = '<div align=right>' var swhash = get_cookie('REGHASH').split('&') for (var i = 0; i < swhash.length; i++) { if (swhash[i]) { var tem = get_cookie(swhash[i]).split(',') if (tem.length > 1 ) { if (tem[1] == (1 * tem[1]) && tem[price_col] == (1 * tem[price_col])) { if (tem[0] == 'Shipping') { ship += eval(tem[price_col]) } else { //tax += eval(tem[vat_col] * eval(tem[1])) count_items += eval(tem[1]) * eval(tem[price_col]) } } } } } if (get_cookie('DC') == 'yes') { diners = eval(eval(eval(count_items) + eval(ship) + eval(tax) + eval(diners)) * 0.04) htm += '<br>Diners Club card surcharge: ' + CorrectPrices(diners, true) } htm = CorrectPrices(count_items, true) if (ship > 0 && eval(count_items) > 0) { htm += '<br>Manual processing fee: ' + CorrectPrices(ship, true) } if (in_eu()) { tax = 0.175 * eval(eval(count_items) + eval(ship) + eval(diners)) htm += '<br>VAT @ 17.5%: ' + CorrectPrices(tax, true) } if ((ship > 0 || tax > 0 || diners > 0) && eval(count_items) > 0) { htm += '<hr width=100>Total: ' + CorrectPrices(eval(eval(count_items) + eval(ship) + eval(tax) + eval(diners)), true) } htm += '</div>' return htm } function clear_basket() { set_cookie('REGHASH', 'Shipping') set_cookie('REGHASH', '') set_cookie('SWIP', '') set_cookie('PT', '') set_cookie('DC', '') set_cookie('CN', '') set_cookie('VAT_NO', '') } function show_data(fld) { var htm = '' if (fld == 'SWSERVER') { var sw_pm = get_query('payment_method') if (serv[sw_pm]) { htm = unescape(serv[sw_pm]) if (5 == eval(sw_pm)) { htm = rep(htm, '<!-- INSERT DATA 2 -->', get_query('SWSERVER2')) } htm = rep(htm, '<!-- INSERT DATA -->', get_query(fld)) } } if (!htm) { htm = get_query(fld) } if (!htm) { var fm = get_cookie('FORM') if (fld && fm) { var tem = fm.split(':') for (var i = 0; i < tem.length; i++) { var tem2 = tem[i].split('=') if (tem2.length > 1) { if (tem2[0] == fld) { htm = unescape(tem2[1]) } } } } } return htm } // KC's addition // All the buy parameters for PictureToTV are stored here, so that the // individual web pages simply need to call this. function buy_personal(){ buy('40711000,1,,,PictureToTV,39.95,Personal Edition,,Online download,0,0,0,') } function buy_business(){ buy('40711001,1,,,PictureToTV,299.95,Business Edition,,Online download,0,0,0,') } // SVCD product function buy_svcdbundle(){ buy('40711003,1,,,PictureToTV,49.95,Personal Edition + SVCD Bundle,,Online download,0,0,0,') } load_document()