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

var app;
function OnLoad(){
    app = new App();
}

function App() {

    var searchControl = new google.search.CustomSearchControl('011328762063977293412:xsgwffqxc4k');

    var siteSearch = new google.search.WebSearch();
    siteSearch.clearResults();

    var options = new google.search.SearcherOptions();
    options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
    options.setRoot(document.getElementById("searchForm"));

//    var gSearchForm = new google.search.SearchForm(false, document.getElementById("searchForm"));
//    searchControl.searchForm = new google.search.SearchForm(false, document.getElementById("searchForm"));
//    gSearchForm.setOnClearCallback(this, Reset);
//    gSearchForm.execute('aaaa');
    //gSearchForm.setOnSubmitCallback(null, SubmitForm);

    searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);

    searchControl.setSearchCompleteCallback(this, App.prototype.OnSearchComplete);
    searchControl.setSearchStartingCallback(this, App.prototype.OnSearchStarting);

//    searchControl.setOnClearCallback(this, App.prototype.OnClear);

    searchControl.draw(document.getElementById("gSearch"));
//        searchControl.execute("");
}

google.setOnLoadCallback(OnLoad, true);

App.prototype.OnSearchStarting = function(sc, searcher) {
    $A(document.getElementsByClassName('top-navigation')).each(function(node){
	node.style.display = 'none';
    });
    $A(document.getElementsByClassName('page-wrapper')).each(function(node){
	node.style.display = 'none';
    });
    $A(document.getElementsByClassName('top-navigation-menu')).each(function(node){
	node.style.display = 'none';
    });
}

App.prototype.OnSearchComplete = function(sc, searcher) {

}


