// these are multiply-used below
	portal        = "clubwhat";
	hostDomain    = "www.clubehcf.org";
	hostHome      = "index.html";          // for use by main site
	hostUrl       = "../" + hostHome;       // for use by sub-sites
	hostWebmaster = "webmistress@clubwhat.com";
	hostWebPerson = "Karen Smiley";
	frameWinName  = "_top";						 // added 20020807


//------------------------------------------------------------
function bookmarkPage () {

// note that document.all and window.external are "undefined" in the Firebird browser, so
// bookmarking does not work in them.	

   if(document.all) {
      window.external.AddFavorite(top.location.href,portal+" - "+document.title);
   } else {
   	alert ("We're sorry, but this method of automatic bookmarking does not work in this browser ...");
   }
}

//---------------------------------------------------------------------------------------
// Usage: writeReferrer("dlhnursery.com");

function writeReferrer (homeStr) {

	if (document.referrer) {
		if ( document.referrer.indexOf(homeStr) < 0 ) {
			// referring page is NOT one from our 'home' site; show the referral
			document.write('<font size="1"><br /><i>Thanks for visiting us from '+document.referrer+'</i></font>');
		}
	}
}

//---------------------------------------------------------------------------------------
function writeModDate () {

   document.write ('<font size="1"><i>&nbsp;Last updated:&nbsp;</i>');
	document.write (document.lastModified);
   document.write ('</font>');

}

//---------------------------------------------------------------------------------------
function writeCopy (linkText,myDomain) {

	// no copyright file written yet, uncomment this later
	document.write ('<!a href="http://'+hostDomain+'/copyright.html');			
	document.write ('" target="'+frameWinName+'">' + linkText);
	document.write ('<!/a>');
}

//---------------------------------------------------------------------------------------
function writeLink (linkText,linkLoc,targetFrame) {

	// does document.write (linkText.link(linkLoc)) work on mailto's? no way to do a target tho
	document.write ('<a href="' + linkLoc);
	if ( targetFrame != "" ) {
		document.write ('" target="' + targetFrame);
	}
	document.write ('">' + linkText + '</a>');
}

//---------------------------------------------------------------------------------------
function writeEmailLink (myDomain, myUrl, emailAddr) {  // emailaddr = xyz@name.com, myDomain=name.com

   linkLoc = 'mailto:' + emailAddr + '?subject=' + myDomain + '%20page%20' + myUrl;
   document.write ('<a href="' + linkLoc + '">' + emailAddr + '</a>');

}

//---------------------------------------------------------------------------------------
function writeMailtoLink (myDomain, emailAddr, mySubject) { // emailaddr = xyz, myDomain=name

	fullAddr = emailAddr + '@' + myDomain + '.com';
   linkLoc = 'mailto:' + fullAddr + '?subject=' + mySubject;
   document.write ('<a href="' + linkLoc + '">' + emailAddr + '</a>');

}

//---------------------------------------------------------------------------------------
function writePageAndDate (fullUrl,targetFrame) {

//	fullUrl=location.href;
   document.write ('<font size="1"><br /><i>Page:&nbsp;&nbsp;</i>');
   writeLink (fullUrl, fullUrl, targetFrame);
   document.writeln ('</font>');

   writeModDate();
}

//---------------------------------------------------------------------------------------
// Usage: writeFooter ("StargazerPhotos","sitemap.html");
function writeFooter (myPortal,myUrl) {

	fullDomain = "http://" + hostDomain;
	fullUrl = fullDomain + "/" + myUrl;
	
	myhostUrl="../";  // assume we are starting from a subsite and need to go at least 1 level
	for ( i=0; i< myUrl.length; i++ ) {
		if ( myUrl.charAt(i) == "/" )  myhostUrl += "../";
	}
	myhostUrl += hostHome;
//	alert ("myhostUrl=" + myhostUrl + " for " + fullUrl);

// haven't got one at the moment ...
//	document.write ('<font size="1">View our <a href="./privacy.html" target="'+frameWinName+'">privacy policy</a>. </font>');

   document.write ('<font size="1">Questions or comments? Email us at ');
	writeEmailLink (myPortal, myUrl, hostWebmaster);
   document.write ('</font>');

	document.write ('<br /><font size="1">All text &amp; images ');
	writeCopy ("&copy", hostDomain);
   document.write (' 1998-2009 <a href="mailto:' + hostWebmaster + '">' + hostWebPerson + '</a>/');
   writeLink (myPortal, fullDomain+"/"+hostHome,frameWinName);  
   document.write (' except as noted. ');
   writeCopy ("All rights reserved.", myPortal);
   document.writeln ('&nbsp;</font>');

	writePageAndDate (fullUrl,frameWinName);
}

//---------------------------------------------------------------------------------------
function hostFooter(myUrl) {

	fullDomain = "http://" + hostDomain;
	fullUrl = fullDomain + "/" + myUrl;

	document.write ('<font size="1">All text &amp; images ');
	writeCopy ("&copy;", hostDomain);
   document.write ('1998-2009 <a href="mailto:' + hostWebmaster + '">' + hostWebPerson + '</a>/');
	document.write (portal.link(hostUrl));
   document.write (' except as noted. ');
   writeCopy ("All rights reserved.", hostDomain);
   document.writeln ('&nbsp;</font>');
   
   document.write ('<br><font size="1">Please send questions or comments on this ');
	document.write (portal.link(hostUrl));
   document.write (' website to ');
	writeEmailLink (hostDomain, myUrl, hostWebmaster);
   document.write ('</font>');

	writePageAndDate (fullUrl,"_blank");
}

