var menu = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0); // holds quantity of menu items var extras = new Array(0,0,0); // holds prep cost, deliv charge, sales tax var totalitems=0; var totalmessage=""; var prep_total=0; var food_total=0; var deliv_total=0; var good_total=false; var grandtotal=0; var itemsordered=""; var itemsorderedc32=""; var code_match=false; var item_names=new Array(); var split_checked = false; var is_pickup=false; var num_item_choices = 0; function adjusttotal(dropdown) { // index is passed in with a new total. // recalculate the overall total number of items here var totalitems = 0; var item = ""; var itemvalue=0; itemsordered=""; itemsorderedc32=""; var start=0; var j=1; var a=0; if ((mode =="private")||(mode =="Private")||(mode =="group")||(mode =="Group")||(mode =="1")) { start=1; // allow for the extra form field for passcode. } for (i=start;i<27+start;i=i+2) { totalitems += parseFloat(this.document.menu.elements[i].options[this.document.menu.elements[i].selectedIndex].value); // add up the menu choices if (this.document.menu.elements[i].options[this.document.menu.elements[i].selectedIndex].value != 0) { j++; if (this.document.menu.elements[i].value != 1) { itemsordered = "(" + this.document.menu.elements[i].value + ")" + item_names[a] +"
"+ itemsordered; } else { itemsordered = item_names[a]+"
" + itemsordered; } } a++; } var totalstring=totalitems.toString(); good_total=true; if(totalitems != num_item_choices) { this.document.menu.foodtotal.value=0; this.document.menu.totalmessage.style.backgroundColor="#FFCCCC" this.document.menu.submitorder.disabled=true; this.document.menu.totalmessage.value=totalstring + " items chosen. Your total must be " + num_item_choices; good_total=false; } if(good_total) { switch (totalitems) { case 4: { food_total=99; prep_total=10; deliv_total=25; this.document.menu.totalmessage.style.backgroundColor="#00FF99" this.document.menu.totalmessage.value=totalstring + " items chosen, you may proceed with your order below."; if(split_checked) { this.document.menu.submitorder.disabled=false; } break; } case 8: { food_total=159; prep_total=20; deliv_total=25; this.document.menu.totalmessage.style.backgroundColor="#00FF99" this.document.menu.totalmessage.value=totalstring + " items chosen, you may proceed with your order below."; if(split_checked) { this.document.menu.submitorder.disabled=false; } break; } case 12: { food_total=219; prep_total=30; deliv_total=25; this.document.menu.totalmessage.style.backgroundColor="#00FF99" this.document.menu.totalmessage.value=totalstring + " items chosen, you may proceed with your order below."; if(split_checked) { this.document.menu.submitorder.disabled=false; } break; } case 144: { food_total=1; prep_total=1; deliv_total=1; this.document.menu.totalmessage.style.backgroundColor="#00FF99" this.document.menu.totalmessage.value=totalstring + " items chosen, you may proceed with your order below."; if(split_checked) { this.document.menu.submitorder.disabled=false; } break; } default: { this.document.menu.foodtotal.value=0; this.document.menu.totalmessage.style.backgroundColor="#FFCCCC" this.document.menu.submitorder.disabled=true; this.document.menu.totalmessage.value=totalstring + " items chosen. Your total must be " + num_item_choices; good_total=false; break; } } // end switch } this.document.menu.total.value=totalstring; window.status=totalstring+" items chosen so far"; if (good_total && ((mode !="private")&&(mode !="Private")&&(mode !="group")&&(mode !="Group"))) { // not private mode, good total if(split_checked) { this.document.menu.submitorder.disabled=false; } } else { // private mode, and code wrong if (((mode =="private")||(mode =="Private")||(mode =="group")||(mode =="Group")) && (this.document.menu.code.value != privatecode) && ((totalitems==8)||(totalitems==12))) { // doesn't matter if total is good. this.document.menu.totalmessage.style.backgroundColor="#FFCCCC" code_match=false; } else if (good_total){ // we've already established it's private. if(split_checked) { this.document.menu.submitorder.disabled=false; // private with good code } this.document.menu.totalmessage.style.backgroundColor="#00FF99" code_match=true; } } switch(mode){ case "Pickup": case "pickup": { this.document.menu.preptotal.value= "$"+prep_total+".00"; grandtotal=food_total+prep_total; deliv_total=0; break; } case "Delivery": case "delivery": { this.document.menu.preptotal.value="$"+prep_total+".00"; grandtotal=food_total+prep_total; break; } case "Regular": case "regular": case 0: { this.document.menu.preptotal.value="$0"; grandtotal=food_total; deliv_total=0; prep_total=0; break; } case "Group": case "group": case "Private": case "private": case 1: { this.document.menu.preptotal.value="$0"; grandtotal=food_total; deliv_total=0; prep_total=0; break; } } // end switch this.document.menu.foodtotal.value="$"+food_total+".00"; this.document.menu.grandtotal.value="$"+grandtotal+".00"; this.document.menu.date.value=date; } function adjustedittotal(orig_total) { // index is passed in with a new total. // recalculate the overall total number of items here var totalitems = 0; var item = ""; var itemvalue=0; itemsordered=""; itemsorderedc32=""; var start=0; var j=1; var a=0; if ((mode =="private")||(mode =="Private")||(mode =="group")||(mode =="Group")||(mode =="1")) { start=1; // allow for the extra form field for passcode. } // alert(mode); for (i=start,j=0;j<14;i=i+2,j++) { totalitems += parseFloat(eval("this.document.menu.Item"+j+".value")); // add up the menu choices if (parseFloat(eval("this.document.menu.Item"+j+".value")) != 0) { if (parseFloat(eval("this.document.menu.Item"+j+".value")) != 1) { itemsordered = "(" + parseFloat(eval("this.document.menu.Item"+j+".value")) + ")" + item_names[a] +"
"+ itemsordered; } else { itemsordered = item_names[a]+"
" + itemsordered; } } a++; } var totalstring=totalitems.toString(); good_total=true; num_item_choices=orig_total; if(good_total) { if(num_item_choices != totalitems) { this.document.menu.foodtotal.value=0; this.document.menu.totalmessage.style.backgroundColor="#FFCCCC"; this.document.menu.submitorder.disabled=true; this.document.menu.totalmessage.value=totalstring + " items chosen. Your total must be " + num_item_choices; good_total=false; } else { switch (totalitems) { case 4: case 8: case 12: { food_total=0; prep_total=0; deliv_total=0; this.document.menu.totalmessage.style.backgroundColor="#00FF99"; this.document.menu.totalmessage.value=totalstring + " items chosen, you may proceed with your order below."; //if(split_checked) { this.document.menu.submitorder.disabled=false; // } break; } case 144: { food_total=1; prep_total=1; deliv_total=1; this.document.menu.totalmessage.style.backgroundColor="#00FF99" this.document.menu.totalmessage.value=totalstring + " items chosen, you may proceed with your order below."; if(split_checked) { this.document.menu.submitorder.disabled=false; } break; } default: { this.document.menu.foodtotal.value=0; this.document.menu.totalmessage.style.backgroundColor="#FFCCCC"; this.document.menu.submitorder.disabled=true; this.document.menu.totalmessage.value=totalstring + " items chosen. Your total must be " + num_item_choices; good_total=false; break; } } // end switch } } //alert(this.document.menu.grandtotal.value); this.document.menu.total.value=totalstring; window.status=totalstring+" items chosen so far"; if (good_total && ((mode !="private")&&(mode !="Private")&&(mode !="group")&&(mode !="Group"))) { // not private mode, good total if(split_checked) { this.document.menu.submitorder.disabled=false; } } else { // private mode, and code wrong if (((mode =="private")||(mode =="Private")||(mode =="group")||(mode =="Group")) && (this.document.menu.code.value != privatecode) && ((totalitems==8)||(totalitems==12))) { // doesn't matter if total is good. this.document.menu.totalmessage.style.backgroundColor="#FFCCCC" ; code_match=false; } else if (good_total) { // we've already established it's private. if(split_checked) { this.document.menu.submitorder.disabled=false; } this.document.menu.totalmessage.style.backgroundColor="#00FF99"; code_match=true; } } switch(mode){ case "Pickup": case "pickup": { this.document.menu.preptotal.value= "$"+prep_total+".00"; grandtotal=food_total; deliv_total=0; break; } case "Delivery": case "delivery": { this.document.menu.preptotal.value="$"+prep_total+".00"; grandtotal=food_total; break; } case "Regular": case "regular": case 0: { this.document.menu.preptotal.value="$0"; grandtotal=food_total; deliv_total=0; prep_total=0; break; } case "Group": case "group": case "Private": case "private": case 1: { this.document.menu.preptotal.value="$0"; grandtotal=food_total; deliv_total=0; prep_total=0; break; } } // end switch this.document.menu.foodtotal.value="$"+food_total+".00"; this.document.menu.grandtotal.value="$"+grandtotal+".00"; this.document.menu.date.value=date; } function validate() { adjusttotal(); if(this.document.menu.submitorder.disabled==true) { return false; } if(this.document.menu.split_order_radio.checked == true) { split_checked=true; } if (((mode =="private")||(mode =="Private")||(mode =="group")||(mode =="Group")) && !code_match) { alert("Passcode is incorrect, please try again"); return false; } else if((split_checked==false)&&(is_pickup == true)) { alert("You must check either Split Order or Do Not Split Order"); return false; } else { this.document.menu.eventid.value=eventid; this.document.menu.eventseats.value=eventseats; this.document.menu.itemsordered.value=itemsordered; if(is_pickup == true) { if(this.document.menu.split_order_radio.checked == true) { this.document.menu.split_order = 1; } else if(this.document.menu.no_split_order_radio.checked == true) { this.document.menu.split_order = 0; } } //alert("Items "+itemsordered); return true; } return false; } function validateedit(orig_total) { adjustedittotal(orig_total); if(this.document.menu.submitorder.disabled==true) { return false; } if(this.document.menu.split_order_radio.checked == true) { split_checked=true; } if (((mode =="private")||(mode =="Private")||(mode =="group")||(mode =="Group")) && !code_match) { alert("Passcode is incorrect, please try again"); return false; } else if(split_checked==false) { alert("You must check either Split Order or Do Not Split Order"); return false; } else { this.document.menu.eventid.value=eventid; this.document.menu.eventseats.value=eventseats; this.document.menu.itemsordered.value=itemsordered; if(is_pickup == true) { if(this.document.menu.split_order_radio.checked == true) { this.document.menu.split_order = 1; } else if(this.document.menu.no_split_order_radio.checked == true) { this.document.menu.split_order = 0; } } return true; } return false; }