You would be better off doing this server side (PHP), rather than client side (javascript). For example, you could define your function by using a plugin hooked at "forumhome_start" with the code:
PHP Code:
function fHcountHits($num)
{
switch ($num)
{
case ($num > 1000000000):
$num = round($num/1000000000, 1);
$num .= 'G';
break;
case ($num > 1000000):
$num = round($num/1000000, 1);
$num .= 'M';
break;
case ($num > 1000):
$num = round($num/1000, 1);
$num .= 'K';
break;
}
return $num;
}
And then, create another plugin, this one hooked at "forumbit_display" with the code:
PHP Code:
$forum['threadcount'] = fHcountHits($forum['threadcount']);
$forum['replycount'] = fHcountHits($forum['replycount']);