google.load('search', '1');    
    
function OnLoad() 
{
	// Create a search control
		
	// create a drawOptions object
	var drawOptions = new google.search.DrawOptions();
		
	// tell the searcher to draw itself in linear mode
	drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
	drawOptions.setSearchFormRoot(document.getElementById("search"));
		
	// Add in a full set of searchers
	// var localSearch = new google.search.LocalSearch();
	// searchControl.addSearcher(localSearch);
	// searchControl.addSearcher(new google.search.WebSearch());
	// searchControl.addSearcher(new google.search.VideoSearch());
	// searchControl.addSearcher(new google.search.BlogSearch());
	// searchControl.addSearcher(new google.search.NewsSearch());
	// searchControl.addSearcher(new google.search.ImageSearch());
	// searchControl.addSearcher(new google.search.BookSearch());
	// searchControl.addSearcher(new google.search.PatentSearch());
		
	// Set the Local Search center point
	// localSearch.setCenterPoint("New York, NY");

	var siteSearch = new google.search.WebSearch();
	siteSearch.setUserDefinedLabel(" ");
	siteSearch.setUserDefinedClassSuffix("siteSearch");
	siteSearch.setSiteRestriction("cyps.org.uk");

	var searchControl = new google.search.SearchControl();
		
	// Tell the search control to (typically) show 8 results at a time
	searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
	
	//open in same window, comment out line below to open in new window
	searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
		
	// Add web search to the search control
	searchControl.addSearcher(siteSearch);		
		
	searchControl.setSearchStartingCallback(searchControl, hidePageContent);

	// tell the searcher to draw itself and tell it where to attach
	searchControl.draw(document.getElementById("searchresults"), drawOptions);
	// execute an inital search
	// searchControl.execute("VW GTI");
}
	
google.setOnLoadCallback(OnLoad);


function hidePageContent()
{
	$('div#page-content').hide();
	$('div#main-content > h1').text('Search Results');
}
