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

function search(form) {

  var element = "search_control_tabbed"; // ID of the HTML element where search results will be loaded into.
  var restrictToSite = "wesleyumcsd.org"; // Site to restrict certain searches to.

      // Set reload to "no" so next search won't reload page (because we're already at search page)
      form.reload.value = "no";

      // create a search control
      var sc = new google.search.SearchControl();

      // Options: Local, Web, Video, Blog, News, Image, Patent, Book

      // add in a full set of searchers
      //var ls = new google.search.LocalSearch();
      //ls.setUserDefinedLabel("WUMC");
      //ls.setSiteRestriction("wesley.railsplayground.net");
      //sc.addSearcher(ls);
  
      var ws = new google.search.WebSearch();
      ws.setUserDefinedLabel("Site");
      ws.setSiteRestriction(restrictToSite);
      sc.addSearcher(ws);

      var bs = new google.search.BlogSearch();
      bs.setUserDefinedLabel("Blog");
      bs.setSiteRestriction(restrictToSite);
      sc.addSearcher(bs);

      var ns = new google.search.NewsSearch();
      ns.setUserDefinedLabel("News");
      ns.setSiteRestriction(restrictToSite);
      sc.addSearcher(ns);

      var is = new google.search.ImageSearch();
      is.setUserDefinedLabel("Images");
      is.setSiteRestriction(restrictToSite);
      sc.addSearcher(is);

      // tell the searcher to draw itself in tabbed mode and tell it where to attach
      var drawOptions = new google.search.DrawOptions();
      drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
      sc.draw(document.getElementById(element), drawOptions);

      sc.execute(form.searchInput.value);
}
//google.setOnLoadCallback(search, true);

