//----------Funzioni per la ricerca in electroportal

// Namespace
var epsearch = {
	search : null,
	initialize: function(){
		search = new google.search.WebSearch();
	// Create a search control
      var searchControl = new google.search.SearchControl();

      // Add in a full set of searchers
      webSearch = new google.search.WebSearch();
      webSearch.setSiteRestriction(url_azienda);
      webSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);
      options = new google.search.SearcherOptions();
	  options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
      searchControl.addSearcher(webSearch, options);

      // tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchResults"));

      // execute an inital search

      
	},
	
	ricercaCompleta: function(){
		
		boxResults = $('searchResults');
		search.results.each(function(res){
			boxResults.insert("<h3>"+res.title+"</h3><p>"+res.content+"</p>")
		});
		boxResults.insert("<p>"+"</p>");
	}
}

google.load("search", "1");

$(document).observe('dom:loaded', epsearch.initialize.bindAsEventListener(epsearch));
