Event.observe(window, 'load', init, false);

function init(){

    $('maincatcat').update(maincatjs);

    var livechatactive = false;
    var livechatupdater = new Ajax.PeriodicalUpdater(
                        $('livechat'),
                        '/ajax/chat.php',
                        {   method: 'get',
                            frequency: 5,
                            decay: 1,
                            onSuccess: function() {
                                var thiscontent = $('livechat').innerHTML;
                                if (thiscontent != '' && !livechatactive) {
                                    $('livechat').appear();
                                    livechatactive = true;
                                }
                                if (thiscontent == '') {
                                    livechatactive = false;
                                }
                            }
                        }
                    );

}


function getDirectId(text, li) {

    if (li.id != "") {
        self.location.href = '/vorlage/-qs-id-vc-' + li.id;
    } else {
        $("suche").submit();
    }
}

function ddshow(id) {
    $(id).show();
}


function ddclosenow(id) {
    $(id).hide();
}

lasttabid = new Array();
lasttabid[1] = "1.1";
lasttabid[2] = "2.1";
lasttabid[3] = "3.1";
lasttabid[4] = "4.1";

function tabselected(id) {

    // Section and Tab
    var selection = id.split(".");
    var section = selection[0];

    if (lasttabid[section] != "") {
        $('c'+lasttabid[section]).addClassName('onhold');
        $('t'+lasttabid[section]).removeClassName('active');
    }

    $('c'+id).removeClassName('onhold');
    $('t'+id).addClassName('active');
    lasttabid[section] = id;
}