function isnum(what){

name = document.forms.menubuilder;

checker = what.value;

if (isNaN(checker*1 )){
alert("Please enter only numbers in the box");
what.value = "";
}
}

function CheckMain() {
named = document.forms.menubuilder.BBQ.length;
name = document.forms.menubuilder.BBQ;

txt = ""

for (i = 0; i < named; i++) {
if (document.forms.menubuilder.BBQ[i].checked) {
txt = txt + document.forms.menubuilder.BBQ[i].value + "|"
}
}

if (txt == "") {
document.forms.menubuilder.bmeals.value="No barbeque meals selected";
}
else {
document.forms.menubuilder.bmeals.value=txt;
}
}

function KeepB(box) {
named = document.forms.menubuilder.BBQ.length;
name = document.forms.menubuilder.BBQ;

txt = 0

for (i = 0; i < named; i++) {
if (document.forms.menubuilder.BBQ[i].checked) {
txt = txt + 1
}
}

if (txt == 4) {
alert("Pick just three please. If you wish to add another item you must uncheck a previously selected item.")
box.checked = false;
}
}

function CheckSalad() {
named = document.forms.menubuilder.salad.length;
name = document.forms.menubuilder.salad;

txt = ""

for (i = 0; i < named; i++) {
if (document.forms.menubuilder.salad[i].checked) {
txt = txt + document.forms.menubuilder.salad[i].value + "|"
}
}

if (txt == "") {
document.forms.menubuilder.smeals.value="No salads selected";
}
else {
document.forms.menubuilder.smeals.value=txt;
}
}

function KeepC(box) {
named = document.forms.menubuilder.salad.length;
name = document.forms.menubuilder.salad;

txt = 0

for (i = 0; i < named; i++) {
if (document.forms.menubuilder.salad[i].checked) {
txt = txt + 1
}
}

if (txt == 4) {
alert("Pick just three please. If you wish to add another item you must uncheck a previously selected item.")
box.checked = false;
}
}

function trim(str) {
	return str.replace(/^\s+|\s+$/g,"");
}

function vnum(what){

if (isNaN(what*1 )){
return false;
}else{
return what;
}
}

function theSubmission(){
CheckMain();
CheckSalad();
}

function isEmpty(what){
	if(what==""||what==null||what.charAt(0)==''){
        return false;
	}
}

function eValidate() {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(document.forms.quote.email.value) == false) {
      alert('Invalid Email Address');
      document.forms.quote.email.focus();
      document.forms.quote.email.value="";
      return false;
   }

   ab=document.forms.quote.name.value;
   bc=document.forms.quote.telephone.value;
   cd=document.forms.quote.location.value;
   xy=document.forms.quote.mobile.value;
   ef="Name";
   fg="Telephone or Mobile";
   gh="Location";

   if(isEmpty(ab)==false){
   txt = "The " + ef + " field is mandatory";
   alert(txt);
   return false;
   }
   if(isEmpty(bc,fg)==false && isEmpty(xy,fg)==false){
   txt = "The " + fg + " field is mandatory";
   alert(txt);
   return false;
   }
   if(isEmpty(cd,gh)==false){
   txt = "The " + gh + " field is mandatory";
   alert(txt);
   return false;
   }
}

function eValidate2() {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(document.forms.quote.email.value) == false) {
      alert('Invalid Email Address');
      document.forms.quote.email.focus();
      document.forms.quote.email.value="";
      return false;
   }

   ab=document.forms.quote.name.value;
   ef="Name";

   if(isEmpty(ab)==false){
   txt = "The " + ef + " field is mandatory";
   alert(txt);
   return false;
   }
}