﻿// JScript File

function calculateBMI(lang)
{
    var weight,length,bmi;
    weight = document.aspnetForm.weight.value
    length = document.aspnetForm.length.value
    
    if (length == 0 && weight == 0){
        if (lang == 'ar'){
            alert("يجب تعبئة الطول والعرض.");
        }else if (lang == 'de'){
            alert("Gewicht und Länge sollten ausgefüllt werden.");
        }else{
            alert("Weight and Length should be filled.");
        }
        return;
    }
    if (length == 0){
        if (lang == 'ar'){
            alert("الطول يجب ان يكون اكبر من صفر.");
        }else if (lang == 'de'){
            alert("Länge sollte Reibe als Null sein.");
        }else{
            alert("Length should be grater than zero.");
        }
        return;
    }
    bmi=weight/(length*length)
    document.aspnetForm.bmi.value=bmi
    return;
}

