$(document).ready(function(){

    loadStyle();
    $("#featFont").show();
   var feddich=true;
    function hideTeaserText(slide){
        $("#losungen li .imgContainer").each(function(e){
        
            if (slide) {
                $(this).slideUp("slow");
            }
            else {
                $(this).hide();
            }
        })
    }
    
    
    hideTeaserText();
    
    $("ul#losungen li").bind("mouseenter",function(){
        $(".imgContainer", this).slideDown("slow");
    }).bind("mouseleave",function(){
		$(".imgContainer", this).slideUp("slow");
	})
	
	$('#btnTopUnternehmen').bind('mouseenter',function(){
		$('#unternehmenSubnavi').fadeIn();
	}).bind('mouseleave',function(){
		$('#unternehmenSubnavi').fadeOut();
	})
	// WIRD IM MOMENT NICHT GEBRAUCHT, DIENT DAS DIE MENUES AUSGEFAHREN WERDEN
	/*
	function showCurrentContainer(){
		$(cont).slideDown("slow");
	}
	
	var menus=['#naviTop li','.naviBottom li'];
	
	function initMenus(){
		for(i=0;i<menus.length;i++){
			slideMenus(menus[i]);
			hideMenus(menus[i]);
		}
	}

	initMenus();
	var st=true;
	function slideMenus(elem){
		$(elem).bind("mouseenter", function(){
			var currentP=$(".untermenu1",this).css("display");
			$('.untermenu1').each(function(){
				if(currentP=="none"){
					$(this).stop().slideUp(1000,function(){
						st=true;
					});
				}
			})
			if(st){
				st=false;
				$(".untermenu1",this).stop().height('auto').slideDown(1000);
			}
			
		})
	}
	*/

	/*
	function hideMenus(elem){
		$(elem+' .untermenu1').hide();
		$(elem+' .untermenu1').each(function(){
			if($(this).attr('id')==getCookie('activeMenu')){
				$(this).show();
			}
		})
	}
	
	$('.untermenu1 li a').click(function(e){
		setCookie('activeMenu',$(this).parent().parent().parent().attr('id'),1);
	})
	*/
})



var days = 30;
var styleStart = "standard";
var cookieName = "fontsize";

function loadStyle(){
    c = getStyleCookie();
    switchStyle(c);
}

function switchStyle(style){
    styles = new Array("gross", "standard", "klein");
    sizes = new Array(1.25, 1.1, 0.8);
    for (i = 0; i < styles.length; i++) {
        if (styles[i] == style) {
            $("#content").css("font-size", sizes[i] + "em");
            styleStart = style;
            setStyleCookie();
        }
    }
}

function setCookie(name, value, expdays){
    var now = new Date();
    var exp = new Date(now.getTime() + (1000 * 60 * 60 * 24 * expdays));
    document.cookie = name + "=" + escape(value) + ";" +
    "expires=" +
    exp.toGMTString() +
    ";" +
    "path=/";
}

function getCookie(name){
    var cname = name + "=";
    var dc = document.cookie;
    if (dc.length > 0) {
        var start = dc.indexOf(cname);
        if (start != -1) {
            start += cname.length;
            var stop = dc.indexOf(";", start);
            if (stop == -1) 
                stop = dc.length;
            return unescape(dc.substring(start, stop));
        }
    }
    return null;
}


function setStyleCookie(){
    setCookie(cookieName, styleStart, days);
}

function getStyleCookie(){
    return getCookie(cookieName);
}

