var searchControl;
var options;

function toggleTechSheets(id) {
  button = document.getElementById('expand-' + id);
  div = document.getElementById('sheets-' + id);
  
  if (button.className == 'icon expand') {
    div.style.height = 'auto';
    button.className = 'icon collapse';
    button.title = 'Katalógusok elrejtése';
  }
  else {
    div.style.height = '18px';
    button.className = 'icon expand';
    button.title = 'Összes katalógus megjelenítése';
  }
}

// ------------------------------- GOOGLE SEARCH -------------------------------

function OnLoad() {
  // Create a search control
  
  searchControl = new GSearchControl();

  // site restricted web search with custom label and class suffix
  var siteSearch = new GwebSearch();
  siteSearch.setUserDefinedLabel("Keresés eredménye:");
  
  siteSearch.setUserDefinedClassSuffix("siteSearch");
  siteSearch.setSiteRestriction("hikev.hu");
    
  searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
  searchControl.addSearcher(siteSearch);
  
  
  /*options = new GsearcherOptions();
  options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
  searchControl.addSearcher(new GwebSearch(), options);
  */
  
  
  // create a draw options object so that we can position the search form root
  options = new GdrawOptions();
  options.setSearchFormRoot(document.getElementById("searchcontrol"));
}

GSearch.setOnLoadCallback(OnLoad);

function submitSearch() {
  // Tell the searcher to draw itself and tell it where to attach
  searchControl.draw(document.getElementById("main"));
  searchControl.execute(document.getElementById('query').value);
  window.location.hash = 'top';
  return false;
}
