 
 
function App(){
  this.searchForm = document.getElementById("dwsearch");
  this.searchButton = document.getElementById("qsearch_btn");
  this.searchButton.onclick = method_closure(this,App.prototype.newSearch, []);
  this.searchForm.onsubmit = method_closure(this,App.prototype.newSearch, []);
}

App.prototype.newSearch = function() {
  if (this.searchInput.value) {
    this.searchControl.execute(this.searchInput.value);
  }
  return false;
}

function method_closure(object, method, opt_argArray) {
  return function() {
    return method.apply(object, opt_argArray);
  }
}


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

    // web search, open, alternate root
    var options1 = new GsearcherOptions();
    options1.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
    options1.setRoot(document.getElementById("search_results"));

    // site restricted web search with custom label
    // and class suffix
    var siteSearch = new GwebSearch();
    siteSearch.setUserDefinedLabel("www.accmontreal.ca");
    siteSearch.setUserDefinedClassSuffix("siteSearch");
    siteSearch.setSiteRestriction("www.accmontreal.ca");
    searchControl.addSearcher(siteSearch,options1);
    
    searchControl.setLinkTarget(GSearch.LINK_TARGET_SELF)

    // tell the searcher to draw itself and tell it where to attach
    searchControl.draw(document.getElementById("searchbox"));
}
GSearch.setOnLoadCallback(OnLoad);

