// lookupForm.js

	var theForm = document.getLookupData;
	if (theForm) {
		var theTitleWanted = theForm.titleWanted;
		theTitlewanted.focus();
		theTitlewanted.select();
	} else {
		var theForm = document.googleSearchForm;
		if (theForm) {
			var theQ = theForm.q;
			theQ.focus();
			theQ.select();
		}
	}

	function useSearch(tool) {
		if (tool.toLowerCase() == 'sb') {
			document.getElementById("sbFormCategories").value = document.getElementById("googleFormQ").value; // sync up any keywords they were searching for in one into the other when they switch
			document.getElementById("SBSearchTR"            ).style.display = "";                             // and show that one
			document.getElementById("googleSearchTR"        ).style.display = "none";                         // and hide other
			document.getElementById("googleSearchTargetSpan").style.display = "none";
		} else { // Google
			document.getElementById("googleFormQ").value = document.getElementById("sbFormCategories").value; // ibid
			document.getElementById("googleSearchTR"        ).style.display = "";
			document.getElementById("SBSearchTR"            ).style.display = "none";
			document.getElementById("googleSearchTargetSpan").style.display = "";
		}
	}
	
	function setGoogleSearchTarget() {
	
		/*
		var useSearch = "SBSearch";
		var theGoogleCheckbox = document.getElementById("googleSearchTargetIframe");
		if (!theCheckox && theGoogleCheckbox.checked) useSearch = "Google"; // no radio anymore, only google
		*/
		var useSearch = "Google";
		
		var theForm     = document.getElementById("googleSearchForm");
		if (useSearch = "Google") {
			theForm.target = "googleResultsIframe";
			theForm.action = "lookupGoogleResults.cfm";
			theForm.method = "post";
		} else {
			theForm.target = "_blank";
			theForm.action = "http://www.google.com/custom";
			theForm.method = "get";
		}
	}

	function chooseGoogle() {
		var theGoogleRadio = document.getElementById('googleSearch');
		theGoogleRadio.checked = true;
		theGoogleRadio.click();
		makeGoogleResultsIframe();
	}
	
	function chooseSBSearch() {
		var theSBSearchRadio = document.getElementById('sbSearch');
		theSBSearchRadio.checked = true;
		theSBSearchRadio.click();
		clearGoogleResultsIframe();
	}
	
	function reselectField() {
		var theAdvancedSearchfield = document.getElementById("advancedGoogleFormQ");
		if (theAdvancedSearchfield) {
			theAdvancedSearchfield.select();
			theAdvancedSearchfield.focus();
		}
	}
	
	function resetHeaderField() {
		var theHeaderSearchfield   = document.getElementById("googleFormQ");
		var theAdvancedSearchField = document.getElementById("advancedGoogleFormQ");
		if (theAdvancedSearchField && theHeaderSearchfield) {
			theHeaderSearchfield.value = theAdvancedSearchField.value;
		}
	}

