function initializeGoogleSearch() {
    try {
        google.search.Search.getBranding($("googleBrand"));
    
        // create a search control
        searchControl = new google.search.SearchControl();

        // add in a full set of searchers
        var siteSearch = new google.search.WebSearch();
		siteSearch.setUserDefinedLabel("Search results");
        ////siteSearch.setUserDefinedClassSuffix("gds");
        ////siteSearch.setSiteRestriction(baseUrl);
    
        // create a searcher options object
        // set up for open expansion mode
        var searchOptions = new google.search.SearcherOptions();
        searchOptions.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
		searchOptions.setNoResultsString(google.search.SearchControl.NO_RESULTS_DEFAULT_STRING);

        // load a searcher with options
        searchControl.addSearcher(siteSearch, searchOptions);

        // create a drawOptions object
        var drawOptions = new google.search.DrawOptions();
		drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_LINEAR);
        //drawOptions.setSearchFormRoot($("searchPanel"));

        searchControl.draw($('searchResults'), drawOptions);
		
		if (searchText) {
			searchControl.execute(searchText);
		}
    } catch (ex) {
        alert(ex.message);
    }
}

function initializeCustomGoogleSearch() {
    try {
        google.search.Search.getBranding($("googleBrand"));
    
        // create a search control
		//searchControl = new google.search.CustomSearchControl('008629917003657142432:5qay2rzcyk4')
		searchControl = new google.search.CustomSearchControl('006740598649147199199:rglklf3a4g4');
		//searchControl = new google.search.CustomSearchControl()
		searchControl.setNoResultsString('Your search did not match any documents');
		//searchControl.enableAds('pub-0713518056387343'); // 'pub-0713518056387343'
        searchControl.draw($('searchResults'));

		if (searchText) {
			searchControl.execute(searchText);
		}
    } catch (ex) {
        alert(ex.message);
    }
}

function callGoogleSearch(formObj) {
    var inputs = formObj.getInputs('text');

    if (inputs && inputs[0]) {
        var text = $F(inputs[0])
        if (text && text.length > 0) {
			if (searchControl) {
            	searchControl.execute(text);
				return false;
			}
        }
    }
	return true;
}