function buttons(tab, event,id) {
    var win = $(tab);
    while (win && !Element.hasClassName(win, 'tabs')) win = win.parentNode;
    if (win) {
        document.getElementsByClassName('tab', win).each(function(e) {
            e.className = "tab";
        })
        tab.className = "tab active";
    }
}

function tab(button, eevent) {
    var win = $(button);
    while (win && !(Element.hasClassName(win, 'tab') || Element.hasClassName(win, 'popupbody'))) win = win.parentNode;
    if (win && Element.hasClassName(win, 'tab')) {
        win.parentNode.removeChild(win);
    } else if (win && Element.hasClassName(win, 'popupbody')) {
        hide(win);
        glass(win);
    }
    return false;
}
function s(internet) {
    var e = window.encodeURIComponent ? encodeURIComponent : escape;
    var country = "ru";
    var path = "http://www.yandex.ru/yandsearch?text=";
    var pathcat="http://altatop.org/search/?q=";
    if (byid('country') && byid('country').className == 'tab active') {
        window.location.href = path + 'country:' + country + '+' + e(byid('q').value);
        return false;
    } else if (byid('ylp') && byid('ylp').className == 'tab active') {
        window.location.href = path + e(byid('q').value) + '&ylp=1';
        return false;
    } else if (byid('catsearch') && byid('catsearch').className == 'tab active') {
	window.location.href = pathcat +e(byid('q').value);
	return false;
    } else if (byid('internet').className == 'tab active') {
        return true;
    }
    return false;
}
