var bIsMSIE = (navigator.userAgent.indexOf("MSIE") != -1);
var bIsFirefox = (navigator.userAgent.indexOf("Firefox") != -1);
var sAllowedExtra = " abcdefghij";
var bOnThisPage = false;
var bTTLB = false;
var bLocalHardDrive = false;

var dteCookieExpire = null;
var sYDDBlogaround = null, bYDDBlogaround = true;	// cookie
var sYDDOpenNew = null, bYDDOpenNew = true;			// cookie

var aryRecentDogLinkLabels;
var aryRecentDogURLs;
var aryRecentDogDescrips;

function WriteOneNavEntry(sMonthAbbrev, sMonthName, sMM, sYYYY, bFileExists, nCurrMonth, nCurrYear, sThis, sMaxExtra) {
	var nMM = 0 + sMM;
	var nYYYY = 0 + sYYYY;
	var sYY = sYYYY.substr(2,2);
	var sDisplay = "&nbsp;", sPageDisplay="";
	var sThisExtra = "";
	var nExtras = sAllowedExtra.length;
	var sExtra;
	if (sThis.length > 6) {
		// allow for, e.g., sThis = "200301a"
		sThisExtra = sThis.substr(6);
		sThis = sThis.substr(0,6);
	}
	if ( (nYYYY>nCurrYear) || (nYYYY==nCurrYear && nMM>nCurrMonth) ) {
		// a month later than current month: gray dummy
		sDisplay = sDisplay + "<font color=\"gray\">" + sMonthAbbrev + " " + sYY + "</font>&nbsp;|\n";
	} else if (bFileExists) {
		for (var iExtra=0; iExtra<nExtras; iExtra++) {
			sExtra = sAllowedExtra.charAt(iExtra);
			if (sExtra==" ") {
				sExtra = "";
			}
			if (sExtra>sMaxExtra) {
				break;
			}
			sPageDisplay = (sExtra!="" ? sExtra : sMonthAbbrev + " " + sYY);
			if (sYYYY+sMM==sThis && sThisExtra==sExtra) {
				// the current month, and we are on that page: red dummy
				sDisplay = sDisplay + "<font color=\"red\">" + sPageDisplay + "</font>&nbsp;";;
			}
			else {
				// an earlier month (or current month, earlier page) for which a file exists: actual link
				sDisplay = sDisplay + "<a href=\"./doggerel_" + sYYYY + sMM + sExtra + ".htm\">" + sPageDisplay + "</a>&nbsp;";
			}
		}
		sDisplay = sDisplay + "|\n";
	} else {
		// an earlier month for which a file does not exist: alert link
		sDisplay = sDisplay + "<a href=\"JavaScript:alert('No doggerel was posted in " + sMonthName + "');\">" + sMonthAbbrev + " " + sYY + "</a>&nbsp;|\n";
	}
	document.write(sDisplay);
}

var bShowArchiveLinks; bShowArchiveLinks = false;

