// JavaScript Document
//<![CDATA[
google.load("search", "1");

function OnLoad() {
	// Create a search control
	var searchControl = new GSearchControl();
	// create a searcher options object and set mode
	var options = new GsearcherOptions();
	options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
	
	// site restricted web search with custom label and class suffix	  
	var siteSearch = new GwebSearch();
	siteSearch.setUserDefinedLabel("Web Page");
	siteSearch.setUserDefinedClassSuffix("siteSearch");
	siteSearch.setSiteRestriction("ebaldc.org/");
	siteSearch.setQueryAddition("-filetype:pdf");
	searchControl.addSearcher(siteSearch,options);
	
	// add in search
	var sitePdfSearch = new GwebSearch();
	sitePdfSearch = new GwebSearch();
	sitePdfSearch.setUserDefinedLabel("PDF File");
	sitePdfSearch.setUserDefinedClassSuffix("sitePdfSearch");
	sitePdfSearch.setSiteRestriction("ebaldc.org/");
	sitePdfSearch.setQueryAddition("filetype:pdf");
	searchControl.addSearcher(sitePdfSearch,options);
	   	
	// create a drawOptions object. tell the searcher to draw itself in proper mode
	var drawOptions = new GdrawOptions();
	drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
	
	// tell the searcher to draw itself and tell it where to attach
	searchControl.draw(document.getElementById("searchcontrol"),drawOptions);
	
	// select the number of results returned by each of the searchers
	searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);

	// set the link target used for links embedded in search results
	searchControl.setLinkTarget(GSearch.LINK_TARGET_SELF);
	
	// Execute an inital search
	searchControl.execute(document.getElementById("searchTerm").value);
}
if (document.getElementById("searchTerm")){
	google.setOnLoadCallback(OnLoad);
}
//]]>
function showSearchBox(){
	var top = '70px';	
	var left = ((document.body.offsetWidth - 600) / 2) + 'px';
	document.getElementById('searchlayer').style.top = top;
	document.getElementById('searchlayer').style.left = left;
	document.getElementById('searchlayer').style.display='block'; 
	OnLoad();
}

function hideSearchBox(){
	document.getElementById('searchlayer').style.display='none';
}