#!/bin/sh -

made=mailto:steve@kinzler.com
sectfont='Helvetica,sans-serif'
tailfont="$sectfont"

kzbtry='./ styles/kinzb/ ../styles/kinzb/ ../../styles/kinzb/'

headextra=
case "${USER-$LOGNAME}" in
kinzler)	headextra="
<!-- Google (Universal) Analytics code per Google;
     \"ga('require'\" lines enable Display Advertiser Features
       and Enhanced Link Attribution -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-52973492-3', 'auto');
  ga('require', 'displayfeatures');
  ga('require', 'linkid', 'linkid.js');
  ga('send', 'pageview');
</script>

";;
esac

# htmlbit - output personalized, standard segments of HTML to build web pages
# Steve Kinzler, steve@kinzler.com, Dec 98
# https://kinzler.com/me/home.html#web

case "$KZB_PATH" in
'')	for path in $kzbtry
	do
		test -f "${path}kinzbtle.gif" && { KZB_PATH="$path"; break; }
	done;;
esac
case "$KZB_PATH" in
./)	KZB_PATH=;;
esac

case "$1" in
-h|'')	(echo "usage: $0 key ..."
	 echo "Path to kinzb gifs: KZB_PATH=$KZB_PATH"
	 echo Keys: | tr -d '\012'
	 sed -n 's/^#->//p' `which $0`) 1>&2; exit 1;;
esac

for key
do
	case "$key" in

#->	head		a template page head
	head)		cat <<EOF
<html><head>
<title></title>
<link rev="made" href="$made">
$headextra</head>

EOF
			true;;

#->	  headextra	extra custom content in the page head
	headextra)	echo "$headextra"; true;;

#->	body		begin a page body and section
	body)		"$0" body-kinzb sect-kinzb;;

#->	  body-kinzb	begin a page body in Kinzler Blue style
	body-kinzb)	cat <<EOF
<!-- This {body} is in the "Kinzler Blue" web page style.
     See https://kinzler.com/me/styles/kinzb/ -->
<body BGCOLOR="#3399CC" marginwidth=0 marginheight=0
   topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0
   text="#000000" link="#CC0000" alink="#FF0000" vlink="#990000">
<table width="100%" border=0 cellpadding=0 cellspacing=0>

EOF
			true;;

#->	  sect-kinzb	begin a page section in Kinzler Blue style
	sect-kinzb)	cat <<EOF
<tr><td bgcolor="#000099" colspan=6><img
      src="${KZB_PATH}bit.gif" width=1 height=9 alt=""></td></tr>

<tr><td bgcolor="#000099" rowspan=4><img
      src="${KZB_PATH}bit.gif" width=9 height=1 alt=""></td>
    <td bgcolor="#000099" valign=bottom align=right><img
      src="${KZB_PATH}kinzbtle.gif" width=9 height=9 alt=""></td>
    <td bgcolor="#99CCFF" rowspan=2 valign=top align=left><img
      src="${KZB_PATH}kinzbtls.gif" width=9 height=5 alt=""></td>
    <td bgcolor="#99CCFF" colspan=2 valign=top align=right><img
      src="${KZB_PATH}kinzbtrs.gif" width=5 height=5 alt=""></td>
    <td bgcolor="#000099" rowspan=4><img
      src="${KZB_PATH}bit.gif" width=9 height=1 alt=""></td></tr>
<tr><td bgcolor="#3399CC" rowspan=2 valign=top align=left><img
      src="${KZB_PATH}kinzbtlu.gif" width=3 height=4 alt=""></td>
    <td bgcolor="#99CCFF" width="100%">
      <font face="$sectfont">

EOF
			true;;

#->	sect		end and begin page sections
	sect)		"$0" /sect-kinzb sect-kinzb;;

#->	tail		a complete page tail
	tail)		"$0" /sect-kinzb tail-kinzb sig /tail-kinzb;;

#->	  /sect-kinzb	end a page section in Kinzler Blue style
	/sect-kinzb)	cat <<EOF
      </font></td>
    <td bgcolor="#99CCFF" rowspan=2 valign=bottom align=right><img
      src="${KZB_PATH}kinzbbrs.gif" width=9 height=5 alt=""></td></tr>
<tr><td bgcolor="#99CCFF" colspan=2 valign=bottom align=left><img
      src="${KZB_PATH}kinzbbls.gif" width=5 height=9 alt=""></td></tr>
<tr><td bgcolor="#3399CC" valign=bottom align=left><img
      src="${KZB_PATH}kinzbblu.gif" width=5 height=5 alt=""></td>
    <td bgcolor="#3399CC" colspan=3 valign=top align=right><img
      src="${KZB_PATH}kinzbbru.gif" width=13 height=9 alt=""></td></tr>

EOF
			true;;

#->	  tail-kinzb	begin a page tail in Kinzler Blue style
	tail-kinzb)	cat <<EOF
<tr><td bgcolor="#000099" colspan=6><img
      src="${KZB_PATH}bit.gif" width=1 height=4 alt=""></td></tr>
<tr><td bgcolor="#000099"><img
      src="${KZB_PATH}bit.gif" width=9 height=1 alt=""></td>
    <td bgcolor="#000099" colspan=3>
      <font face="$tailfont" color="#99CCFF">

EOF
			true;;

#->	  sig		my authoring signature
	sig)		cat <<EOF
&lt;steve<a href="https://kinzler.com/me/">@</a>kinzler.com&gt;

EOF
			true;;

#->	  /tail-kinzb	end a page tail in Kinzler Blue style
	/tail-kinzb)	cat <<EOF
      </font></td>
    <td bgcolor="#000099" valign=top align=right><a
      href="https://kinzler.com/me/styles/kinzb/"><img
        src="${KZB_PATH}kinzbabt.gif" border=0 width=9 height=9
	alt="About page style"></a></td>
    <td bgcolor="#000099"><img
      src="${KZB_PATH}bit.gif" width=9 height=1 alt=""></td></tr>
<tr><td bgcolor="#000099" colspan=6><img
      src="${KZB_PATH}bit.gif" width=1 height=5 alt=""></td></tr>

</table></body>
EOF
			true;;

	*)		echo "$0: unknown key ($key)" 1>&2;;
	esac
done
