function ccBM_bmi_calc(lbs, ins)
{
	var f = document.forms.ccBM_bmiForm;
	var w_v = f.w_v.value*1;
	var w_u = f.w_u.options[f.w_u.selectedIndex].value;
	var h_ft = f.h_ft.options[f.h_ft.selectedIndex].value;
	var h_in = f.h_in.options[f.h_in.selectedIndex].value;
	var h_v = f.h_v.value*1;
	var h_u = f.h_u.options[f.h_u.selectedIndex].value;
	var err = '';
	if(!w_v || (w_v<35 || w_v>600)) { err += 'Вредноста за тежина е невалидна.'+"\n"; }
	if(h_v) {
		if(!ccBM_is_n(h_v)) { err += 'Висината мора да биде изразена со бројки.'+"\n"; }
		if(h_ft || f.h_in.selectedIndex>0) { err += 'Please choose only one method for height (ft+in, OR inches/cm).'; }
	} else {
		if(!ccBM_is_n(h_ft) || f.h_in.selectedIndex==0) { err += 'Вредноста за висина е невалидна.'; }
	}
	if(err) { alert(err); return false; }
	if(w_u=='kg') { w_v *= 2.20462262; }
	if(h_v) {
		if(h_u=='cm') { h_v *= 0.393700787; }
	} else {
		h_v = (h_ft*12) + (1*h_in);
	}
	var bmi = Math.round( (w_v/(h_v*h_v))*703*10 )/10;
	var txt = '';
	if(bmi<16.5) { txt = 'екстремно низок'; }
	else if(bmi>=16.5 && bmi<18.5) { txt = 'под нормалниот'; }
	else if(bmi>=18.5 && bmi<25) { txt = 'нормален'; }
	else if(bmi>=25 && bmi<30) { txt = 'прекумерен'; }
	else { txt = 'екстремно висок'; }
	txt = 'Вашиот индекс на телесна <br>маса изнесува '+bmi+' и е <br><b>'+txt+'</b>.';
	document.getElementById('ccBM_lyr_bmi').innerHTML = txt;
}
function ccBM_is_n(n)
{
	if( isNaN(n) || n==null || n.length==0 ) { return false; }
	n=n+"";
	if( n.search(/\s+/)!=-1 ) { return false; }
	return true;
}
if( document.layers && !document.getElementById ) {
	document.write( 'Sorry, to view the BMI calculator you must use a newer browser.<p />');
} else {
if(typeof(ccBM_ttl)=='undefined') { var ccBM_ttl = 1; }
document.write(
'<form style="margin:0px" name="ccBM_bmiForm" onsubmit="ccBM_bmi_calc();return false;">',
'<div align="left" style="font-family:arial,helvetica,sans-serif;font-size:12px;">',
'<b style="font-family:arial,helvetica,sans-serif;color:#000000">',

'Пресметајте го Вашиот <br/>индекс на телесна маса</b></div>',
'<div align="left" style="font-family:arial,helvetica,sans-serif;font-size:12px;">',
'Тежина: <input type="text" name="w_v" value="" size="2" style="width:40px;margin-top:3px;" />&nbsp;',
'<select name="w_u" style="margin-top:10px;">',
	'<option value="kg">kg</option>',
	'<option value="lbs">lbs</option>',
'</select><br />',
'Висина: <select name="h_ft" style="margin-top:10px; display:none;">',
	'<option value=""></option>',
'</select>',
'<select name="h_in" style="margin-top:10px; display:none;">',
	'<option value=""></option>',
'</select>',
'<input type="text" name="h_v" value="" size="2" style="width:40px;margin-top:2px;margin-left:2px;" />&nbsp;',
'<select name="h_u" style="margin-top:2px;">',
	'<option value="cm">cm</option>',
	'<option value="in">in.</option>',	
'</select>',
'</div>',
'<input type="button" class="button" style="width:140px;margin-top:10px;" name="" value="Пресметај" onclick="ccBM_bmi_calc()" />',
'<div style="width:300px;"><div id="ccBM_lyr_bmi" style="padding:5px;margin-top:7px;font-family:arial,helvetica,sans-serif;font-size:12px;color:#000000;font-style:bold;color:#ef2f72;"><br><br></div></div>',
'</form>'
);
}
