function ul2menu() {

  $('ul.csc-menu-1').each(function(i) {
    
    form = document.createElement('form');
    $(form).addClass('ul2menu');
    form.appendChild(document.createTextNode('Filtrovat jen: '));
    select = document.createElement('select');
    $(select).change(function() {
      location.href = '/'+this.options[this.selectedIndex].value;
    });
    option = document.createElement('option');
    form.appendChild(select);
    $('li',this).each(function(j) {
      opt = option.cloneNode(true);
      opt.setAttribute('value',$('a',this).attr('href'));
      opt.appendChild(document.createTextNode($('a',this).html().replace(/&amp;/,'&')));
      select.appendChild(opt);
      if ($('a',this).attr("class")=='csc-menu-act') select.selectedIndex = j;
    });
    $(this).after(form);
    $(this).remove();
  });
}

$(document).ready(ul2menu);



