var undefined; // old ie versions dont have the undefined constant, an undefined var with the undefined name will do.

function iCanHazAds(elt, idMax) {
  // we if we're not provided with an idMax, just assume 10. for now we're doing without it
  if (idMax === undefined) idMax = 10;
  var id = Math.floor(Math.random() * idMax)
  new Ajax.Request("/ad_server/" + id, {
    method    : 'get',
    onSuccess : function(transport) { Element.insert(elt, transport.responseText) }});
}

var Search = { 
  klass : 'inner-label', 
  label : 'Busca',

  click : function(elt) {
    if (Element.hasClassName(elt, Search.klass)) elt.value = '';
    Element.removeClassName(elt, Search.klass);
  },

  blur : function(elt) {
    if (elt.value != '') return;
    Element.addClassName(elt, Search.klass);
    elt.value = Search.label;
  }
}
