document.f.q.focus();

function addBookmark(url, title)
{
  if (!url) url = document.location.href;
  if (!title) title = document.title;

  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel(title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)  
  {
    var a = document.createElement('A');
    //IF Opera 6
    if (!a) return; 

    a.setAttribute('rel', 'sidebar');
    a.setAttribute('href', url);
    a.setAttribute('title', title);
    a.click();
  }
}

function DoSelect(obj)
{
  ls = document.getElementById('sel');
  ls.removeAttribute('id');
  
  var text = '';
  switch (ls.getAttribute('name'))
  {
    case '1': text = "Все"; break;
    case '2': text = "Обзоры, тесты и описания"; break;
    case '3': text = "Форумы и блоги"; break;
    case '4': text = "Статьи по фотоделу"; break;
  }
  ls.innerHTML = '<a href="#" onclick="javascript:DoSelect(this)">'+text+'</a>';

  var l = obj.parentNode;
  l.id = 'sel';
  switch (l.getAttribute('name'))
  {
    case '1': text = "Все"; break;
    case '2': text = "Обзоры, тесты и описания"; break;
    case '3': text = "Форумы и блоги"; break;
    case '4': text = "Статьи по фотоделу"; break;
  }
  l.innerHTML = text;

  document.f.q.focus();
}

function DoSubmit()
{
  var q = document.f.q;

  var arr = document.f.getElementsByTagName('li');
  for (var i=1; i<4; i++) {
    if (arr[i].id != '') break;
  }

  var add = '';
  var name = arr[i].getAttribute('name');

  switch (name)
  {
    case '2': var add = 'more:fotogid_reviews'; break;
    case '3': var add = 'more:fotogid_forums'; break;
    case '4': var add = 'more:fotogid_articles'; break;
  }

  if (add != '' && q.value.indexOf(add) == -1) q.value = q.value+' '+add;
}
