jQuery(document).ready(function() {
	/* remove empty partners */
	jQuery("#banner div:empty").hide();

	/* init navigation */
	jQuery("#nav li").hover(function() {
		jQuery(this).addClass('active');
	}, function() {
		jQuery(this).removeClass('active');
	});

	/* init banner slider */
	jQuery("#banner .scrollable").scrollable( {
	    interval : 1000,
	    easing : "linear",
	    loop : true,
	    speed : 3000
	});

	/* show content */
	jQuery("#scrollBox").fadeIn('slow');
	jQuery("#banner").css("visibility", "visible");
	
	/* Hide Last Elements Border */
	jQuery("#content .boxitem:last").addClass("lastelement");
	
	/* Load Container PopUp */
	jQuery("a[href=de/home/sozialer_tag/infos_ordern.html#orderinfos]").click(function(){
		jQuery('<div id="overlayer"><div class="o_inner"><div class="o_tp" onclick="hideThisStuff();"></div><div class="o_if"><iframe border="0" frameborder="0" scrollbars="0" scrolling="0" src="/de/home/sozialer_tag/held_werden/schule_anmelden_popup.html" id="iframeLayer"></iframe></div><div class="o_bt"></div></div></div><div id="overlayerBg"></div>').appendTo("#wrapper");
		jQuery("#overlayer").fadeIn("slow");
		jQuery("#overlayerBg").fadeIn("slow");
		return false;
	});
	jQuery("#header_anmelden").click(function(){
		/*window.location.href = "de/home/sozialer_tag/infos_ordern.html";*/
		jQuery('<div id="overlayer"><div class="o_inner"><div class="o_tp" onclick="hideThisStuff();"></div><div class="o_if"><iframe border="0" frameborder="0" scrollbars="0" scrolling="0" src="/de/home/sozialer_tag/held_werden/schule_anmelden_popup.html" id="iframeLayer"></iframe></div><div class="o_bt"></div></div></div><div id="overlayerBg"></div>').appendTo("#wrapper");
		jQuery("#overlayer").fadeIn("slow");
		jQuery("#overlayerBg").fadeIn("slow");
		return false;		
	})
	
	if(jQuery("#content").height() < 530){
		jQuery("#content").css('padding-bottom', (542-jQuery("#content").height())+"px");
	}
	
	jQuery("#mitmachen, #header_anmelden, .page").pngFix();
	
});

function hideThisStuff() {
	jQuery("#overlayer").fadeOut("slow", function(){
		jQuery("#overlayerBg").fadeOut("slow", function(){
			jQuery("#overlayer").remove();
			jQuery("#overlayerBg").remove();
		});
	});
}

function setHeight(h) {
	jQuery("#iframeLayer").animate({
		height: (h+30)+"px"
	}, "slow");
}
