



$(document).ready(function(){    
    $('.kidsmenu a').hover(function() {       
        linkclassString = $(this).attr('class');
        linkclassArray = linkclassString.split(' ');
        menu_switch(linkclassArray[0]);
//        menu_switch($(this).attr('id'));
    },function() {
        menu_switch_off();
    });
	
	
		//Fader
			$(".content_inner.notiz_inner > div").css("display", "none");
			$(".content_inner.notiz_inner div:first").css("display", "block");
        	fade();
		//Fader
		
    // Schriftvergroesserung
    var font_normal = '10px';
    var font_big = '12px';
    var font_bigger = '13px';
    
    $('.font_menu_normal').click(function() {
        $('body').css('font-size', font_normal);
        jQuery.cookie("font", font_normal);
        return false;
    });
    $('.font_menu_big').click(function() {
        $('body').css('font-size', font_big);
        jQuery.cookie("font", font_big);
        return false;
    });
    $('.font_menu_bigger').click(function() {
        $('body').css('font-size', font_bigger);
        jQuery.cookie("font", font_bigger);
        return false;
    });
    
    if ( jQuery.cookie("font") != null ) {
        $('body').css('font-size', jQuery.cookie("font")); 
    }
	
	function microtime(get_as_float)
	{
		var unixtime_ms = new Date().getTime();
		var sec = parseInt(unixtime_ms / 1000);
	   
		return get_as_float ? (unixtime_ms/1000) : (unixtime_ms - (sec * 1000))/1000 + ' ' + sec;
	}	
	var timelocker = 0;
	var animationrunning = 0;
    //$(".note-container").anythingSlider({width: 200, height: 120, delay: 10000, easing: "fade"});
	//$('.content_inner.notiz_inner').anythingFader({autoPlay: true, width:200, height:120, delay: 1000});
	
		//menu
    $(".mainMenu_layer2").css("display", "none"); // ebene 2 Komplett ausblenden
    $(".mainMenu_layer3").css("display", "none"); // ebene 3 Komplett ausblenden
    $(".mainMenu_layer1_active .mainMenu_layer2").css("display", "block"); // Alle menuepunkte des aKtiven aus layer1
    $(".mainMenu_layer2_active .mainMenu_layer3").css("display", "block");// Alle menuepunkte des aKtiven aus layer2
    $(".layer1").bind("mouseover", function(){	
							
		if(animationrunning == 0){	
			animationrunning = 1;
			$(this).addClass("hovering");
			$(".layer1:not(.hovering)").each(function(){								 
				$(this).children(".mainMenu_layer2").slideUp(1000);
				$(this).children(".mainMenu_layer2").removeClass("hovering");
			});
		$(this).children(".mainMenu_layer2").slideDown(1000, function (){
			animationrunning = 0;															   
		});  
			$(this).removeClass("hovering");
}
    });




    $(".layer2.hasChildren > a").bind("click", function(e){        
        e.preventDefault();
		var $this = $(this);
        $(".layer2.hasChildren ul").slideUp("slow");
        $(this).next("ul").slideDown("slow", function (){
					window.location.href="http://www.kinderabteilung.lkh-vil.or.at/" + $this.attr("href");
													   });
    }); 
	
});



function menu_switch( _id ) {
    $('#kidsmenu_bg').hide();
    switch(_id) {
        case 'menu_babies':
        case 'rzcolorbox-content366':
            $('#kidsmenu_babies').show();
            break;
        case 'menu_kids':
        case 'rzcolorbox-content368':
            $('#kidsmenu_kids').show();
            break;
        case 'menu_jugend':
        case 'rzcolorbox-content376':
            $('#kidsmenu_jugend').show();
            break;
        case 'menu_team':
        case 'rzcolorbox-content384':
            $('#kidsmenu_team').show();
            break;
    }
}
function menu_switch_off() {
    $('#kidsmenu_babies').hide();
    $('#kidsmenu_kids').hide();
    $('#kidsmenu_jugend').hide();
    $('#kidsmenu_team').hide();
    $('#kidsmenu_bg').show();
}

function fade(){
	setTimeout("fading()", 10000);	
}

function fading(){
	$('.content_inner.notiz_inner div:first').fadeOut("slow", function(){
			$(this).remove().appendTo(".content_inner.notiz_inner");
			$('.content_inner.notiz_inner div:first').fadeIn("slow");
	});	
	fade();
}


