/* -- Geoff Henderson's GoLive CS JavaScript Library - ver 1.02 */
function ghhGetFilename () {
// The last part of the URL of the page, within which this
// function operates, is in the format "/myfilename.html".
// This function works backwards from the end until it
// locates the "/" character, thereby finding the
// string "myfilename" and then adding to it and returning
// the string "gallery/bmd_myfilename.html".
// This function is intended for use within PERSON pages in
// the root folder and then provides the URL for the linked
// BMD-file in the GALLERY subfolder.
var ghhNewName, i, j
var ghhWholeName = new String(location.href)
var ghhLen = ghhWholeName.length
i = ghhLen - 6
j = ghhLen - 5
do {
i = i - 1
ghhChar = ghhWholeName.substring(i, i + 1)
} while (ghhChar != "/")
//We now have i set to the Index position of the slash
ghhNewName = "gallery/bmd_" +ghhWholeName.substring(i + 1, j) +".html"
return ghhNewName
}

function ghhDayOfWeek() {
// The Gregorian Calendar started in England in September 1752. Assume, for this module,
// that it starts in 1753. Note that the Date Object works from c1679-c2243.
// This module works with a form called inputForm1, getting the day, month and year
// and displaying the associated day of the week in the form's DoW field. 
var Gregorian = new Boolean(true); // Set this to false to allow calculations before 1753.
var ListOfDays = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var ListOfMonths = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var LastDaysOfMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var d = document.inputForm1.day.options[document.inputForm1.day.options.selectedIndex].value;
var m = document.inputForm1.month.options[document.inputForm1.month.options.selectedIndex].value;
var y = document.inputForm1.year.value;
if (Gregorian && y < 1753) {
    alert("Cannot calculate days before 1753");
    return;
}
if (y % 4 == 0) { // Probable Leap Year, except for a few Centuries
    if (y % 100 == 0) {
        if (y % 400 == 0) { LastDaysOfMonth[1] = 29; } // Leap Year
        else { LastDaysOfMonth[1] = 28; } // Century but not Leap Year
    }
    else { LastDaysOfMonth[1] = 29; } // Not Century but still Leap Year
}
else { LastDaysOfMonth[1] = 28; } // Not Leap Year
if (d <= LastDaysOfMonth[m]) {
var calendar = new Date(y,m,d);
var DayOfWeek = calendar.getDay();
document.inputForm1.DoW.value = ListOfDays[DayOfWeek];
}
else {
alert("The date  '"+d+" "+ListOfMonths[m]+" "+y+"'  is invalid.\nCheck particularly that the day \nof the month is correct.");
   }
return ;
}

