function getElementsByClassName(node,classname) {
  if (node.getElementsByClassName) { // use native implementation if available
    return node.getElementsByClassName(classname);
  } else {
    return (function getElementsByClass(searchClass,node) {
        if ( node == null )
          node = document;
        var classElements = [],
            els = node.getElementsByTagName("*"),
            elsLen = els.length,
            pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"), i, j;

        for (i = 0, j = 0; i < elsLen; i++) {
          if ( pattern.test(els[i].className) ) {
              classElements[j] = els[i];
              j++;
          }
        }
        return classElements;
    })(classname, node);
  }
}

//<![CDATA[
  google.load('search', '1');
  
  function OnLoad() {
  
    // create a search control
    var searchControl = new google.search.SearchControl();

    // Add in a WebSearch
    var webSearch = new google.search.WebSearch();
    // Restrict our search to pages from the FF
    var hostname = window.location.hostname;
    webSearch.setSiteRestriction(hostname);
  
    // web search, open, alternate root
    var options = new google.search.SearcherOptions();
    options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
    options.setRoot(document.getElementById("search-results"));
    searchControl.addSearcher(webSearch, options);

    // tell the searcher to draw itself and tell it where to attach
    searchControl.draw(document.getElementById("search_control"));
  
    $('.gsc-input').bind('focus', function() {
    	$(this).css('background-image', 'none');
    });
    $('.gsc-input').bind('blur', function() {
    	if($(this).val() == '')
    		$(this).css('background-image', 'url("//www.google.com/cse/intl/en/images/google_custom_search_watermark.gif")');
    });
  }
  google.setOnLoadCallback(OnLoad);
//]]>
