// Copyright 2003 David Ethan Kennerly
// Published 2003-03-17
// For permission to copy contact me.

var Search = 0;

function QueryTitle(ThisTitle) {
	var link;

	if (Search == "0")
		link = "http://www.google.com/search?q=%22"
			+ unescape(ThisTitle);
	else if (Search == "1")
		link = "http://www.google.com/search?q=%22"
			+ unescape(ThisTitle);
	else if (Search >= 2 && Search <= (2 + Site.length) )
		link = "http://www.google.com/search?btnI=1&q=%22"
			+ unescape(ThisTitle)
			+ "%22+site%3A"
			+ Site[(Search-2)];

	else link = "http://www.google.com/search?q=%22"
			+ unescape(ThisTitle);

	window.open(link,
		"Query",
		"");
}



function DisplayList() {
	var OutputHtml;

	OutputHtml = '<TITLE>Favorite ' + ThisName + '</TITLE>';
	OutputHtml += '<H3>Favorite ' + ThisName + '</H3>';

	OutputHtml += 'Search: '
		+ '<SELECT name="Search" ' 
		+ 'onChange="Search=this.selectedIndex;">'
		+ '<OPTION selected value="0">Single</OPTION>'
		+ '<OPTION value="1">Many</OPTION>';
	for (j=0; j<Site.length; j++)
		OutputHtml += '<OPTION value="' + (j + 3) 
			+ '">Book (' + (j + 1) + ')</OPTION>';

	OutputHtml += '</SELECT>' 
		+ ' <A href="#Footnote" name="Text">*</A>';


	OutputHtml += '<TABLE border="0"><TR>';


	for (i=0; i<Title.length; i++) {
		OutputHtml += '<TR><TD>' 
		+ (i + 1)
		+ '.</TD><TD>'
		+ '<A href="#" onClick=\'QueryTitle("'
		+ Title[i] 
		+ '");\'>'
		+ Title[i] 
		+ '</A></TD><TD>';

		OutputHtml += '</TD></TR>';
	}
	OutputHtml += '</TABLE>';
	
	// Explanation
	OutputHtml += '<P><small><A name="Footnote" href="#Text">*</A> '
		+ 'Explanation of search terms:'
		+ '<ul>'
		+ '  <li><b>Single</b>: Goto this novel\'s top page on Google.com'
		+ '  <li><b>Many</b>: Search this novel on Google.com'
		+ '  <li><b>Book</b>: Search Barnes and Nobles'
		+ '</ul></small>';

	return (OutputHtml);
}


