$(document).ready(function() {
var COOKIE_NAME = 'web_menue';
var COOKIE_OPTIONS = {expires: 3};
var pushed = 0;
var time = 10000;
	if($.cookie(COOKIE_NAME) != 0) {
		//read cookie and load active submenue
		pushed = $.cookie(COOKIE_NAME)-1;
		//$(".top").eq(pushed).find(".sub").fadeIn("slow");
		
		$(document).everyTime(time, function(i) {
		//	$(".top").eq(pushed).find(".sub").fadeOut("slow");
			$("#text").fadeIn("slow");
			pushed = 0;
			$.cookie(COOKIE_NAME, pushed, COOKIE_OPTIONS);		
		});
	} else {
		$("#text").fadeIn("slow");
	}
	$(".top").click(function () {
		//show submenue and set cookie
		if($(this).find(".sub").text().length != 0) {			
			pushed = $(".top").index(this)+1;
		//	$(".sub").fadeOut("slow");
		//	$(this).find(".sub").fadeIn("slow");
		//	$("#text").fadeOut("slow");	
			$("#text").fadeIn("slow");		
		} else {
		//	$(".sub").fadeOut("slow");
			$("#text").fadeIn("slow");
			pushed = 0;
		}
		$.cookie(COOKIE_NAME, pushed, COOKIE_OPTIONS);
	});
//	$(".top").hover(function () {
		//change background
//		$(this).css({ "background-color":"yellow"});
//	});

//Kontakt SEO zeigen
	$("#below_main .tx-bspagerank-pi1 p a").click(function() {
		$("#below_main .csc-frame-invisible").fadeIn("500");
	})

});


//AGB laden
function get_agb() {
	$("#agb").fadeIn();
	$("#agb_text").load("index.php?id=49 #below_main");
	$("#agb").css({"position":"absolute","z-index":"100","border":"dotted 2px #ccc","background-color":"white","padding":"1em","font-size":"0.9em"});
	$("#agb .back").click(function() {
		$("#agb").fadeOut();
	});
}
