// Copyright (C) 2001  SJS Solutions Ltd
//
// takes an integer as argument and returns the string: integer + one of
// ("th","st","nd","rd") as appropriate for the number.
//
// e.g.  1 -> "1st"
//      11 -> "11th"
//      21 -> "21st"
//
// NB: works for the english language only (of course)

function make_ordinal(n) 
{
    y = n % 100
    z = n % 10

    if ((y >= 10 && y <= 19) || z == 0 || z > 3) {
        return n + "th"
    } else if (z == 1) {
        return n + "st"
    } else if (z == 2) {
        return n + "nd"
    } else if (z == 3) {
        return n + "rd"
    }
}
