// 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.imdb.com/Title?'
			+ ThisTitle;
	else if (Search == "1")
		link = 'http://www.google.com/search?q=%22'
			+ ThisTitle
			+ '%22&btnI=1';
	else if (Search == "2")
		link = 'http://www.google.com/search?q=%22'
			+ ThisTitle
			+ '%22';
	else if (Search >= 3 && Search <= (3 + Site.length) )
		link = 'http://www.google.com/search?btnI=1&q=%22'
			+ ThisTitle
			+ '%22+site%3A'
			+ Site[(Search-3)];

	else link = 'http://www.google.com/search?q=%22'
		+ ThisTitle
		+ '%22';

	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">IMDB</OPTION>'
		+ '<OPTION value="1">Single</OPTION>'
		+ '<OPTION value="2">Many</OPTION>';
	for (j=0; j<Site.length; j++)
		OutputHtml += '<OPTION value="' + (j + 3) 
			+ '">Script (' + (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>IMDB</b>: Search this title in IMDB.com (Internet Movie Database)'
		+ '  <li><b>Single</b>: Goto this movie\'s top page on Google.com'
		+ '  <li><b>Many</b>: Search this movie on Google.com'
		+ '  <li><b>Script 1</b>: Search script for this movie at Dailyscript.com'
		+ '  <li><b>Script 2</b>: Search script for this movie at Screenplay.com'
		+ '</ul></small>';

	return (OutputHtml);
}

