
function GoogleSearch() {
	this.init = function() {
		var searchFormElement = document.getElementById("search");
        
		var drawOptions = new google.search.DrawOptions();
		drawOptions.setInput( searchFormElement );
		drawOptions.setDrawMode( google.search.SearchControl.DRAW_MODE_TABBED );

		var searchControl = new google.search.SearchControl();
		var search = new google.search.WebSearch()
        
		if( gSearch_siteAddress != "" ) search.setSiteRestriction( gSearch_siteAddress );
        
		searchControl.addSearcher( search );
		searchControl.setResultSetSize( google.search.Search.LARGE_RESULTSET );
		searchControl.setSearchStartingCallback( this, GoogleSearch.prototype.searchStart );
		searchControl.draw( document.getElementById("content"), drawOptions );
		
		searchControl.execute( document.getElementById('search').value );
	};
}

GoogleSearch.prototype.searchStart = function(searchControl, searcher, query) {

}

$(document).ready( function() {
	var gs = new GoogleSearch();
	if( window.location.pathname == gSearch_searchPage ) {
		google.load("search", "1", {"callback" : gs.init});
		$('#searchForm').submit(function() {
			return false;
		});
	} else {
		$('#searchForm').attr('action', gSearch_searchPage );
	}
});


