google.load("search","1");
function google_customSearch(){
    var searcher, options, google_searchQuery = window.google_searchQuery || '';

    searcher = new google.search.WebSearch();
    options = new google.search.SearcherOptions();

    options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
    searcher.setNoHtmlGeneration();
    searcher.setSearchCompleteCallback(this,google_customSearch.prototype.onSearchComplete,[searcher]);

    searcher.execute(google_searchQuery);
} 

google_customSearch.prototype.onSearchComplete = function(search){
    var resultsDiv = document.getElementById("googleWebSearch");
    var child = null;;

    if(resultsDiv === null) return false;
  
    for(var i=0;i<search.results.length;i++){
        var result = search.results[i];
        search.createResultHtml(result);
        if(result.html){
            child = result.html.cloneNode(true);
            resultsDiv.appendChild(child);
        } 
    }
}

function google_onLoad(){
    new google_customSearch();
}

google.setOnLoadCallback(google_onLoad,true);
