function ending(number, one, two, five)
{
var ending;
number = number % 100;
if ((number > 4 && number < 21) || number == 0)
{
ending = five;
}
else
{
var last_digit = substr(number, -1);
if (last_digit > 1 && last_digit < 5)
{
ending = two;
}
else
{
if (last_digit == 1)
ending = one;
else
ending = five;
}
}
return ending;
}