Hi,

Can anyone find why this Javascript doesn't work?

Code:
window.onload = function(){
  //create script element
  var scriptElem  = document.createElement("script");
  scriptElem.type = "text/javascript";
  scriptElem.src = "http://www.google.com/jsapi";

  //include the script into the header
  document.getElementsByTagName("head")[0].appendChild(scriptElem);

  //load google search API
  google.load('search', 1); //"google" is undefined!!!
}
I'm developing a Google Chrome Extension.
I thought the google api was not included properly, but "google.load('search', 1)" is valid on Firebug (a chrome debugger).

Thanks.