﻿function selectNew(newId)
{
    var allLinks = new Array();
    allLinks[0]='balanceddiet';
    allLinks[1]='developinganutritionprogram';
    allLinks[2]='dailynutrienttips';
    allLinks[3]='healthysnacking';
    allLinks[4]='foodpyramid';
    allLinks[5]='controlcalorieintake';
    allLinks[6]='bephysicallyactive';
    allLinks[7]='choosewisely';
    allLinks[8]='keepfoodsafetoeat';
    allLinks[9]='alcohol';
    allLinks[10]='bmi';
    allLinks[11]='beverages';
    allLinks[12]='bakedandbreakfastgoods';
    allLinks[13]='dinners';
    allLinks[14]='desserts';
    allLinks[15]='soups';
    allLinks[16]='flavoringtips';
    allLinks[17]='aerobicexercises';
    allLinks[18]='flexibilityexercises';
    allLinks[19]='resistanceexercises';
    
    var allContent = new Array();
    for(x in allLinks)
    {
        allContent[x]='content'+allLinks[x];
    }
        
    for(x in allLinks)
    {
        try
        {
            document.getElementById(allLinks[x]).className='';
            document.getElementById(allContent[x]).className='invisible';
        }
        catch(err)
        {
        }

    }
    
    
    document.getElementById(newId).className='selected';
    document.getElementById('content'+newId).className='visible';
}


function FigureBMI(form, feet, inches, pounds, standard, metric)
{  
    if(feet=="" || inches=="" || pounds=="")
    {
        alert("Please Fill In All The Fields For The BMI Calculator");
        return;
    }

    if(standard)
    {
        totalinches = eval(feet*12) + eval(inches);
        form.calcval.value=Math.round((pounds/(totalinches*totalinches))*703*100)/100;
    }
    else if(metric)
    {
        var meter=eval(feet);
        var cm=eval(inches);
        var kilos=eval(pounds);
        var totalcm=(meter*100) + cm;
        var bmi=kilos/(totalcm*totalcm)*10000;
        form.calcval.value=Math.round(bmi*100)/100;        
    }
    else
    {
        return;
    }
}

function custRound(x,places)
{
    return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
}

function recipe(recipeURL)
{
    window.open(recipeURL,'','scrollbars=yes,menubar=no,height=748,width=450,resizable=no,toolbar=no,location=no,status=no');
}