+set -f
+
+VERSION="1.0.3"
+
+function bpgallery_default_head() {
+cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>${TITLE}</title>
+ <link rel="stylesheet" href="style.css" type="text/css" />
+</head>
+<body>
+END
+}
+
+declare -rf bpgallery_default_head
+
+function bpgallery_default_description() {
+cat <<END
+ <h1>${TITLE}</h1>
+ ${DESCRIPTION}
+END
+}
+
+declare -rf bpgallery_default_description
+
+function bpgallery_default_thumbsline() {
+if [[ -z $caption ]]; then
+ caption_alt=Unknown
+else
+ caption_alt=$caption
+fi
+cat << END
+<div class="thumbnail"><a href="$link"><img src="icons/$filename" alt="$caption_alt" /></a><div class="caption">$caption</div></div>
+END
+}
+
+declare -rf bpgallery_default_thumbsline
+
+function bpgallery_default_tail() {
+cat << END
+</body>
+</html>
+END
+}
+
+declare -rf bpgallery_default_tail
+
+function bpgallery_default_stylesheet() {
+cat <<END
+body {
+ background: white;
+ color: black;
+ font-family: sans-serif;
+ font-size: 10pt;
+}
+
+div.thumbnail {
+ float: left;
+ padding: 20px;
+ border: 0px;
+ width: ${WIDTH}px;
+ height: ${MAXHEIGHT}px;
+}
+
+div.caption {
+ width: 100%;
+ text-align: center;
+ font-weight: bold;
+}
+
+div.navigation {
+ width: 100%;
+ margin: 2em;
+ text-align: center;
+}
+
+div.navigation ul {
+ width: 100%;
+ display: inline;
+ text-align: center;
+}
+
+div.navigation ul li {
+ display: inline;
+ margin: 2em;
+}
+
+a {
+ border: 0px;
+}
+
+img {
+ border: 0px;
+}
+END
+}
+
+declare -rf bpgallery_default_stylesheet
+
+function bpgallery_default_page() {
+ $BPGALLERY_HEAD_FUNCTION
+ cat <<END
+<h1>${caption}</h1>
+<div class="navigation">
+ <ul>
+ <li><a href='index.html'>Thumbnails</a></li>
+END
+ if [[ ! -z $previouspage ]]; then
+ echo "<li><a href='${previouspage}'>Previous</a></li>"
+ else
+ echo "<li>Previous</li>"
+ fi
+
+ if [[ ! -z $nextpage ]]; then
+ echo "<li><a href='${nextpage}'>Next</a></li>"
+ else
+ echo "<li>Next</li>"
+ fi
+cat <<END
+ </ul>
+</div>
+<div class="mainimage">
+ <img src="${filename}" alt="${caption}" />
+</div>
+END
+ $BPGALLERY_TAIL_FUNCTION
+}
+
+declare -rf bpgallery_default_page
+
+function bpgallery_escape_url() {
+ temp=$1
+ temp=${temp//\%/%25}
+ temp=${temp//:/%3A}
+ temp=${temp//;/%3B}
+ temp=${temp// /%20}
+ temp=${temp//$/%24}
+ temp=${temp//&/%26}
+ temp=${temp//+/%2B}
+ temp=${temp//,/%2C}
+ temp=${temp//\//%2F}
+ temp=${temp//=/%3D}
+ temp=${temp//\?/%3F}
+ temp=${temp//@/%40}
+ temp=${temp//\"/%22}
+ $ECHOCOMMAND $temp
+}
+
+declare -rf bpgallery_escape_url
+
+if [[ ! -z ${BPGALLERY_THEME} ]] ; then
+ declare -r BPGALLERY_THEME
+fi
+
+if [[ ! -z ${TITLE} ]] ; then
+ declare -r TITLE
+fi
+
+if [[ -e /usr/local/etc/bpgallery/config ]] ; then
+ . /usr/local/etc/bpgallery/config 2>/dev/null
+fi
+
+if [[ -e /etc/bpgallery/config ]] ; then
+ . /etc/bpgallery/config 2>/dev/null
+fi
+
+if [[ -e $HOME/.bpgallery.rc ]]; then
+ . $HOME/.bpgallery.rc 2>/dev/null
+fi
+
+if [[ -e $1 && -d $1 && -e $1/.bpgallery.rc ]]; then
+ . $1/.bpgallery.rc 2>/dev/null
+fi
+
+if [[ -z ${BPGALLERY_THEME} ]]; then
+ BPGALLERY_THEME=default
+fi
+
+if [[ ! -z ${BPGALLERY_THEME_DIR} ]] && \
+ [[ -e ${BPGALLERY_THEME_DIR}/${BPGALLERY_THEME} ]]; then
+ . ${BPGALLERY_THEME_DIR}/${BPGALLERY_THEME} 2>/dev/null
+elif [[ -e $HOME/.bpgallery.themes/${BPGALLERY_THEME} ]]; then
+ . $HOME/.bpgallery.themes/${BPGALLERY_THEME} 2>/dev/null
+elif [[ -e /usr/local/etc/bpgallery/themes/${BPGALLERY_THEME} ]]; then
+ . /usr/local/etc/bpgallery/themes/${BPGALLERY_THEME} 2>/dev/null
+elif [[ -e /etc/bpgallery/themes/${BPGALLERY_THEME} ]]; then
+ . /etc/bpgallery/themes/${BPGALLERY_THEME} 2>/dev/null
+fi