/*
 * This sample shows how to create a Custom Search Control.  By default, it
 * will allow you to add a search box to your page that searches your site.
 * Optionally, you can give it a CSE ID (http://www.google.com/coop/cse/) to
 * have it search sites you specify
*/

google.load('search', '1', {language : 'es'});

function gcseSearch( queryW, divContainerID, codigoGcse ) {
  	
  	if( queryW == 'escriba la consulta' ) queryW = '';
  	
	  // Create a custom search control that uses a CSE restricted to code.google.com
	  var customSearchControl = new google.search.CustomSearchControl( codigoGcse );
		customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
		var options = new google.search.DrawOptions();
		options.setAutoComplete(true);
	  // Draw the control in content div
	  customSearchControl.draw(divContainerID, options);
	  
	  // run a query
	  customSearchControl.execute(queryW);
	
}
