var aryFormItemNames = new Array(); var aryItemCost = new Array(); var aryWeights = new Array(); aryFormItemNames[0] = 'quantity_regular_1lb'; aryItemCost[0] = 2.00; aryWeights[0] = 1; aryFormItemNames[1] = 'quantity_regular_2lb'; aryItemCost[1] = 3.50; aryWeights[1] = 2; aryFormItemNames[2] = 'quantity_regular_5lb'; aryItemCost[2] = 8.00; aryWeights[2] = 5; aryFormItemNames[3] = 'quantity_cajun_1lb'; aryItemCost[3] = 2.00; aryWeights[3] = 1; aryFormItemNames[4] = 'quantity_cajun_2lb'; aryItemCost[4] = 3.50; aryWeights[4] = 2; aryFormItemNames[5] = 'quantity_cajun_5lb'; aryItemCost[5] = 8.00; aryWeights[5] = 5; aryFormItemNames[6] = 'quantity_jalapeno_1lb'; aryItemCost[6] = 2.00; aryWeights[6] = 1; aryFormItemNames[7] = 'quantity_jalapeno_2lb'; aryItemCost[7] = 3.50; aryWeights[7] = 2; aryFormItemNames[8] = 'quantity_jalapeno_5lb'; aryItemCost[8] = 8.00; aryWeights[8] = 5; aryFormItemNames[9] = 'quantity_institutional_regular'; aryItemCost[9] = 20.00; aryWeights[9] = 30; aryFormItemNames[10] = 'quantity_easyopen_regular'; aryItemCost[10] = 30.00; aryWeights[10] = 24; aryFormItemNames[11] = 'quantity_institutional_cajun'; aryItemCost[11] = 20.00; aryWeights[11] = 30; aryFormItemNames[12] = 'quantity_easyopen_cajun'; aryItemCost[12] = 30.00; aryWeights[12] = 24; aryFormItemNames[13] = 'quantity_institutional_jalapeno'; aryItemCost[13] = 20.00; aryWeights[13] = 30; aryFormItemNames[14] = 'quantity_easyopen_jalapeno'; aryItemCost[14] = 30.00; aryWeights[14] = 24; aryFormItemNames[15] = 'quantity_pinkvanilla'; aryItemCost[15] = 16.00; aryWeights[15] = 4.25; aryFormItemNames[16] = 'quantity_blueraspberry'; aryItemCost[16] = 16.00; aryWeights[16] = 4.25; aryFormItemNames[17] = 'quantity_sourapple'; aryItemCost[17] = 16.00; aryWeights[17] = 4.25; aryFormItemNames[18] = 'quantity_sourbanana'; aryItemCost[18] = 16.00; aryWeights[18] = 4.25; aryFormItemNames[19] = 'quantity_grape'; aryItemCost[19] = 16.00; aryWeights[19] = 4.25; aryFormItemNames[20] = 'quantity_varietypack'; aryItemCost[20] = 20.00; aryWeights[20] = 8.0625; aryFormItemNames[21] = 'quantity_carmelcorn'; aryItemCost[21] = 24.00; aryWeights[21] = 9.125; aryFormItemNames[22] = 'quantity_kettlecorn_ranch'; aryItemCost[22] = 24.00; aryWeights[22] = 4.9375; aryFormItemNames[23] = 'quantity_kettlecorn_choc_marsh'; aryItemCost[23] = 24.00; aryWeights[23] = 4.9375; aryFormItemNames[24] = 'quantity_kettlecorn_jalapeno'; aryItemCost[24] = 24.00; aryWeights[24] = 4.9375; aryFormItemNames[25] = 'quantity_kettlecorn_whitecheddar'; aryItemCost[25] = 24.00; aryWeights[25] = 4.9375; aryFormItemNames[26] = 'quantity_salted_peanuts_shell'; aryItemCost[26] = 24.00; aryWeights[26] = 11.0625; aryFormItemNames[27] = 'quantity_salted_peanuts_cajun'; aryItemCost[27] = 24.00; aryWeights[27] = 11.0625; function replaceIfEmpty(field, value) { var o = document.form1[field]; if(o) { if(o.value == null || o.value.length == 0 ) { o.value = value; } } } function checkContactInfo() { calcit(); var n = document.form1.contact_name.value; var a = document.form1.contact_address.value; var c = document.form1.contact_city.value; var s = document.form1.contact_state.value; var z = document.form1.contact_zip_code.value; var ce = document.form1.contact_email_confirm.value; var e = document.form1.contact_email.value; if(n!=null && a!=null && c!=null && s!=null && z!=null) { if(n.length > 0 && a.length > 0 && c.length > 0 && s.length > 0 && z.length > 0) { if(e!=ce) { alert('The email addresses you entered do not match. Please enter the correct email address in both fields.'); document.form1.contact_email.focus(); return false; } else { replaceIfEmpty('shipping_name', n); replaceIfEmpty('shipping_address', a); replaceIfEmpty('shipping_city', c); replaceIfEmpty('shipping_state', s); replaceIfEmpty('shipping_zip_code', z); return true; } } } if(isNaN(document.form1.subTotal.value) || document.form1.subTotal.value==null || document.form1.subTotal.value==0) { alert('You must order at least 1 item.'); return false; } alert('Your name, email address, street address, city, state and zip code are required for ordering. '); return false; } function calcit() { var x = 0; var q = 0; var section1Weight = 0.00; var section1TotalCost = 0.00; var section2TotalCost = 0.00; var section2Weight = 0.00; var section3ItemCount = 0; var section3TotalCost = 0.00; var section3Weight = 0.00; var dvsor = 0; var section2ItemBCount=0, section2ItemACount = 0; for(x=0;x 0) { if(x < 9) { tempWeight = q * aryWeights[x]; section1Weight+=tempWeight; section1TotalCost+= ( q * aryItemCost[x]); document.form1['calc_'+x].value = makeMoney(q * aryItemCost[x]); } else if(x > 8 && x < 15 ) { //section2Weight+= (q * aryWeights[x]); dvsor = (x%2==0?24:4); section2Weight+= q * (aryWeights[x]/dvsor); section2TotalCost+= q * (aryItemCost[x]/ dvsor); if(dvsor == 4) { section2ItemACount+=q; } else { section2ItemBCount+=q; } //section2TotalCost+= (q * aryItemCost[x]); document.form1['calc_'+x].value = makeMoney(q * (aryItemCost[x] / dvsor) ); } else if(x==20) { //section3ItemCount+=q; document.form1['calc_'+x].value = makeMoney(q * (aryItemCost[x])); section3TotalCost+= (q * (aryItemCost[x])); section3Weight+= (q * ( aryWeights[x])); } else { section3ItemCount+=q; document.form1['calc_'+x].value = makeMoney(q * (aryItemCost[x]/16)); section3TotalCost+= (q * (aryItemCost[x]/16)); section3Weight+= (q * ( aryWeights[x]/16)); } } } } if(section2ItemACount+section2ItemBCount > 0) { if(section2ItemACount % 4 > 0) { alert('When ordering Canned Boiled Peanuts total quantities for the 60 oz cans must be in multiples of 4.'); return false; } if(section2ItemBCount % 24 > 0) { alert('When ordering Canned Boiled Peanuts total quantities for the 7.3 oz cans must be in multiples of 24.'); return false; } } if(section3ItemCount > 0 && (section3ItemCount < 16 || section3ItemCount % 16 != 0)) { alert('Variety Pack Products must have a minimum quantity of 16 (1 case) and the total quantity must be a multiple of 16 (i.e. 16, 32, 48...).'); return false; } /*if(section1Weight > 20 ) { alert('You may order a maximum of 20 lbs of Bagged Frozen Boiled Peanuts in a single order.'); return false; }*/ document.form1.subTotal.value = makeMoney(section1TotalCost + section2TotalCost + section3TotalCost); document.form1.shipWeight_a.value = section1Weight; document.form1.shipWeight_b.value = section2Weight+section3Weight; // 0 - 8 TOTAL WEIGHT CAN NOT EXCEED 20lbs // 9 - 14 No Rules // 15 - 27 Must be a product of 16 ; Pricing has to be calced by item-cost } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i 4) { da++ ; } return aryTemp[0].toString() + '.' + da.toString(); }