/*$Author: tom $$Date: 2004/02/08 01:42:42 $$Log: common.js,v $Revision 1.1  2004/02/08 01:42:42  tom- bug fixes; calendar_nav() now resets addTrailVbar to default automaticallyRevision 1.0  2004/02/08 00:58:17  tomInitial revision*//* Copyright (C) 2003 tom rothschild for five-space studios */var start_yr = 1996;// define new Date() properties// leave commented-out: 'prototype' keyword crashes Konqueror/* * Date.prototype.getAbbrevYear = function() { * var y = String(this.getFullYear()); * // substring -- strings indices are implemented as zero-based arrays * return y.substring(2); * } */// leave commented-out: see above/* Date.prototype.getAbbrevYear = getAbbrevYear; */var date = new Date();// 4-digit yearvar cal_prefix, cal_suffix, current_yr, yyyy;yyyy = date.getFullYear();// calendar-page naming conventionscal_prefix = "tch";cal_suffix = "html";/* when calendar pages have php, change the file suffix */// cal_suffix = "php";/* default values */var addTrailVbar = false;var isCalendar = false;/* determine whether document is a calendar page and set variables    accordingly *///var url_path = document.URL;var url_path = location.pathname;// base name of the url (the file name without the path info)var base_name = url_path.substring(url_path.lastIndexOf("/") + 1);// the titlevar title = document.title;/* Attempt to determine if document is a calendar page and set    booleans */var pattern = /\d{2,4}/;// Does the file name of the page contain a 2- or 4-digit year? If the// page was called by a symlink called "programming" or somesuch, it// may not.hasYearInFileName = pattern.test(base_name);// Does the page have a year in its title?hasYearInTitle = pattern.test(title);// extract calendar year from title// Ensure all calendar pages have a four-digit, _not_ two-digit, year// in their 'title' elementsdoc_year = title.match(/\d{4}/);/* calendar_nav() writes out navigation links to the calendar pages */function calendar_nav() {    var yr, str_ent_pipe, str_current, calendar_folder;    // define the html vertical bar (pipe) entity    str_ent_pipe = "&#124;";    // path info for calendar page urls    calendar_folder = "calendar";    /* for each year, write out a link or the year with no link depending on what   page is calling this script */ for (yr = yyyy; yr >= start_yr; yr--) {     /* for non calendar pages, link to current programming gets	supplementary text around it, otherwise it's empty */     (yr == yyyy) ? str_current = "Programming" : str_current = "";     // extract last 2 digits of 4-digit year     var yy = String(yr).substring(2);     var anchor_start_tag = '<a href="' + cal_prefix + yy + "." + cal_suffix + '">';     var link_item, strNavItem;    /* TO DO: allow caller to write the pipe char after the final       calendar link if desired */     // CASE: if we're writing to calendar page     if(hasYearInTitle || hasYearInFileName) {	 // don't create an anchor link to calling document	 (doc_year == yr) ? link_item = yr : link_item = anchor_start_tag + yr + "</a>";	 // Omit the vertical bar to the final link if addTrailVbar is true	 addTrailVbar ? str_optional_vbar = " " + str_ent_pipe : str_optional_vbar = "";	 (yr != start_yr) ? strNavItem = " " + link_item + " " + str_ent_pipe : strNavItem = " " + link_item + str_optional_vbar;	 document.writeln(strNavItem);     }     // CASE: not a calendar page     // recall that str_current is null unless we're linking to current year     else {	 document.write(" " + anchor_start_tag + yr +  "</a>" + " " + str_current + " " + str_ent_pipe);     }     /* uncomment the following code when calendar pages are   moved/renamed to './calendar/YYYY.html', where YYYY is a   4-digit year */// anchor_start_tag = "<a href=" + calendar_folder + "/" + yyyy + "." + cal_suffix + "> "; } // before exiting, reset addTrailVbar to global value addTrailVbar = false;}/* handle buggy Konqueror javascript interpreter */// default valuevar is_konqueror = false;// test for konqueror and toggle boolean if(navigator.appName == "Konqueror") is_konqueror = true;function konq_support_warning() {    var str, idx, browser;// get rid of those unsightly parentheses// first, the closing paren    str = navigator.appVersion.replace(/\)/, "");// now the opening paren    str = str.replace(/\(/, "");// extract the substring that begins with 'Konqueror'    idx = str.indexOf("K");    browser = str.substring(idx);    var warning = browser + " is not fully supported by this site."  + "\nConsider disabling javascript or using a different browser here.";    return warning;}if (is_konqueror) {    alert(konq_support_warning())}/*Local Variables:mode:Ctab-stop-list: (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72)End:*/