
$(function() {
    if ($(".footer-banners .pop")) footerBannersPopups();
});

function footerBannersPopups() {
    $("#sponsoren .pop").hide();
    $("#sponsoren a").hover(function() {
        // mouse over
        var pop = $(this).find(".pop");
        if (!pop) return false;
        var border = $(pop).find(".border");
        var a = $(pop).parent();

        $(a).addClass('hover');

        $(a).css('overflow', 'visible');
        //$(a).find("img:first").css('visibility', 'hidden');
        $(a).find("img:first").hide();

        $(border).css('opacity', '0.2');
        $(border).hide();
        $(pop).css('visibility', 'hidden'); // hiding and displaying, so the width can be obtained
        $(pop).css('display', 'block');

        border.width(pop[0].offsetWidth);
        border.height(pop[0].offsetHeight);

        if (a[0].offsetLeft + a[0].offsetWidth < 500) $(pop).css('left', a[0].offsetWidth - 40);
        else $(pop).css('right', 0);

        $(pop).css('visibility', 'visible');
        $(pop).css('display', 'none');
        $(pop).fadeIn("fast");
        $(border).fadeIn("normal");
    },
    function() {
        // mouse out
        var pop = $(this).find(".pop");
        var a = $(pop).parent();

        $(a).removeClass('hover');

        $(a).css('overflow', 'hidden');
        $(a).find("img:first").show();

        pop.hide();
    });
}

//Kwicks-Config
$().ready(function() {
    $('.kwicks').kwicks({
        max : 200,
        spacing : 20
    });
});
jQuery(document).ready(function(){
	jQuery('.moduleGroup').each(function(){
		resizeModuleGroup(this);
	});
});

function resizeModuleGroup(moduleGroupElement) {
	var groupHeight = jQuery(moduleGroupElement).height();
	if (jQuery(moduleGroupElement).children('.module').size() > 1) {
		jQuery(moduleGroupElement).children('.module').each(function(){
			var moduleHeaderHeight = jQuery(this).children('.moduleHeader').outerHeight(true);
			var moduleFooterHeight = jQuery(this).children('.moduleFooter').outerHeight(true);
			var moduleBodyWrapHeight = groupHeight - moduleHeaderHeight - moduleFooterHeight;
			jQuery(this).children('.moduleBodyWrap').height(moduleBodyWrapHeight + 'px');
		});
	}
}

//Twitter
jQuery(document).ready(function($) {
  $(".tweet").tweet({
    username: "sgbirkungen07",
    count: 3,
    loading_text: "lade tweets..."
  });
})

