var protval=new Array(0.1,0.0,0.2,0.1,0.1,2.9,3.2,1.8,2.2,1.8,3.8,2.8,1.7,3.7,3.3,3.6,2.9,2.9,0.9,3.6,2.5,2.0,0.2,3.6,2.7,2.7,4.6,6.3,2.8,2.0,0.4,8.3,0.7,0.0,0.0,0.5,1.3,1.6,0.3,8.3,0.7,1.6,0.3,0.3,0.3,0.3,1.8,0.1,0.0,125.3,1.3,3.3,33.5,20.6,6.8,4.2,12.7,14.9,12.8,38.4,20.3,5.8,2.6,2.8,6,3.7,4.4,22.1,24.2,74.0,8.1,9.5,16.5,24.1,43.5,3.1,39.0,14.8,32.4,9.8,11.0,1.6,46.2,14.2,6.2,7.7,46.2,32,19.3,7.4,10.8,20.5,28.3,2.9,25.3,26.9,1.3,1.2,1.6,1.3,1.6,1.4,0.7,0.6,0.6,2.3,1.2,1.1,1.2,2.6,4.4,0.6,6.0,1.7,0.9,1.1,2.7,1.6,2.1,3.5,4.4,2.4,3.0,7.1,3.4,0.9,0.4,1.5,0.9,0.7,1.2,2.6,1.4,1.8,1.3,0.7,0.1,2.2,0.2,0.8,3.6,2.0,3.6,2.3,2.3,2.7,3.9,5.0)
var carbval=new Array(2.7,9.7,0.8,2.0,1.3,21.7,34.3,30.8,30.7,30.3,28.0,19.0,32.6,28.5,28.9,33.4,47.8,42.4,18.6,28.0,19.4,39.4,7.3,24.6,37.6,20.4,41.0,0.0,1.2,0.6,0.7,12.5,1.0,0.0,0.0,0.8,1.5,1.5,29.0,25.0,23.4,1.5,90.0,0.3,0.0,50.0,25.0,1.4,0.1,30.0,1.5,15.0,12.7,101.4,56.6,35.4,82.7,38.2,38.3,97.7,41.4,54.8,8.8,16.8,37,43,5.0,91.1,37.3,149.0,32.1,59.5,19.1,26.2,0.0,0.0,0.3,17.7,0.7,0.0,22.5,0.1,0.0,25.1,4.2,7.7,0.0,0,0.1,7.3,16.0,36.2,55.9,36.5,55.0,51.9,13.3,9.0,12.5,15.0,12.5,16.3,9.0,6.0,6.1,6.9,2.3,6.6,3.6,16.7,0.9,4.9,9.7,4.7,1.0,2.7,3.0,12.0,15.7,4.0,37.5,13.8,11.7,9.8,16.4,10.0,11.6,29.3,14.4,7.8,10.9,69.8,16.4,21.1,45.0,9.6,4.2,5.8,2.4,9.6,34.0,38.3,36.9,39.2,39.6,38.3,17.2,30.4)
var calval=new Array(11.8,39.2,118.2,33.1,38.6,196.8,297.0,268.5,240.0,197.4,259.7,180.2,196.2,237.7,243.4,287.8,310.1,323.0,117.3,228.0,190.1,269.6,36.5,231.0,286.5,209.0,367.5,102.5,49.3,78.0,111.3,115.0,47.0,34.3,63.1,92.5,14.0,16.5,122.5,207.5,102.6,16.5,355.0,1.5,5.0,187.5,112.5,9.7,0.6,130.0,14.0,76.0,275.9,632.1,482.0,213.6,401.2,510.4,492.5,771.8,734.3,269.3,102.0,94.0,171,192,80.0,671.3,394.8,325.0,213.0,65.7,233.7,320.1,183.2,41.3,250.9,247.0,155.3,114.7,154.9,0.9,458.0,239.6,122.4,66.0,204.6,175,215,106.0,266.0,490.6,657.8,273.6,572.5,55.2,132.5,79.0,135.0,106.0,132.5,133.0,56.8,38.5,50.4,176.9,19.0,107.0,20.0,77.0,33.0,26.0,69.0,27.0,13.0,18.0,23.0,65.0,73.0,43.0,226.0,103.8,75.0,98.8,87.5,86.2,49.0,125.9,46.6,39.0,26.0,272.7,66.4,86.2,166.0,38.4,16.5,23.8,10.1,40.0,166.0,171.0,166.0,171.0,166.0,166.0,95.0,153.0)
var fatval=new Array(0.0,0.0,12.7,2.7,3.6,10.9,16.1,15.3,12.2,7.6,14.7,10.4,6.5,12.2,12.7,15.5,11.9,15.8,4.3,11.3,8.6,11.6,0.7,13.2,14.0,13.0,20.6,8.6,3.7,7.5,11.9,4.0,4.5,3.8,7.0,9.7,0.5,0.5,0.0,5.5,0.8,0.5,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.5,0.5,0.9,10.2,16.2,25.4,6.1,2.1,34.5,31.8,25.2,54.1,0.4,6.4,1.8,0.9,1.8,4.6,24.5,16.4,6.8,5.7,6.6,10.1,13.2,1.3,3.0,10.4,13.0,2.2,8.4,2.9,0.3,30.4,9.1,9.0,4.3,2.2,5.1,15.5,5.3,17.6,29.3,34.1,12.9,30.8,26.3,7.5,4.2,8.5,4.5,8.3,6.9,2.0,1.3,2.6,17.3,0.1,8.5,0.1,0.0,1.8,0.0,0.9,0.1,0.1,0.3,0.5,1.2,0.2,1.4,6.5,4.3,1.9,3.8,0.9,4.7,0.0,0.7,0.2,0.3,0.3,1.2,0.4,0.3,1.0,0.1,0.1,0.2,0.1,0.3,1.7,0.9,0.4,0.5,0.2,0.5,1.3,1.2)
var prottot=0
var carbtot=0
var caltot=0
var fattot=0
function calc()
{
for(i=0;i<=147;i++)
	{
	if (document.calories.elements[i].checked)
		{prottot+=protval[i]
		carbtot+=carbval[i]
		caltot+=calval[i]
		fattot+=fatval[i]
	}
prottot=Math.round(prottot*10)/10
carbtot=Math.round(carbtot*10)/10
fattot=Math.round(fattot*10)/10
var foodtot=prottot+carbtot+fattot
caltot=Math.round(caltot*10)/10
document.calcs.fat.value=(fattot)
document.calcs.cal.value=(caltot)
document.calcs.carb.value=(carbtot)
document.calcs.prot.value=(prottot)}
document.calcs.fatper.value=(Math.round(fattot/foodtot*100)+"%")
document.calcs.protper.value=(Math.round(prottot/foodtot*100)+"%")
document.calcs.carbper.value=(Math.round(carbtot/foodtot*100)+"%")
document.calcs.cal.value=caltot
document.calcs.carb.value=carbtot
document.calcs.prot.value=prottot
prottot=carbtot=caltot=fattot=0
}	
		function showSubMenu(menuId){
			if (brwsVer>=4) {
				if (curSubMenu!='') hideSubMenu();
				if (document.all) {
					eval('document.all.'+menuId).style.visibility='visible';
				} else {
					eval('document.'+menuId).visibility='show';
				}
				curSubMenu=menuId;
			}
		}
		
		function hideSubMenu(){
			if (brwsVer>=4) {
				if (document.all) {
					eval('document.all.'+curSubMenu).style.visibility='hidden';
				} else {
					eval('document.'+curSubMenu).visibility='hide';
				}
				curSubMenu='';
			}
		}
		
		var brwsVer=parseInt(navigator.appVersion);
		var timer;
		var curSubMenu='';

