jQuery.noConflict();
jQuery(document).ready(function($) {
    $('div.homeBox').click(function() {
        location.href = $(this).children('a').attr('href');
    });
    $('#sidebar ul li').click(function() {
        location.href = $(this).children('div').children('span').children('a').attr('href');
    });

    if ($('form.contactForm').length > 0) {
        if (!($('form.contactForm').hasClass('kautschic')) && !(window.location.href.match(/section=contact&cmd=13/gi))) {
            $('form.contactForm p').last().css('padding-left', '198px');
        }
    }
    $('#eyecatchers').eyecatcher({align:'right',animationSpeed:2200,delayTime:7500});
    $('li.search').click(function() {
        $('div.langBox').hide();
        $(this).children('div').show();
    });
    $('li.lang').click(function() {
        $('div.searchBox').hide();
        $(this).children('div').show();
    });
    $('header div.inner').hover(function() {
    }, function() {
        $('li.search').children('div').hide();
        $('li.lang').children('div').hide();
    });
    if ($('div.systemkomponenten').length > 0) {
        var systemkomponentenTexts = [];
        var elemHeight;
        $('#content div.systemkomponenten').children('div').each(function() {
            systemkomponentenTexts.push($(this).html());
            elemHeight = $(this).height();
            $(this).css('height', elemHeight);
        });
        $('aside div.systemkomponenten').children('div').each(function() {
            $(this).children('img').last().hide();
        });
        $('aside div.systemkomponenten').children('div').hover(function() {
            var indexOfElement = $('aside div.systemkomponenten').children('div').index($(this));
            $('#content div.systemkomponenten div').html('');
            $('#content div.toHide').hide();
            $(this).children('img').last().show();
            $(this).children('img').first().hide();
            $($('#content div.systemkomponenten').children('div').slice()[indexOfElement]).html(systemkomponentenTexts[indexOfElement]);
        }, function() {
            var i = 0;
            $(this).children('img').last().hide();
            $(this).children('img').first().show();
            $('#content div.systemkomponenten').children('div').each(function() {
                $(this).html(systemkomponentenTexts[i]);
                $('#content div.toHide').show();
                i++;
            });
        });
    }

    setHeight();
    function setHeight() {
        if ($('nav.subnav').length > 0) {
            var sectionHeight = $('section').height();
            $('nav.subnav').css('height', sectionHeight + 'px');
        }
    }
});
