<!--
function HS_Switch_Simple_BMI()
{
	switch (document.getElementById("current_val").value)
	{
		case "1":
			document.getElementById("simple_bmi_weight_unit_container").innerHTML = "lb";
			document.getElementById("simple_bmi_height_1_unit_container").innerHTML = "ft";
			document.getElementById("simple_bmi_height_2_container").style.display = "inline";
			document.getElementById("simple_bmi_height_2_unit_container").innerHTML = "in";
			break;
		case "2":
			document.getElementById("simple_bmi_weight_unit_container").innerHTML = "kg";
			document.getElementById("simple_bmi_height_1_unit_container").innerHTML = "cm";
			document.getElementById("simple_bmi_height_2_container").style.display = "none";
			document.getElementById("simple_bmi_height_2_unit_container").innerHTML = "";
			break;
	}
}
function HS_Unit_Convert(val1, val2, type, sys)
{
	var result = new Array();
	switch (type)
	{
		case "height":
			switch (sys)
			{
				case "metric_to_us":
					inch = val1 / 2.54;
					ft = parseInt(inch / 12);
					inch = Math.round(inch - (ft * 12));
					if (inch == 12)
					{
						ft = parseInt(ft) + 1;
						inch = 0;
					}
					result[0] = ft;
					result[1] = inch;
					break;
				case "us_to_metric":
					if (val2 == "")
					{
						val2 = 0;
					}
					cm = Math.round((parseInt(val1 * 12) + parseInt(val2)) * 2.54);
					result[0] = cm;
					result[1] = 0;
					break;
			}
			break;
		case "weight":
			switch (sys)
			{
				case "metric_to_us":
					lb = Math.round(val1 * 2.20462262);
					result[0] = lb;
					result[1] = 0;
					break;
				case "us_to_metric":
					kg = Math.round(val1 * 0.45359237);
					result[0] = kg;
					result[1] = 0;
					break;
			}
			break;
	}
	return result;
}
function HS_Detect (thisValue){
	if (document.getElementById("current_val").value != thisValue)
	{
		switch (thisValue)
		{
			case "1":
				if (document.getElementById("simple_bmi_weight").value != "")
				{
					result = HS_Unit_Convert(document.getElementById("simple_bmi_weight").value, "0", "weight", "metric_to_us");
					document.getElementById("simple_bmi_weight").value = result[0];
				}
				if (document.getElementById("simple_bmi_height_1").value != "")
				{
					result = HS_Unit_Convert(document.getElementById("simple_bmi_height_1").value, document.getElementById("simple_bmi_height_2").value, "height", "metric_to_us");
					document.getElementById("simple_bmi_height_1").value = result[0];
					document.getElementById("simple_bmi_height_2").value = result[1];
				}
				else
				{
					document.getElementById("simple_bmi_height_2").value = "";
				}
				break;
			case "2":
				if (document.getElementById("simple_bmi_weight").value != "")
				{
					result = HS_Unit_Convert(document.getElementById("simple_bmi_weight").value, "0", "weight", "us_to_metric");
					document.getElementById("simple_bmi_weight").value = result[0];
				}
				if (document.getElementById("simple_bmi_height_1").value != "")
				{
					result = HS_Unit_Convert(document.getElementById("simple_bmi_height_1").value, document.getElementById("simple_bmi_height_2").value, "height", "us_to_metric");
					document.getElementById("simple_bmi_height_1").value = result[0];
					document.getElementById("simple_bmi_height_2").value = result[1];
				}
				else
				{
					document.getElementById("simple_bmi_height_2").value = "0";
				}
				break;
		}
		document.getElementById("current_val").value = thisValue;
		HS_Switch_Simple_BMI();
	}
}
//-->