

//Use the following variable to specify 
//the number of random words

var NoofWhen = 32

var when = new BuildArray(NoofWhen)

//Use the following variables to 
//define your random words:

when[0] = "Your Choice"
when[1] = "in summer"
when[2] = "in winter"
when[3] = "in autumn"
when[4] = "in spring"
when[5] = "early one morning"
when[6] = "late one afternoon"
when[7] = "one evening"
when[8] = "at the weekend"
when[9] = "on a Monday"
when[10] = "on a Tuesday"
when[11] = "on a Wednesday"
when[12] = "on a Thursday"
when[13] = "on a Friday"
when[14] = "on a Saturday"
when[15] = "on a Sunday"
when[16] = "in the future"
when[17] = "in the present"
when[18] = "in the past"
when[19] = "last year"
when[20] = "this year"
when[21] = "next year"
when[22] = "in childhood"
when[23] = "at night"
when[24] = "during the day"
when[25] = "Bank Holiday"
when[26] = "Christmas"
when[27] = "Easter"
when[28] = "New Year"
when[29] = "Halloween"
when[30] = "in retirement"
when[31] = "early one evening"
when[32] = "late one evening"

function BuildArray(size){
    this.length = size
    for (var i = 1; i <= size; i++){
        this[i] = null}
    return this
}

function PickRandomWhen(frm) {
    // Generate a random number between 1 and NoofWhen
    var rnd = Math.ceil(Math.random() * NoofWhen)

    // Display the word inside the text box
    frm.WhenBox.value = when[rnd]
}

