﻿function dropTableAS() {
 var selects = document.getElementsByTagName('select');
 for (var i = 0, select; select = selects[i]; i++) {
  // if this select has the proper className and hasn't been initialized yet...
  if (/\bdropdown\b/.test(select.className) &&
    typeof select.navInitialized === 'undefined') {
   var next = select.nextSibling;
   // find the next HTML element node
   while (next && next.nodeType !== 1)
    next = next.nextSibling;
 
   // if we didn't run out of nextSiblings
   if (next) {
    var links = next.getElementsByTagName('a');
    for (var j = 0, link; link = links[j]; j++) {
     var option = document.createElement('option');
     option.value = link.href;
     option.appendChild(document.createTextNode(link.innerText || link.textContent));
     select.appendChild(option);
    }
    select.navInitialized = true;
    select.className += ' showMe';
    select.parentNode.className = 'aSearch';
   }
  }
 }
}
