google.load('search', '1');

function inputFocus() {
  document.getElementById('query-input').style['background'] = '';
}

function inputBlur() {
  var queryInput = document.getElementById('query-input');
  if (!queryInput.value) {
	var obj = document.getElementById('hidCurrentProtocol');
	var currentprotocol = obj.value;
	queryInput.style['background'] =
		'white url(' + currentprotocol + 'www.google.com/coop/images/'
		+ 'google_custom_search_watermark.gif) no-repeat 5% 55%';
  }
}

function init() {
  google.search.CustomSearchControl.attachAutoCompletion(
	  '002541371420983387318:_gmqejhp5ze',
	  document.getElementById('query-input'),
	  'two-page-form');
  inputBlur();
}

function submitQuery() {
  window.location = '/search/patients.php?q='
	  + encodeURIComponent(
		  document.getElementById('query-input').value);
  return false;
}

google.setOnLoadCallback(init);
