
google.load("search", "1");

function GoogleSearch_OnLoad() {

	// create a search control
	var searchControl = new google.search.SearchControl();

	// Add in a WebSearch
	var webSearch = new google.search.WebSearch();

	// Restrict our search to pages from the Cartoon Newtowrk
	webSearch.setSiteRestriction('wolski.med.pl');  
	
	// Add the searcher to the SearchControl
	options = new google.search.SearcherOptions();
	options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
	searchControl.addSearcher(webSearch, options); 

	// Set drawing options to use my text box as input instead of having the library create one.
	//var options = new google.search.DrawOptions();
	//options.setInput(document.getElementById('GoogleSearch_queryInput'));
	var options = new google.search.DrawOptions();
	options.setSearchFormRoot(document.getElementById("GoogleSearchForm"));

	// Draw the control in content div
	searchControl.draw('GoogleSearch_searchResults', options);	

	// Set the Search Control to get the most number of results
	searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);	
  
	// definiujemy fraze wyswietlana przy braku wynikow szukania 
  	searchControl.setNoResultsString("Podana fraza nie została odnaleziona");  
  
	// Set a callback so that whenever a search is started we will call searchStart
	searchControl.setSearchStartingCallback(this, GoogleSearch_queryLabel);  
  
	searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
  
	// tell the searcher to draw itself and tell it where to attach
	searchControl.draw(document.getElementById("GoogleSearch_searchResults"), options);
	
	//searchControl.execute("szpital");
	
	
}
	

function GoogleSearch_queryLabel(searchControl, searcher, query) {
	$('#GoogleSearchDIV').show();
	//document.getElementById("searchKey").innerHTML = "User searched for: " + query;
}	

google.setOnLoadCallback(GoogleSearch_OnLoad);