function WriteNavBar(sPrev, sThis, sNext) {
	// MODIFIED 12/2003: place archive at bottom only, all of it, link from top nav to archive anchor.
	var dteNow = new Date();
	var nCurrMonth = dteNow.getMonth() + 1;
	var nCurrYear = dteNow.getYear();

	if (nCurrYear<1000) { nCurrYear = nCurrYear + 2000 - 100; }

	document.write("<font size=1>\n");

	document.write("|\n");
	if (sPrev != '') {
		document.write("&nbsp;<a href=\"./doggerel_" + sPrev + ".htm\">PREVIOUS</a>&nbsp;|\n");
	} else {
		document.write("&nbsp;<font color=\"gray\">PREVIOUS</font>&nbsp;|\n");
	}
	document.write("&nbsp;<a target=\"_top\" href=\"http://www.yellowdoggereldemocrat.org/\">HOME</a>&nbsp;|\n");
	if (sNext != '') {
		document.write("&nbsp;<a href=\"./doggerel_" + sNext + ".htm\">NEXT</a>&nbsp;|\n");
	} else {
		document.write("&nbsp;<font color=\"gray\">NEXT</font>&nbsp;|\n");
	}
	document.write("&nbsp;<a href=\"./doggerel_index.htm\">" + "INDEX" + "</a>&nbsp;|\n");
	if ((bIsMSIE || bIsFirefox) && bOnThisPage) {
		document.write("&nbsp;<a href=\"#PAGEINDEX\">" + "RECENT POSTS" + "</a>&nbsp;|\n");
	}
	document.write("&nbsp;<a href=\"#BLOGROLL\">" + "LINKS" + "</a>&nbsp;|\n"); // was doggerel_links.htm, retired
	// document.write("&nbsp;<a title=\"How to Write Doggerel (400k WAV)\" href=\"./images/HowToWriteDoggerel2.wav\">" + "VOICE" + "</a>&nbsp;|\n");
	document.write("&nbsp;<a href=\"./aboutydd.htm\">" + "ABOUT" + "</a>&nbsp;|\n");
	document.write("&nbsp;<a href=\"./privacy.htm\">" + "PRIVACY" + "</a>&nbsp;|\n");
	document.write("&nbsp;<a href=\"./contact.htm\">" + "CONTACT" + "</a>&nbsp;|\n");
//	document.write("&nbsp;<a href=\"./yddstatus.htm\">" + "STATUS" + "</a>&nbsp;|\n");
	// following link is set at runtime from the current page

	document.write("&nbsp;<a name=\"NavBarPhotoLink\" id=\"NavBarPhotoLink\" href=\".\" title=\"Photos\" target=_blank>" + "<!-- font color=red -->PHOTOS<!-- /font -->" + "</a>&nbsp;|\n");
	document.write("&nbsp;<a href=\"#ARCHIVES\">" + "ARCHIVES" + "</a>&nbsp;|\n");
	document.write("&nbsp;<a href=\"./classics.htm\">" + "CLASSICS" + "</a>&nbsp;|\n");
	document.write("<br>")

	if (bShowArchiveLinks) {
		document.write("<a name='ARCHIVES'></a>");
		document.write("<br><font size=1 color=blue>YELLOW DOGGEREL DEMOCRAT ARCHIVES:</font><br><br>")
//		if (sThis > "200101" && sThis <= "200201") {
			document.write("|\n");
			WriteOneNavEntry('Oct', 'October', '10', '2001', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Nov', 'November', '11', '2001', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Dec', 'December', '12', '2001', true, nCurrMonth, nCurrYear, sThis, "");
			document.write("<br>");
//		}
//		if (sThis > "200107" && sThis <= "200207") {
			document.write("|\n");
			WriteOneNavEntry('Jan', 'January', '01', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Feb', 'February', '02', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Mar', 'March', '03', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Apr', 'April', '04', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('May', 'May', '05', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Jun', 'June', '06', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			document.write("<br>");
//		}
//		if (sThis > "200201" && sThis <= "200301") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Aug', 'August', '08', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Sep', 'September', '09', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Oct', 'October', '10', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Nov', 'November', '11', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Dec', 'December', '12', '2002', true, nCurrMonth, nCurrYear, sThis, "");
			document.write("<br>")
//		}
//		if (sThis > "200207" && sThis <= "200307") {
			document.write("|\n");
			WriteOneNavEntry('Jan', 'January', '01', '2003', true, nCurrMonth, nCurrYear, sThis, "c");
			WriteOneNavEntry('Feb', 'February', '02', '2003', true, nCurrMonth, nCurrYear, sThis, "c");
			WriteOneNavEntry('Mar', 'March', '03', '2003', true, nCurrMonth, nCurrYear, sThis, "d");
			WriteOneNavEntry('Apr', 'April', '04', '2003', true, nCurrMonth, nCurrYear, sThis, "d");
			WriteOneNavEntry('May', 'May', '05', '2003', true, nCurrMonth, nCurrYear, sThis, "d");
			WriteOneNavEntry('Jun', 'June', '06', '2003', true, nCurrMonth, nCurrYear, sThis, "c");
			document.write("<br>")
//		}
//		if (sThis > "200301" && sThis <= "200401") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2003', true, nCurrMonth, nCurrYear, sThis, "c");
			WriteOneNavEntry('Aug', 'August', '08', '2003', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Sep', 'September', '09', '2003', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Oct', 'October', '10', '2003', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Nov', 'November', '11', '2003', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Dec', 'December', '12', '2003', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200307" && sThis <= "200407") {
			document.write("|\n");
			WriteOneNavEntry('Jan', 'January', '01', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Feb', 'February', '02', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Mar', 'March', '03', '2004', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Apr', 'April', '04', '2004', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('May', 'May', '05', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Jun', 'June', '06', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200401" && sThis <= "200501") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Aug', 'August', '08', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Sep', 'September', '09', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Oct', 'October', '10', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Nov', 'November', '11', '2004', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Dec', 'December', '12', '2004', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200407" && sThis <= "200507") {
			document.write("|\n");
			WriteOneNavEntry('Jan', 'January', '01', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Feb', 'February', '02', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Mar', 'March', '03', '2005', true, nCurrMonth, nCurrYear, sThis, "c");
			WriteOneNavEntry('Apr', 'April', '04', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('May', 'May', '05', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Jun', 'June', '06', '2005', true, nCurrMonth, nCurrYear, sThis, "d");
			document.write("<br>")
//		}
//		if (sThis > "200501" && sThis <= "200601") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Aug', 'August', '08', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Sep', 'September', '09', '2005', true, nCurrMonth, nCurrYear, sThis, "c");
			WriteOneNavEntry('Oct', 'October', '10', '2005', true, nCurrMonth, nCurrYear, sThis, "d");
			WriteOneNavEntry('Nov', 'November', '11', '2005', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Dec', 'December', '12', '2005', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200507" && sThis <= "200607") {
			document.write("|\n");
			WriteOneNavEntry('Jan', 'January', '01', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Feb', 'February', '02', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Mar', 'March', '03', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Apr', 'April', '04', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('May', 'May', '05', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Jun', 'June', '06', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			document.write("<br>")
//		}
//		if (sThis > "200601" && sThis <= "200701") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Aug', 'August', '08', '2006', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Sep', 'September', '09', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Oct', 'October', '10', '2006', true, nCurrMonth, nCurrYear, sThis, "b");
			WriteOneNavEntry('Nov', 'November', '11', '2006', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Dec', 'December', '12', '2006', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200701" && sThis <= "200801") {
			WriteOneNavEntry('Jan', 'January', '01', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Feb', 'February', '02', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Mar', 'March', '03', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Apr', 'April', '04', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('May', 'May', '05', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Jun', 'June', '06', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200701" && sThis <= "200801") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Aug', 'August', '08', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Sep', 'September', '09', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Oct', 'October', '10', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Nov', 'November', '11', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Dec', 'December', '12', '2007', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200801" && sThis <= "200901") {
			WriteOneNavEntry('Jan', 'January', '01', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Feb', 'February', '02', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Mar', 'March', '03', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Apr', 'April', '04', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('May', 'May', '05', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Jun', 'June', '06', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200801" && sThis <= "200901") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Aug', 'August', '08', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Sep', 'September', '09', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Oct', 'October', '10', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Nov', 'November', '11', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Dec', 'December', '12', '2008', true, nCurrMonth, nCurrYear, sThis, "a");
			document.write("<br>")
//		}
//		if (sThis > "200801" && sThis <= "200901") {
			WriteOneNavEntry('Jan', 'January', '01', '2009', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Feb', 'February', '02', '2009', true, nCurrMonth, nCurrYear, sThis, "a");
			WriteOneNavEntry('Mar', 'March', '03', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Apr', 'April', '04', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('May', 'May', '05', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Jun', 'June', '06', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			document.write("<br>")
//		}
//		if (sThis > "200801" && sThis <= "200901") {
			document.write("|\n");
			WriteOneNavEntry('Jul', 'July', '07', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Aug', 'August', '08', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Sep', 'September', '09', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Oct', 'October', '10', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Nov', 'November', '11', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			WriteOneNavEntry('Dec', 'December', '12', '2009', true, nCurrMonth, nCurrYear, sThis, "");
			document.write("<br>")
//		}
		// write other years here as needed

		// leave space so archive anchor travels to proper position
		for (var iLine=0; iLine<32; iLine++) {
			document.write("<br>");
		}
	}
	bShowArchiveLinks  = true;	// show only at the bottom

	document.write("</font>\n")
}

function SetNavBarPhotoLink(sHref, sTitle) {
	var theLink = document.getElementById("NavBarPhotoLink");
	if (theLink) {
		theLink.href = sHref;
		theLink.title = sTitle;
	}
}

function OpenAllLinksInNewWindow(bNewWindow)
{
	var iLink, sHostName;
	for (iLink=0; iLink<document.links.length; iLink++) {
		// be sure we affect only offsite links
		sHostName = document.links[iLink].hostname;
		if (sHostName != '' && sHostName != 'www.yellowdoggereldemocrat.org' && sHostName.substr(0,8) != 'HaloScan') {
			if (bNewWindow) {
				document.links[iLink].target = '_blank';
			}
			else {
				document.links[iLink].target = '_top';
			}
		}
	}

	SetYDDOpenNew(bNewWindow);

}

function ShowHideTopTable(bShow) {
	var toptable;
	if (!document.getElementById) {
		return;
	}
	toptable = document.getElementById("toptable");
	if (toptable) {
		toptable.style.display = (bShow ? "" : "none");
	}
	SetYDDBlogaround(bShow);
}

function StandardBodyOnLoad() {
	var showhide,opennew;

	if (document.marquee1 && document.marquee1.marqueetext) {
		ScrollMarquee();
	}
	if (!document.getElementById) {
		return;
	}

	InitYDDCookies();
	showhide = document.getElementById("chkShowHideTopTable");
	if (showhide) {
		// alert('bYDDBlogaround=' + bYDDBlogaround);
		showhide.checked = bYDDBlogaround;
		ShowHideTopTable(bYDDBlogaround);
	}

	opennew = document.getElementById("chkOpenInNewWindow");
	if (opennew) {
		// alert('bYDDOpenNew=' + bYDDOpenNew);
		opennew.checked = bYDDOpenNew;
		OpenAllLinksInNewWindow(bYDDOpenNew);
	}

    SetNavBarPhotoLink('http://sbates.nfshost.com/ydd/images/','View slideshows of a few of my snapshots.');

	self.focus();
}

function WideScreenVersion() {
	try {
		var ct = document.getElementById("contenttable");
		if (ct) {
			if (screen.width >= 1000) {
				ct.width="1000";
			} else {
				ct.width="750";
			}
		}
	} catch(e) {
		alert('here');
	}
}

// credit: following originally after Brykman, Windows Magazine

var cScrollMarqueeScroll = 0;
var cScrollMarqueeSwapChars = 1;
var cScrollMarqueeChangeCase = 2;
var cScrollMarqueeChangeBkgd = 3;
var cScrollMarqueeFadeIn = 4;
var cScrollMarqueeBehaviorCount = 5;
var cScrollMarqueeBehavior = -1; // set to one of the above

if (bIsMSIE) {
	cScrollMarqueeBehavior = (((new Date()).getHours()) % cScrollMarqueeBehaviorCount);	// change every hour
}

var nScrollSpeed = 50;
var nScrollChars = 1;
var iTimesScrolled = 0, nTimesToScroll = 2;
var iCharsScrolled = 0, nCharsToScroll;
var bgc = new Array(8);
bgc[0] = ""
bgc[1] = "red";
bgc[2] = "orange";
bgc[3] = "yellow";
bgc[4] = "green";
bgc[5] = "blue";
bgc[6] = "indigo";
bgc[7] = "violet";
var nFGRed = 0xff;
var nFGGreen = 0xff;
var nFGBlue = 0xe0;
var nFGColor;

function ScrollMarquee() {
	var iChar,sChar;
	var msg,newmsg;

//	too many problems -- take out the flashy stuff
return;

	// background-changing version only
	if (cScrollMarqueeBehavior == cScrollMarqueeChangeBkgd) {
		if (!document.marquee1.marqueetext.style) {
			return;
		}
		nTimesToScroll = 1;
		if (bgc[0]=="") {
			bgc[0] = document.marquee1.marqueetext.style.background;
		}
	}

	msg = document.marquee1.marqueetext.value;
	nCharsToScroll = msg.length;

	// count and exit mechanism is same for all
	iCharsScrolled++;
	if (iCharsScrolled > nCharsToScroll) {
		iCharsScrolled = 1; // because we're going to scroll anyway
		iTimesScrolled++;
		if (iTimesScrolled >= nTimesToScroll) {
			document.marquee1.marqueetext.style.background = bgc[0];
			return;
		}
	}
	window.setTimeout('ScrollMarquee()',nScrollSpeed);

	if (cScrollMarqueeBehavior == cScrollMarqueeScroll) {
		document.marquee1.marqueetext.value = msg.substring(nScrollChars) + msg.substring(0,nScrollChars);
	} else if (cScrollMarqueeBehavior==cScrollMarqueeSwapChars) {
		for (iChar=0; iChar<nCharsToScroll; iChar+=2) {
			msg = msg.substring(0,iChar) + msg.substring(iChar+1,iChar+2) + msg.substring(iChar,iChar+1) + msg.substring(iChar+2,msg.length);
			document.marquee1.marqueetext.value = msg;
		}
	} else if (cScrollMarqueeBehavior == cScrollMarqueeChangeCase) {
		newmsg = "";
		for (iChar=0; iChar<nCharsToScroll; iChar++) {
			sChar = msg.substring(iChar,iChar+1);
			if ("A" <= sChar && sChar <= "Z") {
				sChar = sChar.toLowerCase();
			} else {
				sChar = sChar.toUpperCase();
			}
			newmsg = newmsg + sChar;
		}
		document.marquee1.marqueetext.value = newmsg;
		nTimesToScroll = 1;
	} else if (cScrollMarqueeBehavior == cScrollMarqueeChangeBkgd) {
		document.marquee1.marqueetext.style.background = bgc[iCharsScrolled % 8];
	} else if (cScrollMarqueeBehavior == cScrollMarqueeFadeIn) {
		if (nFGRed > 0xf0) {
			nFGRed -= 0x04;
			if (nFGRed < 0xf0) {
				nFGRed = 0xf0;
			}
		}
		if (nFGGreen > 0xc0) {
			nFGGreen -= 0x04;
			if (nFGGreen < 0xc0) {
				nFGGreen = 0xc0;
			}
		}
		if (nFGBlue > 0x00) {
			nFGBlue -= 0x04;
			if (nFGBlue < 0x00) {
				nFGBlue = 0x00;
			}
		}
		nFGColor = nFGRed * 0x10000 + nFGGreen * 0x100 + nFGBlue;
		document.marquee1.marqueetext.style.color = "#" + nFGColor.toString(16);
	}
}

function WriteBlogDoggerel(sText) {
//	if (bIsMSIE) {
//		document.write ("<input type=text size=12 name='marqueetext' value='" + sText + "' style='font: 28pt \"Comic Sans MS\",Arial,sans-serif; background:#ffffe0; color:#F0C000; border:none;'>");
//	}
//	else {
		document.write ("<font size=6>" + sText + "</font>");
//	}
}

function WriteThisPageEntryLinks() {
	var iLink=0, sLinks="", sTarget="", sMyMarker="", sHash="", sTitle="";
	var sFlagText="", bFoundDog = false;
	if (!bIsMSIE) {
		document.write("(Available in IE browsers.)");
		return;
	}
	for (iLink=0; iLink<document.links.length; iLink++) {
		sTarget = document.links[iLink].target;
		sMyMarker = document.links[iLink].mymarker;
		sHash = document.links[iLink].hash;
		sTitle = document.links[iLink].title;
		if (sTitle.charAt(0) == " ") {
			sFlagText = " <font color=red><b>&deg;</b></font>";
			bFoundDog = true;
		} else {
			sFlagText = "";
		}
		if (sTarget == "_top" && sMyMarker != "noshow" && sTitle != "") {
			sLinks = sLinks + "<a href=" + sHash + "><nobr>" + sTitle + "</nobr></a>"+ sFlagText + "<br>";
		}
	}
	if (bFoundDog) {
		sLinks = sLinks + "<br><font color=red><b>&deg;</b> doggerel</font><br>";
	}
	document.write(sLinks);
}

function WriteThisPageEntryLinksAllowBreaks() {
	var iLink=0, sLinks="", sTarget="", sMyMarker="", sHash="", sTitle="";
	var sFlagText="", bFoundDog = false;
	sTitle = ""; // avoid breakage in NS4
	if (!(bIsMSIE || bIsFirefox)) {
		document.write("(Available in IE and Firefox browsers.)");
		return;
	}
	for (iLink=0; iLink<document.links.length; iLink++) {
		sTarget = document.links[iLink].target;
		sMyMarker = ("" + document.links[iLink].name).substring(0,6);	// Firefox doesn't recognize inline added properties, so we use the name
		sHash = document.links[iLink].hash;
		sTitle = document.links[iLink].title;
		if (sTitle.charAt(0) == " ") {
			sFlagText = " <font color=red><b>&deg;</b></font>";
			bFoundDog = true;
		} else {
			sFlagText = "";
		}
		if (sTarget == "_top" && sMyMarker != "noshow" && sTitle != "") {
			// sLinks = sLinks + "<a href=" + sHash + ">" + sTitle + "</a>"+ sFlagText + "<br><br>";
			sLinks = sLinks + "&deg;&nbsp;" + "<a href=" + sHash + ">" + sTitle + "</a>" + sFlagText + "<br>";
		}
	}
	if (bFoundDog) {
		sLinks = sLinks + "<br><font color=red><b>&deg;</b> doggerel</font><br>";
	}
	document.write(sLinks);
}

function InitRecentDogs(nHowMany) {
	switch (nHowMany) {
		case 5:
			aryRecentDogLinkLabels = new Array("LATEST","FIVE","DOGS","ARE","HERE");
			break;
		case 10:
			aryRecentDogLinkLabels = new Array("LATEST","TEN","DOGGERELS","MAY","BE","VIEWED","BY","CLICKING","THESE","LINKS");
			break;
	}
	aryRecentDogURLs = new Array(nHowMany);
	aryRecentDogDescrips = new Array(nHowMany);
}

function SpecifyOneRecentDog(iWhich,sURL,sDescrip) {
	aryRecentDogURLs[iWhich] = sURL;
	aryRecentDogDescrips[iWhich] = sDescrip;
}

function WriteRecentDogs(nHowMany) {
	document.write("<font size=1>|");
	for (var iWhich=0; iWhich<nHowMany; iWhich++) {
//		document.write("&nbsp;<a target=_top mymarker=noshow title=\"" + aryRecentDogDescrips[iWhich] + "\" href=\"" + aryRecentDogURLs[iWhich] + "\">" + aryRecentDogLinkLabels[iWhich] + "</a>&nbsp;|");
		document.write("&nbsp;<a target=_top name=noshow" + iWhich + " title=\"" + aryRecentDogDescrips[iWhich] + "\" href=\"" + aryRecentDogURLs[iWhich] + "\">" + aryRecentDogLinkLabels[iWhich] + "</a>&nbsp;|");
	}
	document.write("<br></font>");
}

function Write5RecentDogs(u0,d0, u1,d1, u2,d2, u3,d3, u4,d4) {
	InitRecentDogs(5);
	SpecifyOneRecentDog(0,u0,d0);
	SpecifyOneRecentDog(1,u1,d1);
	SpecifyOneRecentDog(2,u2,d2);
	SpecifyOneRecentDog(3,u3,d3);
	SpecifyOneRecentDog(4,u4,d4);
	WriteRecentDogs(5);
}

function Write10RecentDogs(u0,d0, u1,d1, u2,d2, u3,d3, u4,d4, u5,d5, u6,d6, u7,d7, u8,d8, u9,d9) {
	InitRecentDogs(10);
	SpecifyOneRecentDog(0,u0,d0);
	SpecifyOneRecentDog(1,u1,d1);
	SpecifyOneRecentDog(2,u2,d2);
	SpecifyOneRecentDog(3,u3,d3);
	SpecifyOneRecentDog(4,u4,d4);
	SpecifyOneRecentDog(5,u5,d5);
	SpecifyOneRecentDog(6,u6,d6);
	SpecifyOneRecentDog(7,u7,d7);
	SpecifyOneRecentDog(8,u8,d8);
	SpecifyOneRecentDog(9,u9,d9);
	WriteRecentDogs(10);
}

var sInstructionsMsg = 'HaloScan commenting no longer works on this site. If you need comments to a specific post, please email me the blog post date-time in the form \"yyyymmddhhnn\" and I will email you the comment from my archives. Apologies for the inconvenience. Please direct all complaints to JS-Kit.com ...';
function fakeHaloScan(x) { alert(sInstructionsMsg); };
function fakepostCount(x) { document.write('<span class=\"haloscript\">(Click for instructions)</span>'); };
function fakeHaloScanTB(x) { alert(sInstructionsMsg); };
function fakepostCountTB(x) { document.write('<span class=\"haloscript\">(Click for instructions)</span>'); };

function MyHaloScanAdaptations() {
	bLocalHardDrive = (document.URL.substring(0,5) == 'file:');
//	if (typeof HaloScan == 'undefined') {	//	|| bLocalHardDrive == true
	if (true) {
//		function fakeHaloScan(x) { alert('Sorry, HaloScan commenting is not working at this time.'); };
		HaloScan = fakeHaloScan;
	}
//	if (typeof postCount == 'undefined') {	//	|| bLocalHardDrive == true
	if (true) {
		postCount = fakepostCount;
	}
//	if (typeof HaloScanTB == 'undefined') {	//	|| bLocalHardDrive == true
	if (true) {
//		function fakeHaloScanTB(x) { alert('Sorry, HaloScan trackback is not working at this time.'); };
		HaloScanTB = fakeHaloScanTB;
	}
//	if (typeof postCountTB == 'undefined') {	//	|| bLocalHardDrive == true
	if (true) {
		postCountTB = fakepostCountTB;
	}
}

var DayOfWeek = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");

function BlogTimeDisplay(sDateTime) {
	var s = parseInt(sDateTime.substr(4,2),10) + '/' + parseInt(sDateTime.substr(6,2),10) + '/' + sDateTime.substr(0,4) + ' ' + sDateTime.substr(8,2) + ':' + sDateTime.substr(10,2);
	var d = new Date(s);
	var dw = DayOfWeek[d.getDay()];
//	var ofs = (d.getTimezoneOffset ? d.getTimezoneOffset() : 0); // oops, that's client-side! figure out later...
	var ofs = 0;
	document.write(dw + ' ' + s + ' ' + (ofs==360 ? 'CST' : ofs==300 ? 'CDT' : 'CT'));
}

// *** Bill Dortch's cookie functions

//
//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
//

//******************************************************************
//
// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!  See example at the end of this document.
//
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//
//  Function to return the value of the cookie specified by "name".
//    name - String object containing the cookie name.
//    returns - String object containing the cookie value, or null if
//      the cookie does not exist.
//
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
//
//  Function to create or update a cookie.
//    name - String object containing the cookie name.
//    value - String object containing the cookie value.  May contain
//      any valid string characters.
//    [expires] - Date object containing the expiration data of the cookie.  If
//      omitted or null, expires the cookie at the end of the current session.
//    [path] - String object indicating the path for which the cookie is valid.
//      If omitted or null, uses the path of the calling document.
//    [domain] - String object indicating the domain for which the cookie is
//      valid.  If omitted or null, uses the domain of the calling document.
//    [secure] - Boolean (true/false) value indicating whether cookie transmission
//      requires a secure channel (HTTPS).
//
//  The first two parameters are required.  The others, if supplied, must
//  be passed in the order listed above.  To omit an unused optional field,
//  use null as a place holder.  For example, to call SetCookie using name,
//  value and path, you would code:
//
//      SetCookie ("myCookieName", "myCookieValue", null, "/");
//
//  Note that trailing omitted parameters do not require a placeholder.
//
//  To set a secure cookie for path "/myPath", that expires after the
//  current session, you might code:
//
//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//  Function to delete a cookie. (Sets expiration date to start of epoch)
//    name -   String object containing the cookie name
//    path -   String object containing the path of the cookie to delete.  This MUST
//             be the same as the path used to create the cookie, or null/omitted if
//             no path was specified when creating the cookie.
//    domain - String object containing the domain of the cookie to delete.  This MUST
//             be the same as the domain used to create the cookie, or null/omitted if
//             no domain was specified when creating the cookie.
//
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// *** End of Bill Dortch's cookie functions

function InitYDDCookies() {
	dteCookieExpire = new Date();
	FixCookieDate(dteCookieExpire);
	dteCookieExpire.setTime(dteCookieExpire.getTime() + (31 * 24 * 60 * 60 * 1000));	// 1 month

	sYDDBlogaround = GetCookie("YDDBlogaround");
	// alert('get YDDBlogaround=' + sYDDBlogaround);
	if (sYDDBlogaround == null) {
		sYDDBlogaround = "1";
	}
	bYDDBlogaround = (sYDDBlogaround == "1");
	SetYDDBlogaround(bYDDBlogaround);

	sYDDOpenNew = GetCookie("YDDOpenNew");
	// alert('get YDDOpenNew=' + sYDDOpenNew);
	if (sYDDOpenNew == null) {
		sYDDOpenNew = "1";
	}
	bYDDOpenNew = (sYDDOpenNew == "1");
	SetYDDOpenNew(bYDDOpenNew);
}

function SetYDDBlogaround(bShow) {
	bYDDBlogaround = bShow;
	sYDDBlogaround = (bShow ? "1" : "0");
	SetCookie("YDDBlogaround", sYDDBlogaround, dteCookieExpire);
	// alert('set YDDBlogaround=' + sYDDBlogaround);
}

function SetYDDOpenNew(bNew) {
	bYDDOpenNew = bNew;
	sYDDOpenNew = (bNew ? "1" : "0");
	SetCookie("YDDOpenNew", sYDDOpenNew, dteCookieExpire);
	// alert('set YDDOpenNew=' + sYDDOpenNew);
}

function shortCount(sCommentID) {
	var hs_search = new RegExp('\\W','gi');
	var sID = sCommentID.replace(hs_search,"_");
	var sText = (hs && hs[sID] ? hs[sID] : "!!")
	document.write(sText=="0" || sText=="1" ? "!!" : sText);
}

function drawBlogrollAlphaIndex() {
	var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//	var decdigits = "0123456789";	// may need this someday!
	var decdigits = "";				// (for now)
	var alnum = alpha + decdigits;
	var s = "";
	var ch = "A", i;

	for (i=0; i<alnum.length; i++) {
		ch = alnum.charAt(i);
		s = s + "<a href=\"#blogroll" + ch + "\">" + ch + "</a>&nbsp;&nbsp;"
	}
	s = "<a href=\"#Bloglines\">BLOGROLL</a>&nbsp;&nbsp;" + s + "<br>";
	document.write(s);
}
