google.load('search', '1');
function OnLoad() {
// create a tabbed mode search control
var tabbed = new google.search.SearchControl();
tabbed.setResultSetSize(google.search.Search.LARGE_RESULTSET);
tabbed.setSearchCompleteCallback(tabbed,function(){
// Set a handle to the cursor object that we're going to use repeatedly
var cursor = this.cursor;
// Create a new property on the searcher that we can stash results into so they don't disappear when we go to the next page.
if(!this.allResults || cursor.currentPageIndex==0){this.allResults = [];}
// Add the new results to the other results
this.allResults = this.allResults.concat(this.results);
// Check to see if the searcher actually has a cursor object and, if so, if we're on the last page of results. If not...
if (cursor && cursor.pages.length>cursor.currentPageIndex+1){
// Go to the next page.
this.gotoPage(cursor.currentPageIndex+1);
// Else, if there is no cursor object or we're on the last page...
} else {
// Loop through the results and...
for(var i=0; i<this.allResults.length; i++){
var result = this.allResults[i];
// Plug them into the document where we want them.
document.body.appendChild(result.html.cloneNode(1));
}
}
});
// create our searchers. There will now be 3 tabs.
// tabbed.addSearcher(new google.search.LocalSearch());
tabbed.addSearcher(new google.search.WebSearch());
// tabbed.addSearcher(new google.search.BlogSearch());
tabbed.addSearcher(new google.search.VideoSearch());
tabbed.addSearcher(new google.search.ImageSearch());
tabbed.addSearcher(new google.search.PatentSearch());
// searchControl.addSearcher(localSearch);
// tabbed.addSearcher(new google.search.WebSearch());
// searchControl.addSearcher(new google.search.BlogSearch());
//
// searchControl.addSearcher(new google.search.LocalSearch());
// searchControl.addSearcher(new google.search.WebSearch());
// searchControl.addSearcher(new google.search.VideoSearch());
// searchControl.addSearcher(new google.search.BlogSearch());
// searchControl.addSearcher(new google.search.NewsSearch());
// searchControl.addSearcher(new google.search.ImageSearch());
// searchControl.addSearcher(new google.search.BookSearch());
// searchControl.addSearcher(new google.search.PatentSearch());
// draw in tabbed layout mode
// setOnKeepCallback(object, method, opt_keepLabel?);
var drawOptions = new google.search.DrawOptions();
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
// Draw the tabbed view in the content div
tabbed.draw(document.getElementById("content"), drawOptions);
// Search!
tabbed.execute("Subaru STI");
// tabbed.execute(aa);
}
//.setInput('inp');
google.setOnLoadCallback(OnLoad);
//google.draw(element, opt_drawOptions?)
</script>
</head>
<body>
<div id="content" style="width:1000px">Loading...</div><br />