/*  */
/*  */

function popup (adresse, name, parameter) {
  popupWindow = window.open(adresse, name, parameter);
  popupWindow.focus();
}

var fsCookie = 0;
var fsString = new Array();
if(document.cookie.indexOf('fontsize=3') >= 0) {
    fsCookie = 3;
    document.write('<link rel="stylesheet" type="text/css" href="/cps/rde/xchg/bms_de/hs.xsl/scale150.css" />\n');
} else if (document.cookie.indexOf('fontsize=2') >= 0) {
    fsCookie = 2;
    document.write('<link rel="stylesheet" type="text/css" href="/cps/rde/xchg/bms_de/hs.xsl/scale125.css" />\n');
} else if (document.cookie.indexOf('fontsize=1') >= 0) {
    fsCookie = 1;
    document.write('<link rel="stylesheet" type="text/css" href="/cps/rde/xchg/bms_de/hs.xsl/scale100.css" />\n');
} else {
    fsCookie = 0;
}
function fsdown() {
    if (fsCookie > 0) {
        fontScale(fsCookie-1);
    }
}
function fsup() {
    if (fsCookie < 3) {
        fontScale(fsCookie+1);
    }
}
function fontScale(fontgr) {
    if (navigator.cookieEnabled) {
        var datum = new Date();
        datum.setTime(datum.getTime() + (1000 * 3600 * 24 * 365));
        document.cookie = 'fontsize=' + fontgr + '; ' + 'expires=' + datum.toGMTString() + '; ' + 'path=/';
//        self.location = self.location;
        window.location.reload(false);
    } else {
        window.alert("Diese Funktion setzt das Akzeptieren von Cookies voraus!");
    }
}

// === Startanimation ===

var currentItem = null;
var undoTimerHodler = false;
$(document).ready(
    function()
    {
        $('#board .ind')
            .bind('mouseenter', doItem);
        $('#board .ind')
            .bind('mouseleave', stopItem);
        $('#board')
            .bind('mouseleave', undoItem);
            
            
            
        // quellenangaben    
        $('.mouseOverAnchor').mouseover( function( e ) {
        mouseOverTextId = 'mouseText' + $(this).attr( 'id' ).replace( 'mouseAnchor', '' );
        var width = 0;
        if (document.documentElement) {
            width = document.documentElement.offsetWidth;
        } else if (window.innerWidth && window.innerHeight) {
            width = window.innerWidth;
        }
        $( '#' + mouseOverTextId ).css( 'left', e.pageX + 10 );
        if( e.pageX > width / 2 ) {
            $( '#' + mouseOverTextId ).css( 'left', ( e.pageX - ( 250 + 10 ) ) );
        }
        $( '#' + mouseOverTextId ).css( 'top', e.pageY + 10 );
        $( '#' + mouseOverTextId ).show();
        return false;
        });
        $('.mouseOverAnchor').mouseout( function() {
            mouseOverTextId = 'mouseText' + $(this).attr( 'id' ).replace( 'mouseAnchor', '' );
            $( '#' + mouseOverTextId ).hide( 'medium' );
            return false;
        });
        
        
        
        $("#mainContent div.slideBoxEntry").addClass("inactive");
        $('#mainContent div.slideBoxEntry.inactive div.slideBoxEntryBody').hide();
        $("#mainContent div.slideBoxEntry div.slideBoxEntryHeadline").click(function() {
            if(!$(this).parent('div.slideBoxEntry').hasClass('noclose')) {
                if($(this).parent("div.slideBoxEntry").hasClass("inactive")) {
                    $('#mainContent div.slideBoxEntry:not(.inactive):not(.noclose) div.slideBoxEntryBody').slideToggle(200);
                    $('#mainContent div.slideBoxEntry:not(.inactive):not(.noclose)').toggleClass("inactive");
                }
                $(this).next("div.slideBoxEntryBody").slideToggle(200, function() {
                    $(this).parent().css('position','static');
                });
                $(this).parent("div.slideBoxEntry").toggleClass("inactive");
            }
        });
    }
    
);
function doItem()
{
    if(undoTimerHodler)
        window.clearTimeout(undoTimerHodler);
    if(currentItem) {
        $(currentItem)
        .animate({height: 34}, 200)
        .find('.color').animate({ height: '28' }, 10);
        $('#board .ind').find('.abstr').css({ display: 'inline' });
        $('#board .ind').find('.btext').css({ display: 'none' });
    } else {
        $('#board .ind').not(this)
        .animate({height: 34}, 200)
        .find('.color').animate({ height: '28' }, 10);
        $('#board .ind').find('.abstr').css({ display: 'inline' });
         $('#board .ind').find('.btext').css({ display: 'none' });
    }
    currentItem = this;
    $(currentItem)
    .animate({height: 62}, 200)
    .find('.color').animate({ height: '56' }, 10);
    $(currentItem).find('.abstr').css({ display: 'none' });
    $(currentItem).find('.btext').css({ display: 'inline' });
    
}
function undoItem()
{
    undoTimerHodler = window.setTimeout(undoTimer, 100);
}
function stopItem()
{
        $('#board .ind').not(this)
        .animate({height: 34}, 200)
        .find('.color').animate({ height: '28' }, 10);
        $('#board .ind').find('.abstr').css({ display: 'inline' });
        $('#board .ind').find('.btext').css({ display: 'none' });
        $('#board .ind').stop();
}
function undoTimer()
{
    $('#board .ind')
    .animate({height: 34}, 200)
    .find('.color').animate({ height: '28' }, 10);
    $('#board .ind').find('.abstr').css({ display: 'inline' });
    $('#board .ind').find('.btext').css({ display: 'none' });
    currentItem = null;
}

/*  */

