
var revisionDate = "2010-04-11";

var bookCount = 0;
var leftImage = false;
var imgString = "";
var adPlacement = false;

if (top.location != location) top.location.href = location.href;	// escape from frames

function popWin(dis,h,w) {
	window.open(dis.href,dis.target,"height=" + h + ",width=" + w + ",top=" + (screen.height-h)/2 + ",left=" + (screen.width-w)/2 + ",scrollbars=1").focus();
	return false;
}

function checkEmailAddress(field) {
    if (field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi)) return true;
    else {
        alert('Please enter a valid e-mail address.');
        field.focus();
        field.select();
        return false;
}   }

function tellAFriend() {
    if (checkEmailAddress(document.eMailer.email)) window.location = "mailto:" + document.eMailer.email.value + "?subject=A Great Site for Biking Literature&body=Hi...%0A%0AI thought you would be interested in \"BikeLit\", a great site on motorcycling and bicycling literature: http://www.bikelit.com/%0A%0A";
}

function PlaceAdBooks() {
    CloseBook();   // close book left open
    adPlacement = true;
    google_ad_client = "pub-2852904351999801";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    google_ad_channel = "";
    google_color_border = "FAFAFA";
    google_color_bg = "FAFAFA";
    google_color_link = "000000";
    google_color_text = "000000";
    google_color_url = "286EA0";
    document.write('<p><table id="bookpanel"><tr><td>');
}

function PlaceAdImage() {
    google_ad_client = "pub-2852904351999801";
    google_ad_width = 120;
    google_ad_height = 600;
    google_ad_format = "120x600_as";
    google_ad_type = "image";
    google_ad_channel = "";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "000000";
    google_color_text = "000000";
    google_color_url = "286EA0";
    document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}

function PlaceLinks() {
    google_ad_client = "pub-2852904351999801";
    google_alternate_color = "FFFFFF";
    google_ad_width = 468;
    google_ad_height = 15;
    google_ad_format = "468x15_0ads_al";
    google_ad_channel = "";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "000066";
    google_color_text = "000000";
    google_color_url = "8A8A8A";
    document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}

function PlaceSearch() {
    document.write('<span class="small"><p>Can\'t find what you want? Try a Google search:</span>');
    document.write('<form method="get" action="http://www.google.com/custom" target="google_window"><table bgcolor="#dddddd"><tr><td nowrap="nowrap" valign="top" align="left" height="32"><a href="http://www.google.com/"><img src="http://www.google.com/logos/Logo_25gry.gif" border="0" alt="Google" align="middle"></img></a><br/><input type="text" name="q" size="31" maxlength="255" value=""></input><input type="submit" name="sa" value="Search"></input><input type="hidden" name="client" value="pub-2852904351999801"></input><input type="hidden" name="forid" value="1"></input><input type="hidden" name="ie" value="ISO-8859-1"></input><input type="hidden" name="oe" value="ISO-8859-1"></input><input type="hidden" name="cof" value="GALT:#8A8A8A;GL:1;DIV:#FF3366;VLC:000066;AH:center;BGC:DDDDDD;LBGC:DDDDDD;ALC:339999;LC:339999;T:000000;GFNT:666666;GIMP:666666;LH:31;LW:100;L:http://www.onebag.com/images/searchlogo.gif;S:http://;LP:1;FORID:1;"></input></td></tr></table></form>');
    document.write('</p>');
}

function PlaceTellFriend() {
    document.write('<p class="small">Help spread the word! Tell a friend about this site:</p><p><form name="eMailer"><input type="text" name="email" size="27" value="   Enter E-Mail Address Here" onfocus="this.value=\'\'"><input type="button" value="Send E-Mail" onclick="tellAFriend();"></form></p>');
}

function CloseBook() {  // close book left open by PlaceBook(...)
    document.write('</td>');
    if (leftImage = !leftImage) document.write(imgString);    // place (saved) image to right of body
    document.write('</tr></table>');
}

function PlaceBook(authorS, authorG, title, isbn, optImage) {
    if (adPlacement) {
        adPlacement = false;
        document.write('</td></tr></table></p>');
    } else if (bookCount++) CloseBook();   // close book left open
    document.write('<a name="' + authorS + '">&nbsp;</a>'); // place anchor
    if (authorS.charAt(authorS.length - 2) == ".") authorS = authorS.substr(0,authorS.length - 2);  // remove suffix
    imgString = '<td>' + (isbn ? '<a href="http://www.amazon.com/dp/' + isbn + '/?tag=thecompleatcarry" target="_blank">' : '') + '<img border="0" src="' + (optImage ? optImage : 'http://images.amazon.com/images/P/' + isbn + '.01._AA_SCMZZZZZZZ_.jpg') + '">' + (isbn ? '</a>' : '') + '</td>';
    document.write('<p><b>' + authorS + ', ' + authorG + ' &nbsp;::&nbsp; ' + title + '</b></p><table id="bookpanel"><tr>');
    if (leftImage) document.write(imgString);   // place image to left of body
    document.write('<td valign="top">');
}

function PlaceFooter(lastWords) {    // common HTML for page bottoms
    if (bookCount) {
        CloseBook();    // close book left open
        document.write('<p class="textright"><em>' + bookCount + ' books are listed on this page.</em></p>');
    }
    if (lastWords) document.write('<p>' + lastWords + '</p>');
	document.write('</div><div id="footer">Copyright 2007–2010, Doug Dyment. All rights reserved. &nbsp;::&nbsp; revised ' + revisionDate + ' &nbsp;::&nbsp; site by <a href="http://www.webtechnics.com/" title="Webtechnics.com" target="_blank">Webtechnics</a></div></div>');
    if (bookCount) {
        document.writeln('<script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=thecompleatcarry"></script>');
        document.writeln('<noscript><img src="http://www.assoc-amazon.com/s/noscript?tag=thecompleatcarry" alt="" /></noscript>');
}   }

