<!-- Google Ajax Search API - START-->

  google.load('search', '1', {"nocss" : true});

  function OnLoadSearch(videoBarId, divId, keywords, brandingDivId, toggleTextId, toggleStateId, videoInd) {

    if (toggleStateId == undefined)
      return;

	 toggleStateId = ""+toggleStateId;
     var currentState = "collapsed"

	 if (document.getElementById(toggleStateId) != null)
	   var currentState = document.getElementById(toggleStateId).value;

	 //Toggle text
	 var str = "";

	  if (currentState == "expanded"){
	    str = '<img src="/images/more_icon.gif" title="Click to see related search results!"/>';
		currentState = "collapsed";
		}
	  else {
		str = '<img src="/images/collapse.gif" title="(Hide)"/>';
		currentState = "expanded";
	  }

      if (document.getElementById(toggleTextId) != null)
	    document.getElementById(toggleTextId).innerHTML = str;
      
	  if (document.getElementById(toggleStateId) != null)
	    document.getElementById(toggleStateId).value = currentState;
	
    if (videoInd != 'noVideo'){

	//VideoBar Code - START
      var vbr;  
  
      var options = {
        string_allDone : "Close Player",
		largeResultSet : true ,
        thumbnailSize : GSvideoBar.THUMBNAILS_SMALL ,
        horizontal : true
	  }
	
	  vbr = new GSvideoBar(
                document.getElementById(videoBarId),
                GSvideoBar.PLAYER_ROOT_FLOATING,
                options
                );

	  if (currentState == "expanded")
	    vbr.execute(keywords);
      
	  //VideoBar Code - END

	}


	  // Create a search control
      var searchControl = new google.search.SearchControl();

	  //var videoOptions = new google.search.SearcherOptions();
      //videoOptions.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);

      //General Options
	  var options = new google.search.SearcherOptions();
      options.setRoot(document.getElementById(divId));
      options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);

	  // Add in a full set of searchers
      //searchControl.addSearcher(new google.search.LocalSearch());
      //searchControl.addSearcher(new google.search.VideoSearch());
	  searchControl.addSearcher(new google.search.WebSearch());
      searchControl.addSearcher(new google.search.BlogSearch());
      //searchControl.addSearcher(new google.search.ImageSearch());
	  searchControl.addSearcher(new google.search.NewsSearch());
      //searchControl.addSearcher(new google.search.BookSearch());
      //searchControl.addSearcher(new google.search.PatentSearch());

      // draw in tabbed layout mode
      var drawOptions = new google.search.DrawOptions();
      drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);	  

      // Set the Local Search center point
      //localSearch.setCenterPoint("Vancouver, BC");

	  // tell the searcher to draw itself and tell it where to attach
	  searchControl.draw(document.getElementById(divId),drawOptions);
      GSearch.getBranding(document.getElementById(brandingDivId));

      // execute an inital search
	  if (currentState == "expanded")
	    searchControl.execute(keywords);

      //Track the clicks in Google Analytics
      pageTracker._trackPageview('/ajaxSearchClick');	

	}
    google.setOnLoadCallback(OnLoadSearch);

    //]]>

<!-- Google Ajax Search API - END-->




