// $Revision: 1.1 $ $Date: 2008-05-06 20:56:20 $

var pages=new Array(
    'Welcome',
    'St Mary Redcliffe',
    'Bristol',
    'William Canynges',
    'Thomas Chatterton',
    'Membership',
    'Links'
);

var urls=new Array(
    'index.html',
    'redcliffe.html',
    'bristol.html',
    'canynges.html',
    'chatterton.html',
    'membership.html',
    'links.html'
);

function DisplaySelection(page) {

    document.write('<table width="100%" class="main">');
    document.write('<tr><td colspan=2>');
    document.write('<img src="heading.jpg" alt="The Canynges Society, Supporting the Fabric of St Mary Redcliffe Church">');
    document.write('</td></tr>');
    document.write('<tr><td>');
    document.write('<table class="navigation">');
    var i;
    for (i = 0; i < pages.length; i = i + 1) {
        if (page === pages[i]) {
            document.write('<tr><th>' + pages[i] + '</th></tr>');
        }
        else {
            document.write('<tr><td><a class="selection" href="' + urls[i] + '" target=_top>' + pages[i] + '</a></td></tr>');
        }
    }
    document.write('</table>');
    document.write('</td><td>');
}

function Suffix(day) {
    if ((day === '1') || (day === '21') || (day === '31')) {
        return 'st';
    }
    if ((day === '2') || (day === '22')) {
        return 'nd';
    }
    if ((day === '3') || (day === '23')) {
        return 'rd';
    }
    return 'th';
}

function Name(month) {
    if (month === '01') {
        return 'January';
    }
    if (month === '02') {
        return 'February';
    }
    if (month === '03') {
        return 'March';
    }
    if (month === '04') {
        return 'April';
    }
    if (month === '05') {
        return 'May';
    }
    if (month === '06') {
        return 'June';
    }
    if (month === '07') {
        return 'July';
    }
    if (month === '08') {
        return 'August';
    }
    if (month === '09') {
        return 'September';
    }
    if (month === '10') {
        return 'October';
    }
    if (month === '11') {
        return 'November';
    }
    return 'December';
}

function UpdatedOn(date) {
    var day = (date[15] === '0') ? date.substr(16, 1) : date.substr(15, 2);
    var month = date.substr(12, 2);
    var year = date.substr(7, 4);
    return 'Updated: ' + day + '<sup>' + Suffix(day) + '</sup> ' + Name(month) + ' ' + year;
}

var copyright = '&copy; The Canynges Society<br>Registered charity in England and Wales number 242231';
var validate = '<a href="http://validator.w3.org/check?uri=referer">W3C Validation</a>';

function DisplayFoot(date) {
    document.write('</td></tr>');
    document.write('</table>');
    document.write('<hr>');
    document.write('<table width="100%" class="foot">');
    document.write('<tr><td class="left">' + UpdatedOn(date) + '</td>');
    document.write('<td class="centre">' + copyright + '</td>');
    document.write('<td class="right">' + validate + '</td></tr>');
    document.write('</table>');
}

