// JavaScript Document
 

    
    google.load('search', '1.0');
 	
	var searchControl = null;
	
    function OnLoad() {
		
      // Create a search control
      searchControl = new google.search.SearchControl();
 	
      
      var searcher = new google.search.WebSearch();
	  var options = new google.search.SearcherOptions();
		options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
	  searcher.setSiteRestriction("http://www.mothersandcompany.com/");
	  searchControl.addSearcher(searcher, options);
     
      // tell the searcher to draw itself and tell it where to attach
        var searchFormElement = document.getElementById("searchInput");
		var drawOptions = new google.search.DrawOptions();
		drawOptions.setInput(searchFormElement);

		searchControl.setSearchCompleteCallback(this, showResults)
		searchControl.setNoResultsString("No items matched your search");
		searchControl.draw(document.getElementById("searchcontrol"), drawOptions);
		

	  
    }
    
    google.setOnLoadCallback(OnLoad, true);
 
function showResults() {
		document.getElementById("searchcontrol").style.display = "block";
		document.getElementById("searchCloseBtn").style.display = "block";
}

function hideSearchResults() {
		document.getElementById("searchcontrol").style.display = "none";
		document.getElementById("searchCloseBtn").style.display = "none";
}
	
function doSearch() {
	searchControl.execute(document.getElementById("searchInput").text);
}
