﻿jQuery(document).ready(function () {

    $('li.othetf').mouseover(function () {




        var ids = "#" + $(this).attr('rel');
        var ids2 = "#" + $(this).attr('rel') + " ul li";

        if ($(ids2).length == 0) {
            $('#menu>ul li .submenu').hide();
            return;
        }


        if ($(ids).css("display") == "none") {

            var ww = $(this).css("width");

           // $(ids).css("min-width", "180px");

            $(ids).css("display", "table");
            $(ids).slideDown("fast");
        }


    });


    $('li.othetf').mouseleave(function () {

        $('#menu>ul li .submenu').slideUp("fast");

    });


    $('#btnvki').click(function () {

        var kilo = $("#txtkilo").val();
        var boy = $("#txtboy").val();

        if (kilo == "" || boy == "")
            return;

        yourbmi = (bmi(kilo, boy / 100));

        yourbmi = Math.round(yourbmi);

        var txt = "";

        if (yourbmi < 18) {
            $("#calcReturnimg").addClass("m1");
            txt = "Zayıf";
        }

        if (yourbmi >= 18 && yourbmi <= 25) {
            $("#calcReturnimg").addClass("m2");
            txt = "Normal";
        }

        if (yourbmi > 25 && yourbmi < 30) {
            $("#calcReturnimg").addClass("m3");
            txt = "Kilolu";
        }

        if (yourbmi >= 30 && yourbmi < 40) {
            $("#calcReturnimg").addClass("m4a");
            txt = "Obez";
        }

        if (yourbmi >= 40 && yourbmi < 50) {
            $("#calcReturnimg").addClass("m4b");
            txt = "Morbid Obez";
        }

        if (yourbmi >= 50) {
            $("#calcReturnimg").addClass("m4");
            txt = "Süper Morbid Obez";
        }

        $("#calcReturntext").html("<strong>VKİ:</strong> " + yourbmi + " kg/m<sup>2</sup></br></br><label>" + txt + "</label>");

        $('#calcArea').hide();
        $('#calcReturn').show();

    });





});


function bmi(weight, height) {

    bmindx = weight / eval(height * height);

    return bmindx;

}
