google.load('search', '1');

google.setOnLoadCallback(function(){
  var control = new google.search.CustomSearchControl('004172395941650312501:4q3ncrw02ge');
  var draw = new google.search.DrawOptions();
  draw.setDrawMode(google.search.SearchControl.DRAW_MODE_LINEAR);
  draw.setSearchFormRoot('search-q');
  control.draw('search');
}, true);

/*
if (!window.$) google.load('mootools', '1.2.2');
google.load('search', '1', {'nocss' : true});

google.setOnLoadCallback(function() {
  var SearchBar = new Class({
  
    initialize: function(input, container) {
      this.input = $(input);
      this.form = this.input.getParent('form');
      this.container = $(container);
      
      this.api = new google.search.WebSearch();
      this.api.setSiteRestriction('digitarald.de');
      this.api.setUserDefinedLabel('digitarald.de');
      this.api.setNoHtmlGeneration();
      this.api.setSearchCompleteCallback(this, this.populate);
      
      this.form.addEvent('submit', function(e) {
        e.stop();
        if (this.input.value) this.start();
        return false;
      }.bind(this));
    },
    
    start: function() {
      this.container.empty().set('text', 'Loading ...');
      this.api.execute(this.input.value);
    },
    
    populate: function() {
      this.container.empty();
      
      var results = this.api.results;
      if (!results.length) {
        this.container.set('text', 'No Results');
      } else {
        results.each(function(result) {
          new Element('li', {'class': 'result-item'}).adopt(
            new Element('small', {html: result.url}),
            new Element('a', {html: result.title, href: result.url}),
            new Element('p', {html: result.content})    
          ).inject(this.container);
        }, this);
      }
    }
    
  });
  
  new SearchBar('search-q', 'search-results');
});
*/

