/* DON'T EDIT THIS GENERATED FILE! Changes will be lost. */

function dynLib() {
    function clearClassName(c) {
        return c.replace(/\s*(active|firstActive|lastActive|tabLogoActive|tabLogoFirstActive|tabLogoLastActive|erotikFlashActive)\s*/g, ' ');
    }
    getCorrespondingLi = function(obj) {
        var tabs = obj.parentNode.getElementsByTagName('li');
        var temp = obj.parentNode.nextSibling;
        while (temp.nodeName != obj.parentNode.nodeName) {
            temp = temp.nextSibling;
        }
        var bats = new Array();
        for (var i=0; i<temp.childNodes.length; i++) {
            if (temp.childNodes[i].nodeName.toLowerCase() == 'li') {
                bats.push(temp.childNodes[i]);
            }
        }
        for (var i=0; i<tabs.length; i++) {
            if (tabs[i] == obj) {
                return bats[i];
            }
        }
        return null;
    }
    getActiveListItem = function(obj) {
        if (isSet(obj.activeItem)) { return obj.activeItem; }
        var items = obj.getElementsByTagName('li');
        var reActive = new RegExp(/\bactive\b/);
        for (var i=0; i<items.length; i++) {
            if (items[i].parentNode != obj) { continue; }
            if (reActive.test(items[i].className)) {
                obj.activeItem = items[i];
                return items[i];
            }
        }
        items[0].className += ' active firstActive';
        if (new RegExp(/\btabLogo\b/).test(items[0].className)) {
            items[0].className += ' tabLogoActive tabLogoFirstActive';
        }
        obj.activeItem = items[0];
        return items[0];
    }
    setActiveListItem = function(list, item) {
        list.activeItem = item;
    }
    getCorrespondingContents = function(obj) {
        if (isSet(obj.correspondingContents)) { return obj.correspondingContents; }
        var items = new Array();
        var temp  = obj.nextSibling;
        while (temp.nodeName != obj.nodeName) {
            temp = temp.nextSibling;
        }
        for (var i=0; i<temp.childNodes.length; i++) {
            if (temp.childNodes[i].nodeName.toLowerCase() == 'li') {
                items.push(temp.childNodes[i]);
            }
        }
        obj.correspondingContents = items;
        return items;
    }
    getCorrespondingContent = function(obj) {
        if (isSet(obj.correspondingContent)) { return obj.correspondingContent; }
        var items    = obj.parentNode.getElementsByTagName('li');
        var contents = getCorrespondingContents(obj.parentNode);
        var reLast   = new RegExp(/\blast\b/);
        var result   = null;
        for (var i=0; i<items.length; i++) {
            items[i].listIndex    = i;
            contents[i].listIndex = i;
            if (items[i] == obj) { result = contents[i]; }
            if (reLast.test(items[i].className))  {
                items[i].isLast    = true;
                contents[i].isLast = true;
                break;
            }
        }
        obj.correspondingContent = result;
        return result;
    }
    select = function(obj, withContent) {
        if (!UserAgent.knowsDom) { return true; }
        if (isNone(withContent)) { withContent = true; }
        var currentItem    = getActiveListItem(obj.parentNode);
        if (withContent) {
            var currentContent = getCorrespondingContent(currentItem);
            var newContent     = getCorrespondingContent(obj);
        }
        var hasTabLogo     = new RegExp(/\btabLogo\b/).test(obj.className);
        var c = obj.className        + ' active';
        var d = '';
        if (withContent) { d = newContent.className + ' active'; }
        if (hasTabLogo) {
            c += ' tabLogoActive';
        }
        if (obj.listIndex == 0) {
            c += ' firstActive';
            if (hasTabLogo) {
                c += ' tabLogoFirstActive';
            }
            d += ' firstActive';
        }
        if (obj.isLast) {
            c += ' lastActive';
            if (hasTabLogo) {
                c += ' tabLogoLastActive';
            }
            d += ' lastActive';
        }
        if (obj.className.match(/erotik/)) {
            c += ' erotikFlashActive';
        }
        currentItem.className    = clearClassName(currentItem.className);
        obj.className            = c;
        if (withContent) {
            currentContent.className = clearClassName(currentContent.className);
            newContent.className     = d;
        }
        setActiveListItem(obj.parentNode, obj);
        obj.getElementsByTagName('a')[0].blur();
        return false;
    }
    searchSelect = function(obj) {
        qs(obj);
        return true;
        var form = obj.parentNode.parentNode.parentNode;
        var id   = obj.parentNode.id.substring(10).toLowerCase();
        form.className = id;
        var additions  = document.getElementById('fieldsetSearchAdditional');
        var additional = document.getElementById('fieldsetSearchAdditional'+id.ucfirst());
        for (var i=0; i<additions.childNodes.length; i++) {
            var el = additions.childNodes[i];
            if (el.nodeType != 1) { continue; }
            el.className = (el == additional) ? 'active' : '';
        }
        if (isSet(document.getElementById('inpFieldsTogether'))) {
            document.getElementById('inpFieldsTogether').style.height = 'auto'; 
        }
        document.getElementById('inpSearchText').style.height = 'auto'; 
        document.forms['webSearchForm'].action = obj.href;
        obj.blur();
        return false;
    }
    blowup = function(obj) {
        if (!document.getElementById) { return true; }
        var items = obj.parentNode.getElementsByTagName('li');
        for (var i=0; i<items.length; i++) {
            items[i].className = (items[i]==obj) ? 'active' : '';
        }
        return false;
    }
    jsLoaded('dynLib.js');
}

requires('prototype.js', dynLib);
