var val_string = "quantity,size,coverstock"; var response_string = "Quantity,Size,Paper Stock"; var shippingmethod_id = 0; function basicPriceCal(){ if(getValue('zip') == ''){ sumTotal(); }else{ if(!(getValue('coverstock') == '' || getValue('quantity') == '' || getValue('size') == '')){ //make sure values are different from previous before calculating shipping again. calcShipping(); sumTotal(); }else{ sumTotal(); } } turnAroundTime(); } function turnAroundTime() { setValue('turnaroundtime', '7-10 days Printing'); setValue('turnaroundtime2', ''); } function changeSize() { /*if(!is_checkbox(document.quoteform.size)) return; if (document.quoteform.size[0].checked==true || document.quoteform.size[3].checked==true) { document.quoteform.blankenvelope.checked = true; } basicPriceCal();*/ } function changeColorImage(){ var d=document.quoteform; var img; var covercolor1 = getValue('covercolor1'); switch(covercolor1) { case "4": img = brochure4col; break; case "2": img = brochure2col; break; case "1": img = brochure1col; break; case "0": img = brochurenone; break; case "B": img = brochuregrey; break; default: img=brochure4col; } d.frontimage.src = img; var covercolor2 = getValue('covercolor2'); switch(covercolor2) { case "4": img = brochure4col; break; case "2": img = brochure2col; break; case "1": img = brochure1col; break; case "0": img = brochurenone; break; case "B": img = brochuregrey; break; default: img=brochure4col; } d.backimage.src = img; basicPriceCal(); } function getBasePrice(quantity,size,color){ var arrQty = Array(); arrQty['500_5x7_4/4'] = '235.00'; arrQty['1000_5x7_4/4'] = '325.00'; arrQty['2500_5x7_4/4'] = '495.00'; arrQty['5000_5x7_4/4'] = '625.00'; arrQty['10000_5x7_4/4'] = '1195.00'; arrQty['500_5x7_4/1'] = '215.00'; arrQty['1000_5x7_4/1'] = '245.00'; arrQty['2500_5x7_4/1'] = '395.00'; arrQty['5000_5x7_4/1'] = '625.00'; arrQty['10000_5x7_4/1'] = '1195.00'; arrQty['500_5x7_4/0'] = '195.00'; arrQty['1000_5x7_4/0'] = '245.00'; arrQty['2500_5x7_4/0'] = '395.00'; arrQty['5000_5x7_4/0'] = '625.00'; arrQty['10000_5x7_4/0'] = '1195.00'; arrQty['250_5x7_4/4'] = '205.00'; arrQty['250_5x7_4/0'] = '195.00'; arrQty['250_5x7_4/1'] = '199.00'; return arrQty[quantity + '_' + size + '_' + color]; } function setEnvelopes(quantity) { var arrEnv; arrEnv = new Array (); arrEnv["500"]="39.00"; arrEnv["1000"]="68.00"; arrEnv["1500"]="95.00"; arrEnv["2000"]="130.00"; arrEnv["2500"]="165.00"; arrEnv["3000"]="195.00"; arrEnv["3500"]="230.00"; arrEnv["4000"]="260.00"; arrEnv["4500"]="310.00"; arrEnv["5000"]="325.00"; arrEnv["5500"]="357.00"; arrEnv["6000"]="390.00"; arrEnv["6500"]="425.00"; arrEnv["7000"]="455.00"; arrEnv["7500"]="487.00"; arrEnv["8000"]="520.00"; arrEnv["8500"]="555.00"; arrEnv["9000"]="585.00"; arrEnv["9500"]="620.00"; arrEnv["10000"]="650.00"; arrEnv["250"]="27.00"; return arrEnv[quantity]; } function setDefaults(){ setEditValues(); } function setProofPrice(){ var cost = 0.00; var proof = parseInt(getValue('proof'))+1; var arrProofprice = new Array(); arrProofprice["1"] = "0.00"; arrProofprice["2"] = "0.00"; arrProofprice["3"] = "45.00"; if(parseInt(proof)<=0 && parseInt(proof)>4){ cost=0; }else{ cost=arrProofprice[proof]; } if(!isNaN(cost)){ setValue('proofprice', currencyFormat(cost)); } } function sumTotal(){ var d= document.quoteform; var quantity = getValue('quantity'); var args = upsellParams(arguments); if(args[0] && args[0]>0) quantity = args[0]; var covercolor = getValue('covercolor'); //var covercolor2 = getValue('covercolor2'); var size = getValue('size'); var proof = getValue('proof'); var blankenvelope = getValue('blankenvelope'); var envprice = 0.00; var baseprice = 0.00; var pts = 0; ink_color = covercolor; setProofPrice(); if(quantity != ""){ baseprice = getBasePrice(quantity,size,ink_color); } if(blankenvelope == 'Yes') { envprice = setEnvelopes(quantity); } else { envprice = 0.00; } setValue('baseprice', currencyFormat(baseprice)); if(!isNaN(envprice)) setValue('envelopeprice', currencyFormat(envprice)); else setValue('envelopeprice', currencyFormat(0)); tot=0.00; tot += parseFloat(getValue('baseprice')); tot += parseFloat(getValue('proofprice')); tot += parseFloat(getValue('envelopeprice')); setValue('totalprice', currencyFormat(tot)); if(args[1]) return d.totalprice.value;doupsell(); gtot = tot; gtot += parseFloat(getValue('shippingcost')); setValue('grandtotal', currencyFormat(gtot)); pts_tot = tot; setValue('pts', parseInt(parseFloat(pts_tot))); } function validateForm() { var d = document.quoteform; str = ""; if(d.quantity.selectedIndex == 0) { str += "-Missing quantity\n"; } if (d.zip.value=="" ) { str += "-Missing zipcode\n"; } if (str != "") { alert("The following fields are missing or have errors:\n"+str); return false; } return true; } function setEditValues(){ setValue('baseprice', '0.00'); setValue('envelopeprice', '0.00'); setValue('proofprice', '0.00'); setValue('totalprice', '0.00'); }