/*!
 * Menu animations and caloric needs calculator
 */

$(document).ready(function()
{

$("ul.menu-list li").hover(
        function()
        {
	        $(this).stop().animate({color: "#000000", backgroundColor: "#747AE2"}, 1500);
		
                var liID = $(this).attr("id");
                //$(liID + " a").stop().animate({color: "#000000"}, 1500);
                //alert (liID);
                $("#sub-" + liID).fadeIn("slow");
        },
        function()
        {
            	$(this).stop().animate({color: "#999999", backgroundColor: "#000000"}, 1500);
	        var liID = $(this).attr("id");
       		//alert (liID);
	        $(liID + " a").stop().animate({color: "#999999"}, 1500);
        	$("#sub-" + liID).fadeOut("slow");
        }
    );

    var instanceOne = new ImageFlow();
    instanceOne.init({ ImageFlowID: 'myImageFlow' });

});
/*
domReady(function()
{
    var instanceOne = new ImageFlow();
    instanceOne.init({ ImageFlowID: 'myImageFlow' });
});
*/
function CaloricNeedsCalc()
{
    var gender_value = $('input[name=gender]:checked').val();
    
    var height_feet = $('#HeightFeet').val(); //document.CaloricNeedsForm.HeightFeet.value;
    var height_inches = $('#HeightInches').val(); //document.CaloricNeedsForm.HeightInches.value;
    var weight_lbs = $('#WeightLbs').val(); //document.CaloricNeedsForm.WeightLbs.value;
    var years_of_age = $('#YearsAge').val(); //document.CaloricNeedsForm.YearsAge.value;
    var activity_index = $('#ActivityLevel').val(); //document.CaloricNeedsForm.ActivityLevel.value;

    if( weight_lbs == '' || years_of_age == '')
    {
        alert("Please enter numbers for both weight and age.");
    }
    else
    {
        var total_inches = parseInt(height_feet * 12) + parseInt(height_inches);
        var centimeters = total_inches * 2.54;
        var kilograms = weight_lbs/2.2;
        if(gender_value = 'female')
        { // Female calculation values
            var adjust_weight = 655 + (9.6 * kilograms);
            var adjust_height = 1.7 * centimeters;
            var adjust_age = 4.7 * years_of_age;
        }
        else
        { // Male calculation values
            var adjust_weight = 66 + (13.7 * kilograms);
            var adjust_height = 5 * centimeters;
            var adjust_age = 6.8 * years_of_age;
        }

        calories_maintain = Math.ceil((adjust_weight + adjust_height - adjust_age) * activity_index);
        $("#Calories").val(calories_maintain);

    }

}