
function layer_switch(layer,newst){
    var obj=$("#"+layer);
    var newvis;
    var newdis;
    if ((newst=='show' && newst!='hidden') || (newst=='' && (obj.css('display')=='none' || obj.css('display')=='hidden')) ){
	   newvis='show';
	   newdis='block';
    }else{
	   newvis='hidden';
	   newdis='none';
    }
    obj.css({display:newdis,visibility:newvis});
}

$(document).ready(function(){
    $("A").click(function () { 
        t=document.location.protocol+"//"+document.location.host+"/";
        u=t.length;
        v=document.location.href.indexOf('.php/');
        w=document.location.href.substr(v+5);
        x=w.indexOf('/');
        y=w.substr(0,x);
        if (this.href.substr(0,u) != t && this.href.substr(0,11)!='javascript:'){
            $.getJSON("/content/elink.php/"+y+"/?l="+encodeURIComponent(this.href),
                function(data){
            });
        }
        return true;
    });
    /* Navi */
    $(".MenuBarArea ul ul ").css({display: "none"}); // Opera Fix
    $(".MenuBarArea LI").hover(function(){
            if($(this).parents().eq(1).attr('class')!='MenuBarArea'){
                $(this).parents().eq(1).find('A:first').addClass('sitemapactive');
            }
            if ($(this).find('ul:first').hasClass("sitemappages")){
                return;
            }
            /* 2. Ebene */
            if($(this).parents().get(1).tagName=='DIV' && ($(this).hasClass("sitemapreverse") || $(this).hasClass("sitemaplast"))){
                newval=$(this).outerWidth()-$(this).find('ul:first').outerWidth()+1;
                $(this).find('ul:first').css({left:newval});
            }
            /* 3.+4. Ebene */
            if(($(this).parents().get(3).tagName=='DIV' || ($(this).parents().get(5)!=undefined && $(this).parents().get(5).tagName=='DIV')) && $(this).find('UL:first').size() > 0 ){
                thistop=$(this).position().top;
                parentheight=$(this).parent().outerHeight(true);
                childheight=$(this).find('UL:first').outerHeight(true);
                if (childheight+thistop >= parentheight){
                    newval2=-(thistop+childheight-parentheight);
                    $(this).find(':nth-child(2):first').css({top:newval2});
                }else{
                    $(this).find(':nth-child(2):first').css({top:"0"});
                }
                
            }
            $(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(200);
        },function(){
            $(this).find('ul:first').css({visibility: "hidden"})
            $(this).parents().eq(1).find('A:first').removeClass('sitemapactive');
        });
    /* Newsticker */
    $(".bannews LI:first").css({display: "inline"});
    window.setInterval("loopfader('.bannews LI',1)", 5000);

    /* Suchfeld */
    jQuery.data(document.body, "searchword", {d: $(".highsearchfld").val()});
    $(".highsearchbtn").click(function() {
            $s=$(".highsearchfld");
            if ($s.val()==''||$s.val()==jQuery.data(document.body, "searchword").d){ $s.val('');$s.focus(); return false;}
            });
    $(".highsearchfld").focusin(function(){
            if ($(this).val()==jQuery.data(document.body, "searchword").d){
                $(this).val('');
            }
            $(this).focus();
        });
    $(".highsearchfld").focusout(function(){
            if ($(this).val()==''){
                $(this).val(jQuery.data(document.body, "searchword").d)
            }
            $(this).blur();
        });
});
function printfenster(url,fe,br,ho) {
	var brI;
	var HoI;
	brI = (window.screen.width/2) - ((br/2) + 10);
	HoI = (window.screen.height/2) - ((ho/2) + 20);
	var win = window.open(url,fe,"height="+ho+",width="+br+",left=" + brI + ",top=" + HoI + ",screenX=" + brI + ",screenY=" + HoI + ",resizable=yes,scrollbars=yes,toolbar=no,menubar=yes,status=no");
	win.focus();
	window.event.returnValue=false;
	return false;
}
function fenster(url,fe,br,ho) {
	return printfenster(url,fe,br,ho);
}
function CUflashtag(url,wid,hei,fva,bgc,wmo){
    AC_FL_RunContent( 'codebase','https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',wid,'height',hei,'src',url,'flashvars',fva,'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',url,'bgcolor','#0B0E10','wmode','transparent' ); 
}
function closelayover(){
    layer_switch('layoverstart1','hidden');
    layer_switch('layoverstart2','hidden');
}
function showlayover(){
    layer_switch('layoverstart1','show');
    layer_switch('layoverstart2','show');
}
function loopfader(obj,timing){
    meinobj=$(obj+":visible");
    meinobj.fadeOut(timing);
    if (meinobj.next().length==0){
        $(obj+":first").fadeIn(timing);
    }else{
        meinobj.next().fadeIn(timing);
    }
}