  // the cse class encapsulates a left and right search control
  // both controls are driven by a shared search form
  function cse() {
	var sFormDiv = document.getElementById("searchForm");
	var leftScDiv = document.getElementById("searchControl");

	// create a left, right search control
	// create a custom search form
	this.leftControl = new GSearchControl();
	this.searchForm = new GSearchForm(true, sFormDiv);

	// bind clear and submit functions
	this.searchForm.setOnSubmitCallback(this, cse.prototype.onSubmit);
	this.searchForm.setOnClearCallback(this, cse.prototype.onClear);

	// set up for small result sets
	this.leftControl.setResultSetSize(GSearch.SMALL_RESULTSET);
	this.leftControl.setLinkTarget(GSearch.LINK_TARGET_SELF);

	var searcher;
	var options;

	// configure left control
	// Site Restrict to CSE ID for reviews
	searcher = new GwebSearch();
	options = new GsearcherOptions();
	searcher.setSiteRestriction("014101120621721815484:jzzh2av0ixy");
	options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
	this.leftControl.addSearcher(searcher, options);

	var drawOptions = new GdrawOptions();
	drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);

	this.leftControl.draw(leftScDiv, drawOptions);

	// execute a starter search - use for style testing etc
	// this.searchForm.execute("History");

  }

  // when the form fires a submit, grab its
  // value and call the left and right control
  cse.prototype.onSubmit = function(form) {
	var q = form.input.value;
	if (q && q!= "") {
	  this.leftControl.execute(q);
	  document.getElementById("greyout").style.display = 'block';
	  document.getElementById("searchResults").style.display = 'block';
	}
	return false;
  }

  // when the form fires a clear, call the left and right control
  cse.prototype.onClear = function(form) {
	this.leftControl.clearAllResults();


	form.input.value = "";
	return false;
  }

  function OnLoad() {
	new cse();
  }
  GSearch.setOnLoadCallback(OnLoad);
  
  function hideResults() {
	  document.getElementById("greyout").style.display = 'none';
	  document.getElementById("searchResults").style.display = 'none';
  }
  /*
  document.getElementById("greyout").onclick = hideResults;
  */
  
//////////////////////////////////////




function swapImg(target,loc) {
	document.getElementById(target).src = loc;
}



