/////////////////////////////////////////////////////////////
// creates the binary number given the values in each field
/////////////////////////////////////////////////////////////
function createMasterTime()
{
  var timeBinary = "";

        for(var i=2; i< document.dateform.dateselect.length; i++)
        {
                if (document.dateform.dateselect[i].selected)
                {
                        for(var j=2; j<document.timeform.timeselect.length; j++)
                        {
                                if(document.timeform.timeselect[j].selected)
                                        {timeBinary+="1";}
                                else
                                        {timeBinary+="0";}
                        }
                }
                else
                {timeBinary+="0000";}
        }

  timeBinary=toDec(timeBinary, '2');
  return timeBinary;
}

function createMasterPartDay()
{
 var dayBinary="";

 for(var i=2; i< document.dateform.dateselect.length; i++)
{
        if(document.dateform.dateselect[i].selected)
                {dayBinary+="1";}
        else
                {dayBinary+="0";}
}

dayBinary+="0000";
dayBinary=toDec(dayBinary, '2');
return dayBinary;
}

function createMasterPartTime()
{
var timeBinary="";

timeBinary+="0000000";

for(var j=2; j<document.timeform.timeselect.length; j++)
{
if(document.timeform.timeselect[j].selected)
        {timeBinary+="1";}
else
        {timeBinary+="0";}
}

timeBinary=toDec(timeBinary, '2');
return timeBinary;
}

function createFoodBinary()
{
  foodBinary = "";
  
  if (document.foodcat1form.breakfast.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat1form.lunch.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat1form.dinner.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.asian.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.mexican.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }  
  if (document.foodcat1form.delivery.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat1form.fastfood.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat1form.sitdown.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.burgers.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.pizza.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.seafood.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.steak.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }
  if (document.foodcat2form.subs.checked==true)
  { foodBinary += "1"; } else { foodBinary += "0"; }

  return foodBinary;
}

function createPriceBinary()
{
  priceBinary = "";
  var priceDec = "";
  for (var i = 2; i < document.priceform.priceselect.length; i++) {
    if (document.priceform.priceselect[i].selected) {
      priceBinary += "1";
    }else{
      priceBinary += "0";
    }
  }

  return priceBinary;
}

function createMasterCat()
{
  var catBinary = "";
  
  catBinary += createFoodBinary();
  catBinary += createPriceBinary();
  catBinary = toDec(catBinary, '2');
  return catBinary;
}





