function updateLabelInside(field, focus) {
  if (!field) return;
  var cl = field.parentNode.className;
  if (focus || field.value !== '') {
    if (cl.indexOf(' focused') < 0) {
      cl += ' focused';
    }
  } else {
    if (field.value === '') {
      while(cl.indexOf(' focused') >= 0) {
        cl = cl.replace(' focused', '');
      }
    }
  }
  field.parentNode.className = cl;
}
// clear the field if it's set by the browser by hitting back button
setTimeout( function() {
    updateLabelInside(document.getElementById('search'), false);
  }, 10);

function doSearch(form) {

  var search = form.search.value;

  search = encodeURIComponent(search);

  window.location = '/app/#search:CREATIVE::'+search+'::::false';

  return false;

}

