function showNote(posId,msg) {
    toolDisplayObj = document.getElementById(posId);
    if (toolDisplayObj) {
     toolDisplayObj.innerHTML = msg;
    } 
}

function clearInput(obj) {
    obj.value="";
    obj.onclick="";
}

function lightboxx(objID,mode,obj) {
    if(!document.getElementById("lightbox")) {
        lightboxOuter=document.createElement("span");
        lightboxOuter.id="lightboxOuter";
        lightbox=document.createElement("a");
        lightbox.href= "javascript:lightboxx('"+objID+"','self')";
        lightbox.title="close window";
        lightbox.className="lightbox";
        lightbox.id="lightbox";
        resizeLightBox();
        window.onresize= function() {
            resizeLightBox();
        };
        for(i=0; i<document.getElementsByTagName("select").length; i++) {
            document.getElementsByTagName("select")[i].style.visibility="hidden";
        }
        if (obj) {
            document.body.insertBefore(obj,document.body.firstChild);
        }
        document.body.insertBefore(lightboxOuter,document.body.firstChild);
        lightboxOuter.appendChild(lightbox);
    } else {
        window.onresize= "";
        for(i=0; i<document.getElementsByTagName("select").length; i++) {
            document.getElementsByTagName("select")[i].style.visibility="visible";
        }
        document.body.removeChild(document.getElementById('lightboxOuter'));
        if (mode=="self" && flashVars[objID]) { // ONLY FOR MOVIE PLAYER
            closeMovie(objID,"internal");
        } else if (obj) {
            document.body.removeChild(obj);
        } else if (mode=="self" && document.getElementById(objID)) {
            document.body.removeChild(document.getElementById(objID));
        }
    }
}
function resizeLightBox() {
    lightbox.style.height="0px";
    if (document.documentElement.scrollHeight>document.body.scrollHeight) {
        lightbox.style.height=document.documentElement.scrollHeight+"px"
    } else {
        lightbox.style.height=(document.body.scrollHeight)+"px";
    }
}

try {if(flashVars){}}catch (e){flashVars= new Array();}

flashBuilderSRC=""


function buildToolBox() {}
//function buildFontSizeButtons() {}

/* ROTATION SCRIPT */
/* define namespace */
var zo; // declares a global symbol
if (!zo) zo = {};
    else if (typeof zo != 'object')
        throw new Error('zo exists, but is not an object!');
zo.bannerRotator = function(options)
{
    this.conf = options;
    this.mv = null;
    this.pause = false;
    this.conf.pos = 0;
    this.conf.container = jQuery(this.conf.container);
    this.conf.items = this.conf.container.find(this.conf.items);
    this.arrange();
}
zo.bannerRotator.prototype.arrange = function()
{
    this.conf.container.css({position:'relative'});
    if (this.conf.items.length > 1) {
        this.conf.container.css({ 'height':this.conf.items.eq(0).outerHeight(true) });
        this.conf.items.css({position:'absolute', 'z-index':0}).not(':first').css({'z-index':1}).hide();
        this.freeze();
        this.rotate(false);
    }
}
zo.bannerRotator.prototype.freeze = function()
{
    var self = this;
    jQuery(this.conf.container).hover(
        function() {
            clearTimeout(self.mv);
        },
        function() {
            self.pause = false;
            self.rotate(true);
        }
    );
}
zo.bannerRotator.prototype.rotate = function(triggered)
 {
    var self = this,
        speed = 1000,
        duration = this.conf.duration[this.conf.pos],
        prev = this.conf.pos,
        pos = this.conf.pos === this.conf.items.length-1 ? 0 : this.conf.pos+1,
        curItem = this.conf.items.eq(prev),
        nextItem = this.conf.items.eq(pos)
    ;
    this.mv = setTimeout(function() {
        if (self.conf.container.height() <= self.conf.items.eq(pos).height()) {
            self.conf.container.css({ 'height':self.conf.items.eq(pos).outerHeight(true) });
        }
        self.conf.items.eq(pos).fadeIn(speed, function(){
            if (self.conf.container.height() > self.conf.items.eq(pos).height()) {
                self.conf.container.css({ 'height':self.conf.items.eq(pos).outerHeight(true) });
            }
            nextItem.css({'z-index':0});
            curItem.hide().css({'z-index':1});
            self.conf.pos = pos;
            if (self.pause !== true) {
                self.rotate(false);
            }
        }).end().eq(prev).fadeOut(speed);
    },(triggered === true ? speed : duration));
}
/* /ROTATION SCRIPT *//**
 * **********************************************************************  
 * **********************************************************************
 * Pagination
 *
 * @date 2009-09
 * @update 2009-12
 *
 * @version 0.1.6
 *
 *
 * @tested Firefox 3, IE6-7-8, WebKit
 * **********************************************************************
 * **********************************************************************
 */
/* define namespace */
var zo; // declares a global symbol
if (!zo) zo = {};
    else if (typeof zo != 'object')
        throw new Error('zo exists, but is not an object!');
zo.Pagination = 
{
    conf: {},
    init: function(options)
    {
        var conf = this.conf,
            filterSelector = ".langFiltered, .newsFiltered, .clientFiltered"
        ;
        conf[options.pid] = {
            'pid': options.pid,
            'ipp': options.ipp,
            'containerSelector': options.container,
            'itemsSelector': options.items,
            'enableNav': options.enableNav,
            'container': jQuery(options.container),
            'items': jQuery(options.container).find(options.items).not(filterSelector),
            'itemsShown': jQuery(options.container).find(options.items).not(filterSelector).not(':hidden'),
            'itemsShownCount': jQuery(options.container).find(options.items).not(filterSelector).not(':hidden').length,
            'pageCount': Math.ceil(jQuery(options.container).find(options.items).not(filterSelector).not(':hidden').length/options.ipp),
            'curPage': this.getHash(options.pid),
            'useHash': options.useHash
        };
        this.buildPageNav(options.pid);
        this.buildPages(conf[options.pid]);
    },
    buildPageNav: function(pid)
    { 
        var conf = this.conf[pid],
            pageNav = jQuery('<div><div>').addClass('pageNav'),
            pagePrev = jQuery('<span></span>').addClass('pagination pagePrev'),
            pagination = jQuery('<span></span>').addClass('pagination pages'),
            pageNext = jQuery('<span></span>').addClass('pagination pageNext')
        ;
        conf.pageCount = conf.pageCount === 0 ? 1 : conf.pageCount;
        if (conf.pageCount > 1) {
            if (conf.curPage > conf.pageCount) {
                location.hash = "";
                conf.curPage = 1;
            }
            pagePrev
                .css({opacity: (conf.curPage === 1 ? 0.4 : 1.0)})
                .addClass(conf.curPage === 1 ? 'disabled' : 'enabled')
                .append(jQuery('<a></a>')
                    .attr({
                        'href': (conf.curPage === 1 ? '' : '#' +(conf.curPage-1)),
                        'title': 'Previous'
                    })
                    .html('Prev')
                    .bind('click', function(ev) {
                        ev.preventDefault();
                        var className = jQuery(ev.target).closest('div.newsList').attr('class'),
                            pid = className.substring(className.indexOf('pid'))
                            conf = zo.Pagination.conf[pid]
                        ;
                        if (conf.curPage === 1) { return; }
                        zo.Pagination.changePage(conf, jQuery(ev.target).attr('href'));
                    })
                )
            ;
            pageNext
                .css({opacity: ((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? 0.4 : 1.0)})
                .addClass((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? 'disabled' : 'enabled')
                .append(jQuery('<a></a>')
                    .attr({
                        'href': ((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? '' : '#' +(conf.curPage + 1)),
                        'title': 'Next'
                    })
                    .html('Next')
                    .bind('click', function(ev) {
                        ev.preventDefault();
                        var className = jQuery(ev.target).closest('div.newsList').attr('class'),
                            pid = className.substring(className.indexOf('pid')),
                            conf = zo.Pagination.conf[pid]
                        ;
                        if (conf.curPage === conf.pageCount) { return; }
                        zo.Pagination.changePage(conf, jQuery(ev.target).attr('href'));
                    })
                )
            ;
            for (var i=1; i<=conf.pageCount; i++) {
                pagination
                    .append(jQuery('<a></a>')
                        .attr({
                            'href': '#' +i,
                            'title': 'Page ' +i
                        })
                        .addClass('page' +i)
                        .addClass(conf.curPage === i ? 'active' : '')
                        .text(i)
                        .bind('click', function(ev) {
                            ev.preventDefault();

                            var className = jQuery(ev.target).closest('div.newsList').attr('class'),
                                pid = className.substring(className.indexOf('pid')),
                                conf = zo.Pagination.conf[pid]
                            ; 
                            zo.Pagination.changePage(conf, jQuery(ev.target).attr('href'));
                        })
                    )
                ;
            }
            pageNav
                .append(pagePrev)
                .append(pagination)
                .append(pageNext)
                .appendTo(conf.containerSelector)
            ;
            if (conf.enableNav === false) pageNav.hide();
        }
    },
    buildPages: function(conf)
    {
        var conf = conf,
            sliceStart = 0,
            sliceEnd = conf.curPage*conf.ipp,
            itemsShown = conf.itemsShown
        ;
        if (conf.curPage > conf.pageCount) {
            if (conf.useHash) this.setHash(conf.pageCount, conf.pid);
            conf.curPage = conf.pageCount;
        }
        sliceStart = conf.curPage === 1 ? 0 : conf.ipp*(conf.curPage - 1);
        sliceEnd = conf.curPage === conf.pageCount ? conf.itemsShownCount : conf.ipp*conf.curPage;
        itemsShown
            .hide()
            .next('br')
            .hide()
            .end()
            .slice(sliceStart, sliceEnd)
            .show()
            .next('br')
            .show()
        ;
    },
    changePage: function(conf, target)
    { 
        var conf = conf,
            items = jQuery(conf.containerSelector+ ' ' +conf.itemsSelector),
            targetPage = parseInt(target.substring(1)),
            pagePrev = jQuery(conf.containerSelector+ ' div.pageNav span.pagePrev'),
            pageNext = jQuery(conf.containerSelector+ ' div.pageNav span.pageNext'),
            pageLinks = jQuery(conf.containerSelector+ ' div.pageNav span.pagination a')
        ;
        conf.curPage = targetPage;
        // set hash
        if (conf.useHash) this.setHash(targetPage, conf.pid);
        // mark active page
        pageLinks
            .removeClass('active')
            .filter('a.page' +targetPage)
            .addClass('active')
        ;
        // modify prev and next buttons
        pagePrev
            .css({opacity: (conf.curPage === 1 ? 0.4 : 1.0)})
            .removeClass(conf.curPage === 1 ? 'enabled' : 'disabled')
            .addClass(conf.curPage === 1 ? 'disabled' : 'enabled')
            .find('a')
            .attr('href', (conf.curPage === 1 ? '' : '#' +(conf.curPage-1)))
        ;
        pageNext
            .css({opacity: ((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? 0.4 : 1.0)})
            .removeClass((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? 'enabled' : 'disabled')
            .addClass((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? 'disabled' : 'enabled')
            .find('a')
            .attr('href', ((conf.pageCount === 1 || conf.curPage === conf.pageCount) ? '' : '#' +(conf.curPage + 1)))
        ;
        // change page
        this.buildPages(conf);
    },
    setHash: function(hash, pid) {
        if (location.hash === "") {
            location.hash = pid+ '_' +hash;
        } else {
            var locHash = location.hash.split('&'),
                hashVal = {}
            ;
            if (location.hash.indexOf(pid) > -1) {
                if (locHash.length > 1) {
                    jQuery.each(locHash, function(i) {
                        if (this.indexOf(pid) > -1) {
                            locHash[i] = pid+ '_' +hash;
                        }
                    });
                    location.hash = locHash.join('&');
                } else {
                    if (locHash[0].indexOf(pid) > -1) {
                        location.hash = pid+ '_' +hash;
                    } else {
                        location.hash = locHash.join('_')+ '&' +pid+ '_' +hash;
                    }
                }
            } else {
                if (location.hash.length > 0) {
                    location.hash = location.hash+ '&' +pid+ '_' +hash;
                } else {
                    location.hash = pid+ '_' +hash;
                }
            }
        }
    },
    getHash: function(pid) {
        var locHash = location.hash,
            newHash = 1
        ;
        if (locHash.indexOf(pid) > -1) {
            locHash = locHash.split('&');
            jQuery.each(locHash, function(i) {
                if (this.indexOf(pid) > -1) {
                    newHash = parseInt(this.split('_')[1]);
                }
            });
            return newHash;
        }
        else {
            return 1;
        }
    },
    reload: function(pid, className)
    {
        var conf = this.conf[pid],
            items = jQuery(conf.containerSelector).find(conf.itemsSelector).not(className),
            pageNav = jQuery('div.' +pid+ ' div.pageNav')
        ;
        items
            .show()
            .next('br')
            .show()
        ;
        pageNav.remove();
        this.init({
            'ipp': conf.ipp,
            'pid': conf.pid,
            'container': conf.containerSelector,
            'items': conf.itemsSelector,
            'enableNav': conf.enableNav
        });
    }
};//



// ******************** 
// Topmenu hover function (for IE - make hover available for other than a-tag)
// ********************
var hoverBase;
sfHover = function() {

    guidsToParse="";
    if (document.getElementById("list_main1") && document.getElementById("list_main1").hasChildNodes()){
        var sfEls = document.getElementById("list_main1").childNodes;
        for (var i=0; i<sfEls.length; i++) {

            if(typeof(mainNaviJSON)!='undefined') {
                for (var projectGuid in mainNaviJSON) {
                    if (guidsToParse.search(projectGuid)!=-1 && typeof(mainNaviJSON[projectGuid])!='undefined') {
                        var extNavJSON=mainNaviJSON[projectGuid][0];
if(typeof(extNavJSON)!='undefined') {
                        for (var j=0; j<extNavJSON.length; j++) {
                            if (extNavJSON[j].headline==sfEls[i].childNodes[0].innerHTML) { 
                                var createExtHovNav=1;
                                if (sfEls[i].childNodes[1]) {


                                    sfEls[i].removeChild(sfEls[i].childNodes[1]);



                                }
                                if (createExtHovNav==1) {
                                    sfEls[i].childNodes[0].href=extNavJSON[j].href;
                                    sfEls[i].childNodes[0].target=extNavJSON[j].target;
                                    sfEls[i].childNodes[0].id=extNavJSON[j].id;
                                    if (extNavJSON[j].nav!="") {
                                        var obj=extNavJSON[j].nav;
                                        var newUl=document.createElement("ul");
                                        newUl.className="horNav";
                                        newUl.id="extHovNav_"+obj.headline;
                                        for (var k=0; k<obj.length; k++) {
                                            if (obj[k].href) {
                                                var newLi=document.createElement("li");
                                                newLi.className=obj[k].li_class;
                                                var newA=document.createElement("a");
                                                newA.href=obj[k].href;
                                                newA.id=obj[k].id;
                                                obj[k].target? newA.target=obj[k].target : "";
                                                newA.className=obj[k].className;
                                                newA.innerHTML=obj[k].headline;
                                                newLi.appendChild(newA);
                                                newUl.appendChild(newLi);
                                            }
                                        }
                                        sfEls[i].appendChild(newUl);
                                    }
                                }
                            }
                        }
}
                    }
                }
            }


            if (sfEls[i].childNodes[1]) {
                sfEls[i].onmouseover=function() {
                    this.className.search(/sfhover.+/)==-1 ? this.className="sfhover "+this.className : "";

                    // iframe in SmartEdit - commented out by BH 25.03.2010
                    /*if (document.all) { // if IE, create iframe 'base layer' to prevent select boxes from shining through
                        hoverBase=document.createElement("iframe");
                        hoverBase.style.height=this.childNodes[1].offsetHeight+"px";
                        hoverBase.className="hoverBase";
                        hoverBase.src="/de/img/tran_pxl.gif";
                        this.insertBefore(hoverBase,this.firstChild);
                    }*/
                }
                sfEls[i].onmouseout=function() {
                    this.className=this.className.replace(new RegExp("sfhover\\b"), "");
                    document.all ? this.removeChild(hoverBase) : ""; // if IE, delete iframe 'base layer' 
                }
            }

        }
    }

};
// ******************** END


addEvent( window, "load", sfHover );

///* BACKGROUND PADDING */

/* define namespace */
var zo; // declares a global symbol
if (!zo) zo = {};
    else if (typeof zo != 'object')
        throw new Error('zo exists, but is not an object!');
zo.cBg = {
    init: function() {
        this.resizeBg();
        this.switchBg();
    },
    resizeBg: function() {
        var w = jQuery(window),
            wWidth = w.width(),
            c = jQuery('div#layoutPositioner'),
            cWidthOuter = cWidthOrigin = c.outerWidth(),
            cWidthInner = c.width(),
            originPadding = newPadding = parseInt((cWidthOuter - cWidthInner)/2, 10)
        ;
        w.bind('resize', function() {
            wWidth = w.width();
            cWidthOuter = c.outerWidth();
            switch (true) {
                case ((wWidth < cWidthOuter && wWidth > cWidthInner) || (wWidth > cWidthOuter && wWidth < cWidthOrigin)):
                    // window width inside the width with padding
                    newPadding = (wWidth-cWidthInner)/2;
                    newPadding = newPadding > 0 ? newPadding : "0";
                    newPadding = "0 " +(newPadding.toString(10)+ "px");
                    break;
                case (wWidth < cWidthInner):
                    // window width is lesser than content width
                    newPadding = "0";
                    break;
                case (wWidth > cWidthOrigin):
                    // window width is greater than content width with padding
                    newPadding = "0 " +(originPadding.toString(10)+ "px");
                    break;
            }
            c.css('padding', newPadding);
        });
    },

    switchBg: function() {
        jQuery('a.switch').bind('mouseover', function(ev) {
            ev.preventDefault();




            
            var swClass = jQuery(this).attr('href').split('#'),
                acClass = jQuery.trim(jQuery('div[class*=bgImg-]').attr('class')).match(/bgImg-.+/)[0]
            ;
            if (swClass[1] !== acClass) {
                var leftPos = swClass[1].split('-');
                leftPos = parseInt(leftPos[1]+35) - 95;
                
                // move arrow and text
                jQuery('img#arrow').css('left', leftPos);
    
                jQuery('div#hoverText')
                    .css('left',leftPos-125)
                    .children().hide()
                    .end()
                    .children('span#'+swClass[1]).show();
                jQuery('div[class*=bgImg-]').removeClass(acClass).addClass(swClass[1]);
            }
        }).bind('click', function(ev) {
            ev.preventDefault();

            // change background
            var acClass = jQuery.trim(jQuery('div[class*=bgImg-]').attr('class')).match(/bgImg-.+/)[0],
                newClass = acClass + "_box";
            jQuery('div[class*=bgImg-]').removeClass(acClass).addClass(newClass);
            
            // show featurebox
            jQuery('div#homeboxHebel').hide();
            jQuery('div#featureBox').show();

            jQuery(this).unbind('mouseout');
                        
            // jump to subpage
            if(jQuery(this).attr('id') != "") {
                var subpage = "#_" + jQuery(this).attr('id');
                jQuery('div#featureBox a[href*='+subpage+']').trigger('click');
            }




        
        });
    }
};



jQuery(function() {
    zo.cBg.init();
    jQuery(window).trigger('resize');
});

/* /BACKGROUND PADDING *//**
 * **********************************************************************
 * **********************************************************************
 * First level drop down Navigation
 *
 * @author Stefan Kloiber, zero+ones
 * @date 2010-02
 *
 * @version 0.0.1
 *
 * @dependencies: jQuery 1.4.2
 *
 * @tested Firefox 3, IE 7
 * **********************************************************************
 * **********************************************************************
 */


/* define namespace */
var zo; // declares a global symbol
if (!zo) zo = {};
    else if (typeof zo != 'object')
        throw new Error('zo exists, but is not an object!');


zo.peDropDown =
{
    init: function(navJSON)
    {
        this.getNav('ul#list_main1', {file:navJSON, delay:500}, zo.peDropDown.navi.slideDown);
    },

    getNav: function(navId, optMap, callback)
    {
        // load the JSON data
        jQuery.getJSON(optMap.file, function(data, textStatus) {
            if (textStatus === 'success') {
                // wait till the dom is ready
                jQuery(function() {
                    // get the active navigation items
                    var actNav = jQuery(navId+ ' a.active'),
                        // render the whole navigation tree with the JSON data
                        fullNav = zo.peDropDown.buildNav(data)
                    ;
                    // walk through the active nav items and mark the equivalent item in the whole nav tree
                    actNav.each(function(i) {
                        fullNav
                            .find('a[id="' +jQuery(actNav[i]).attr('id')+ '"]')
                            .addClass('active')
                            .closest('li')
                            .addClass('activeLi')
                        ;
                    });
                    // replace the static navigation with the rendered nav
                    jQuery(navId).replaceWith(fullNav);
                    // set the height of the list-elements
                    fullNav.find('ul.level1_1').each(function(key) {
                        jQuery(this).find('>li')
                            .height(jQuery(this).innerHeight()
                                -(
                                    parseInt(jQuery(this).css('padding-bottom'))
                                    +parseInt(jQuery(this).find('>li').eq(0).css('margin-top'))
                                    +parseInt(jQuery(this).find('>li').eq(0).css('margin-bottom'))
                                    +parseInt(jQuery(this).find('>li').eq(0).css('padding-bottom'))
                                    +parseInt(jQuery(this).find('>li').eq(0).css('padding-top'))
                                )
                            )
                        ;
                    });
                    // dispatch the dropdown ability
                    callback.call();
                });
            }
        });
    },

    /**
     * render the navigation from a json structure
     * 
     * @attribute   (Object)     data       the navigation array
     * @attribute   (String)     depth      navigation level, default "1"
     * @attribute   (Number)     z          numerical navigation level, default 0
     */
    buildNav: function(data, depth, z)
    {
        var tmpUl, tmpLi,
            depth = depth || "1",
            z = z || 0,
            rdDepth = 2 // render depth
        ;
        jQuery.each(data, function(i) {
            if(typeof data[i].id !== "undefined") {
                // create the list container
                if (i === 0) {
                    tmpUl = jQuery('<ul></ul>').addClass('level' +depth+ ' horNav');
                }
                // create the list item
                tmpLi = jQuery('<li></li>')
                    .addClass(data[i].li_class)
                    .append(jQuery('<a></a>')
                        .attr({
                            href: data[i].href,
                            id: data[i].id,
                            target: data[i].target
                        })
                        .html(data[i].headline)
                        .attr('title', function() { return jQuery(this).text(); })
                    )
                ;
                // got children?
                if (typeof data[i].nav === 'object' && data[i].nav.length > 0 && z < rdDepth) {
                    // raise depth
                    depth += "_1";
                    z++;
                    // recursive call
                    tmpLi.append(zo.peDropDown.buildNav(data[i].nav, depth, z));
                    // change depth back
                    depth = depth.substring(0, depth.length-2);
                    z--;
                }
                // mount list items
                tmpUl.append(tmpLi);
            }
        });
        return tmpUl;
    },

    /**
     * drop down ability
     * 
     */
    elem: "",
    zindex: 100,
    increaseZIndex: function()
    {
        zo.peDropDown.zindex++;
        return zo.peDropDown.zindex;
    },
    decreaseZIndex: function()
    {
        zo.peDropDown.zindex--;
        return zo.peDropDown.zindex;
    },
    navi:
    {
        slideDown: function() {
            var focused;
            jQuery('*').bind('focus', function(ev) {
                focused = ev.target;
            });
            // handle the navigation with the mouse
            var duration = {slideDown:500, slideDownTimeout:500, slideUp:0, slideUpTimeout:500},
                level1Navi = jQuery('div#level1Navi'),
                maxHeight = 0;
            level1Navi.find('>ul>li>ul').each(function() {
                maxHeight = jQuery(this).outerHeight() > maxHeight ? jQuery(this).outerHeight() : maxHeight;
            });
            jQuery('div#level1Navi li').hover(
                // mouseover action
                function() {
                    // save the event target (this) to a variable to use it in another scope (in this case inside the setTimeout method)
                    var self = jQuery(this),
                        zindex, posLeft;
                    // proceed if the event target is not the current active element or lays not in the third navigation level
//                    if (self.hasClass('activeLi') === false || self.parent().hasClass('level1_1')) {
                        // increase z-index
                        zindex = zo.peDropDown.increaseZIndex();
                        // first navigation level
                        if (self.closest('ul').hasClass('level1'))
                        {
                            jQuery(document).bind('mouseover', function(ev) {
                                zo.peDropDown.elem = ev.target;
                            });
                            // use a delay to avoid direct changes in the second level
                            setTimeout(function() {
                                // change the navigation if the mouse is still over the same navigation element
                                if (jQuery(zo.peDropDown.elem).closest('li')[0] === self[0]) {
                                    var mpUl = self.find('>ul'),
                                        mpLiCount = mpUl.children('li').length,
                                        // currently seven cols will fit in one row
                                        mpLiRows = !mpUl.data('hovered') ? Math.ceil(mpLiCount/7) : 1,
                                        //mpHeight = mpUl.height() * mpLiRows;
                                        mpHeight = mpUl.height();
                                    mpUl.data('hovered', true);
                                    duration.slideDown = mpHeight * 2;
                                    mpUl
                                        .css({'z-index':zindex})
                                        .slideDown(duration.slideDown);
                                        //.animate({height:mpHeight}, duration.slideDown, 'linear')
                                }
                                jQuery(document).unbind('mouseover');
                            },duration.slideDownTimeout);
                        }
                        // second navigation level
                        // show the third navigation level (drop down) without any delay
//                        else
//                        {
//                            var posLeft = parseInt(self.offset().left - jQuery('div#level1Navi ul').offset().left - 10, 10);
//                            self
//                                .find('>ul')
//                                .css({
//                                    left:posLeft,
//                                    'z-index':zindex
//                                })
//                                .slideDown(0)
//                            ;
//                        }
//                    }
                },
                // mouseout action
                function() {
                    // save the event target (this) to a variable to use it in another scope (in this case 
                    // inside the setTimeout method)
                    var self = jQuery(this);
//                    if (self.hasClass('activeLi') === false || self.parent().hasClass('level1_1')) {
                        // first navigation level
                        if (self.closest('ul').hasClass('level1')) {
                            jQuery(document).bind('mouseover', function(ev) {
                                zo.peDropDown.elem = ev.target;
                            });
                            // use a delay to avoid direct changes in the second level
                            setTimeout(function() {
                                // hide the second navigation layer in case of not equal and in first level or 
                                // if the mouse position is not inside the navigation element
                                if ((jQuery(zo.peDropDown.elem).closest('li')[0] !== self[0] && jQuery(zo.peDropDown.elem).closest('ul').hasClass('level1'))
                                    || (jQuery(zo.peDropDown.elem).parents('div#level1Navi').length < 1))
                                {
                                    self
                                        .find('>ul')
                                        .delay(duration.slideUp)
                                        .slideUp(duration.slideUp)
                                    ;
                                }
                                jQuery(document).unbind('mouseover');
                            },duration.slideUpTimeout);
                        }
                        // second navigation level
//                        else
//                        {
//                            self
//                                .find('>ul')
//                                .slideUp(0);
//                        }
//                    }
                }
            );
        }
    }
};

/** init level1 navigation */
zo.peDropDown.init('/de/data/js/naviJSON.php');

/* *///


function clearInputVal(elem) {
    alert('clear');
}

printPageURL="/de/data/js/print_popup.htm";
function buildToolBox(boxPosition,printOpt,sendafriendOpt,bookmarkOpt,feedbackOpt,trckPrefix) {
 if("ON"=="ON") {
    clearToolbarNote =function(e) {
        showNote("ToolBarNote_"+boxPosition,"")
    };
    document.write("<span id='toolBarArea_"+boxPosition+"'></span>");
    toolBarOuter=document.createElement("div");
    toolBarOuter.id="ToolBar_"+boxPosition;
    toolBarOuter.className="toolBarOuter";
    
        
    

    //boxPosition=="bottom" ? toolBarOuter.style.paddingTop="10px" : "";
    toolBarOuter.style.paddingTop="";

    toolBarNote=document.createElement("span");
    toolBarNote.id="ToolBarNote_"+boxPosition;
    toolBarNote.className="ToolBarNote";
    toolBarNote.innerHTML="&nbsp;";
    toolBarInner=document.createElement("div");
    toolBarInner.className="toolBarInner";
    document.getElementById("toolBarArea_"+boxPosition).appendChild(toolBarOuter);//
    toolBarOuter.appendChild(toolBarNote);
    toolBarOuter.appendChild(toolBarInner);
    buttonMargin=6;


    if ("ON"!="OFF" && bookmarkOpt!="OFF") {
        toolBarBookmark=document.createElement("a");
        toolBarBookmark.title="Add bookmark";
        toolBarBookmark.style.marginRight=buttonMargin+"px";
        toolBarBookmark.className="toolBarBookmark";
        toolBarBookmark.onclick=function(e) {
            setBookmark();
        };
        if (boxPosition != 'bottom') {
            toolBarBookmark.onmouseover=function(e) {
                showNote("ToolBarNote_"+boxPosition,"Bookmark");
            };
            toolBarBookmark.onmouseout=clearToolbarNote;
        }
        buttonMargin=6;
        toolBarInner.appendChild(toolBarBookmark);
    }


    if ("ON"!="OFF" && sendafriendOpt!="OFF" && "/de/data/php/sendafriend.php"!="") {
        var sendafriendLayer = jQuery('<div id="sendafriendLayer"></div>')
                .append(jQuery('<div class="header"></div>'))
                .append(jQuery('<div class="inner"></div>')
                    .append(jQuery('<a href="#close" title="close window" class="closeButton font2" onclick="jQuery.fancybox.close();">close window</a>'))
                    .append(jQuery('<h1>Recommend this page</h1>'))
                    .append(
                        setForm()
                    )
                    .append(jQuery('<p class="footer font2">Copyright &copy; Xella Group, Duisburg</p>'))
                )
        ;

        toolBarInner.appendChild(
            jQuery('<a href="#sendAfriend" class="toolBarSendafriend" style="margin-right:' +buttonMargin+ 'px;" title="Recommend this page"></a>')
                .bind({
                    mouseover: function() { if (boxPosition != 'bottom') showNote('ToolBarNote_' +boxPosition, 'E-mail'); },
                    mouseout: function() { if (boxPosition != 'bottom') showNote('ToolBarNote_' +boxPosition, ''); }
                })
                .fancybox({content:sendafriendLayer, titleFormat:null, titleShow:false})
                .get(0)
        );
        buttonMargin=6;
    }


    if ("ON"!="OFF" && printOpt!="OFF") {
        toolBarInner.appendChild(
            jQuery('<span></span>')
                .append(jQuery('<a href="#print" title="Print this page" class="toolBarPrint"></a>')
                    .bind({
                        click: function(ev) {
                            ev.preventDefault();
                            window.print();
                        },
                        mouseover: function() { if (boxPosition != 'bottom') showNote('ToolBarNote_' +boxPosition, 'Print'); },
                        mouseout: function() { if (boxPosition != 'bottom') showNote('ToolBarNote_' +boxPosition, ''); }
                    })
                )
                .get(0)
        );
        buttonMargin=10;
    }




    if ("OFF"!="OFF" && feedbackOpt!="OFF" && "https://secure.deutsche-bank.de/feedbackmanager/"!="") {
        toolBarFeedback=document.createElement("a");
        toolBarFeedback.title="Vote this page";
        toolBarFeedback.style.marginLeft=buttonMargin+"px";
        toolBarFeedback.className="toolBarFeedback";
        toolBarFeedback.onclick=function(e) {
            loadToolBoxIFrame("https://secure.deutsche-bank.de/feedbackmanager/?lang=en&decorator=dbag&","736","700");
        };
        toolBarFeedback.onmouseover=function(e) {
            showNote("ToolBarNote_"+boxPosition,"Feedback");
        };
        toolBarFeedback.onmouseout=clearToolbarNote;
        buttonMargin=6;
        toolBarInner.appendChild(toolBarFeedback);
    }

  }
}


/** form handling */
var validMailAddress = /^[\d\w!\#\$%&\'*+\-/=?\^_`{|}~]+(\.?([\d\w!\#\$%&\'*+\-/=?\^_`{|}~]+\.)*[\d\w!\#\$%&\'*+\-/=?\^_`{|}~]+)?\@(([a-zA-Z0-9]+-?)*[a-zA-Z0-9]+\.)+[a-zA-Z]{2,6}$/,
clearInputVal = function(elem) {
    var $this = jQuery(elem);
    if ($this.val() === 'name@domain.tld') { $this.val('').removeClass('default'); }
},
checkInputVal = function(elem) {
    var $this = jQuery(elem);
    if ($this.hasClass('required')) {
        if ($this.val() && $this.val() !== 'name@domain.tld' && !$this.val().match(validMailAddress)) { $this.addClass('ERROR'); }
        else if ($this.hasClass('ERROR')) { $this.removeClass('ERROR'); }
    }
    if (!$this.val()) { $this.val('name@domain.tld').addClass('default'); }
},
checkInputVals = function(elem) {
    var $form = jQuery(elem),
        $input = $form.find('input:text'),
        validate = true;
    $input.each(function(i) {
        var $this = jQuery(this);
        if ($this.hasClass('required') && validate == true) {
            if (!$this.val() || $this.val() === 'name@domain.tld' || $this.hasClass('ERROR')) {
                validate = false;
                jQuery($input[i]).addClass('ERROR');
            }
        }
    });

    if(validate == true) {
        /*
            jQuery.ajax({
                type:'POST',
                async: false,
                url: $form.attr('action'),
                data: $form.serialize(),
                success: function(data, textStatus) { 
                    returnValue = data.replace (/^\s+/, '').replace (/\s+$/, '');
                            
                    if(returnValue == "mailSent"){
                        $form.replaceWith(jQuery('<div id="messageBlock"><p>The page was recommended to the recipient.</p></div>').append(jQuery('<p></p>').append('<a href="#" onclick="jQuery(\'div#messageBlock\').replaceWith(setForm());">Recommend this page again</a>')));   
                    } else {
                        $form.replaceWith(jQuery('<p>There was an error, please try again.</p>'));   
                    }
                }
            });
        */

        jQuery.post($form.attr('action'),$form.serialize(),function(data,textStatus){
            returnValue = data.replace (/^\s+/, '').replace (/\s+$/, '');
            
            if(returnValue == "mailSent"){
                $form.replaceWith(jQuery('<div id="messageBlock" style="margin-bottom: 150px;"><p>The page was recommended to the recipient.</p><br /></div>').append(jQuery('<p></p>').append('<a href="#" onclick="jQuery(\'div#messageBlock\').replaceWith(setForm());">Recommend this page again</a>')));   
            } else {
                $form.replaceWith(jQuery('<div id="messageBlock" style="margin-bottom: 150px;"><p>There was an error, please try again.</p><br /></div>').append(jQuery('<p></p>').append('<a href="#" onclick="jQuery(\'div#messageBlock\').replaceWith(setForm());">Recommend this page again</a>')));   
            }
        });
    }
    return false;
};


function setForm() {
    var ownUrl = location.href;
        
    if(location.hash) {
        ownUrl = ownUrl.substring(0,ownUrl.indexOf('#'));
    }
    var $form = jQuery('<form id="sendafriendForm" method="post" action="/de/data/php/sendafriend.php" onsubmit="return checkInputVals(this)"></form>')
                        .append(jQuery('<p>I would like to recommend this page:</p><br />'))
                        .append(jQuery('<label for="sendafriendFormRecipient" class="font2">Recipient Email:</label>'))
                        .append(jQuery('<input type="text" class="sendafriendAddressfield default required" id="sendafriendFormRecipient" name="sendafriendFormRecipient" value="name@domain.tld" onfocus="clearInputVal(this);" onblur="checkInputVal(this);" /><br /><br />'))
                        .append(jQuery('<label for="sendafriendFormSender" class="font2">Sender Email:</label>'))
                        .append(jQuery('<input type="text" class="sendafriendAddressfield default required" id="sendafriendFormSender" name="sendafriendFormSender" value="name@domain.tld" onfocus="clearInputVal(this);" onblur="checkInputVal(this);" />'))
                        .append(jQuery('<input type="hidden" name="url" value="' + ownUrl + '" />'))
                        .append(jQuery('<input type="submit" class="submit" value="Send" />'));

    return $form;                        
}



/* handle >bookmark< klick */
function setBookmark() {
    ap=navigator.appName;
    url=location.href;
    t=document.getElementsByTagName("title")[0].innerHTML;
    if (window.sidebar) {
        window.sidebar.addPanel(t,url,'');
    } else if (window.external) {
        window.external.AddFavorite(url,t);
    } else if (window.addNet) {
        addNet(url,t);
    } else {
        alert("Ihr Browser unterst&uuml;tzt diese Funktion nicht.\nBitte Legen Sie das Lesezeichen manuell an.");
    }
}
var toolBoxParent;
function loadToolBoxIFrame(boxSrc,boxWidth,boxHeight) {
    document.getElementById("toolBoxParent") ? document.body.removeChild(document.getElementById("toolBoxParent")) : "";
    toolBoxParent=document.createElement("div");
    toolBoxParent.id="toolBoxParent";
    toolBox=document.createElement("div");
    toolBox.className="toolBox";
    toolBox.id="toolBox";
    toolBoxClose=document.createElement("a");
    toolBoxClose.className="toolBoxClose icon close";
    toolBoxClose.id="closeButton";
    toolBoxClose.href="javascript:void(0)";
    toolBoxClose.onclick= function() {
        toolBox.removeChild(toolBoxIFrame);
        lightboxx('toolBoxParent','self');
    };
    toolBoxClose.innerHTML="close window";
    toolBoxIFrame=document.createElement("iframe");
    toolBoxIFrame.className="toolBoxIFrame";
    toolBoxIFrame.id="toolBoxIFrame";
    toolBoxIFrame.setAttribute("scrolling","No");
    toolBoxIFrame.setAttribute("frameBorder","0");
    myfunction= function(e) {document.getElementById("closeButton").style.display="inline";}
    toolBoxIFrame.attachEvent ? toolBoxIFrame.attachEvent("onload", myfunction) : toolBoxIFrame.onload = myfunction;
    toolBoxIFrame.style.width=boxWidth+"px";
    toolBoxIFrame.style.height=boxHeight+"px";
    lightboxx('toolBoxParent','insert',toolBoxParent);
    toolBoxParent.appendChild(toolBox);
    toolBox.appendChild(toolBoxClose);
    toolBox.appendChild(toolBoxIFrame);
    document.getElementById(toolBoxIFrame.id).src=boxSrc;
    window.scrollTo(100, 100);
}
 

// Cookie handling
function createCookie(name,value,hours)
{
 if (hours)
 {
  var date = new Date();
  date.setTime(date.getTime()+(hours*60*60*1000));
  var expires = "; expires="+date.toGMTString();
 }
 else var expires = "";
 document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++)
 {
  var c = ca[i];
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 }
 return null;
}
function eraseCookie(name)
{
 createCookie(name,"",-1);
}



/** FONT AND CONTRAST TOGGLING */

var buildFontToggleButtons = function() {
    jQuery('<div id="fontToggleButtons"></div>')
        .append(buildButtons('fontToggle','font_large','Change text size'))
        .append(buildButtons('contrastToggle','contrast_high','Change Contrast'))
        .prependTo('#ToolBar_bottom')
    ;
},
buildSocialMediaButtons = function(sm) {
    jQuery('<div id="socialMediaButtons"></div>')
        .prependTo('#toolBarArea_bottom');
    for (var item in sm) {
        jQuery('#socialMediaButtons')
            .append('<div><a href="' + sm[item].url + '" target="' + sm[item].target + '"><img alt="' + sm[item].title + '" title="' + sm[item].title + '" src="' + sm[item].img + '"/></a></div>');
    }
},
buildButtons = function(type, state, text) {
    if (jQuery.cookie(type)) { state = jQuery.cookie(type); }
    var button = jQuery('<div id="' +type+ '" class="' +state+ '"></div>')
        .attr('title', text)
        .bind('click', function(ev) {
            var $this = jQuery(this),
                parts = $this.attr('class').split('_');
            if (parts[0] == 'contrast') {
                if (parts[1] == 'low') {
                    jQuery('link#css_contrast').removeAttr('href');
                    $this.attr('class', 'contrast_high');
                    jQuery.cookie(type, null);
                } else {
                    jQuery('link#css_contrast').attr('href','/de/data/css/966.css');
                    $this.attr('class', 'contrast_low');
                    jQuery.cookie(type, 'contrast_high', {expires:7});
                }
            } else {
                if (parts[1] == 'small') {
                    jQuery('link#css_font').attr('href','/de/data/css/font_size.css');
                    $this.attr('class', 'font_large');
                    jQuery.cookie(type, null);
                } else {
                    jQuery('link#css_font').attr('href','/de/data/css/965.css');
                    $this.attr('class', 'font_small');
                    jQuery.cookie(type, 'font_large', {expires:7});
                }
            }
        })
    ;
    if (jQuery.cookie(type)) { button.trigger('click'); }
    return button;
};function fadeStages(elements, waitTime, counter){
            jQuery(elements[counter]).children().first().stop(true, true);
            var element = jQuery(elements[counter]).children().first();
            if(counter < elements.length-1){
                var recCounter = (counter + 1);
            }
            else{
                var recCounter = 0;
            }
            //jQuery(element).delay(500);
            jQuery(element).fadeIn( function(){
                jQuery(element).delay(waitTime);
                jQuery(element).fadeOut( function(){
                        fadeStages(elements, waitTime, recCounter);
                    }
                );
            });
        }
      jQuery(document).ready(function(){
          jQuery("#mediastage").show();
          jQuery("#content_2").hide();
          jQuery("#content_3").hide();
          jQuery("#content_4").hide();
        jQuery("#stage_tab_2").hide();
        jQuery("#stage_tab_3").hide();
        jQuery("#stage_tab_4").hide();
        jQuery("#stage_tab_5").hide();
        jQuery("#stage_tab_6").hide();
        jQuery("#stage_tab_7").hide();
        jQuery(".stageImage").hide();
        jQuery(".stageImage").first().show();
        // When a link is hovered
        jQuery("a.tab").hover(function (){
            jQuery(".stageImage").hide();
            // switch all tabs off
            jQuery(".active").removeClass("active");
            // switch this tab on
            jQuery(this).addClass("active");
            jQuery(this).find("img").fadeTo('fast',0.5);
            jQuery(this).find("span").addClass('hoverArrow');
            // hide all elements with the class 'content'
            jQuery(".content").hide();
            // hide all elements with the class 'stage'
            jQuery(".stage").hide();
            //figure out what the 'title' attribute value is and find the element with that id.  Then show.
            var content_show = jQuery(this).attr("title");
            jQuery("#"+content_show).show();
        }, function(){
            jQuery(this).find("img").fadeTo('fast',1.0);
            jQuery(this).find("span").removeClass('hoverArrow');
        });
        jQuery("a.tab").hover(function(){
            var stage_show = jQuery(this).attr("id");
            var stage_show2 = "#stage_"+stage_show;
            var elements = jQuery(stage_show2).children();
            //show stage according to hovered tab
            jQuery(stage_show2).show();
            for(var j=0; j < elements.length; j++)
            {
                jQuery(elements[j]).find("img").stop(true, true);
            }
            if (elements.length > 1){
                //slideshow for hovered tab
                fadeStages(elements, 5000, 0);
            }
            else
            {
                jQuery(elements).first().children().first().fadeIn();
            }
        },function(){
            var stage_show = jQuery(this).attr("id");
            var stage_show2 = "#stage_"+stage_show;
            var elements = jQuery(stage_show2).children();
        });
      });/**
 * *****************************************************************************
 *
 * The dmf core package
 *
 *
 * @package:    dmf.core
 * @version:    0.1
 * @requires:   -
 * @author:     Stefan Kloiber <hello@10.fresh-flava.net>
 * @copyright:  c 2010    
 * 
 * $Revision: 22 $
 * $Author: stefan $
 * $Date: 2010-05-13 14:44:11 +0200 (Do, 13 Mai 2010) $
 *
 * *****************************************************************************
 */

(function(window) {
// define only one global symbol, named 'dmf'
var dmf = window.dmf =
{
    core:
    {
        // the current version of the core package
        version:0.1,
        // define a new class
        defineClass: function(name, config)
        {
            //
            var classname = name,
                superclass = config.extend || Object,
                constructor = config.construct || function() {},
                methods = config.methods || {},
                statics = config.statics || {},
                requires,
                provides
            ;
            // 
            if (!config.requires) requires = [];
            else if (config.requires instanceof Array) requires = config.requires;
            else requires = [ config.requires ];
            // 
            if (!config.provides) provides = [];
            else if (config.provides instanceof Array) provides = config.provides;
            else provides = [ config.provides ];
            // 
            var proto = new superclass();
            // 
            for (var p in proto)
                if (proto.hasOwnProperty(p)) delete proto[p];
            // check for requirements
            for (var i=-1, l=requires.length; ++i<l;) {
                var r = requires[i];
                if (window[ r.symbol ]) {
                    if (r.version && window[ r.symbol ].version) {
                        if (r.version === window[ r.symbol ].version) continue;
                        else throw new Error('Version clash');
                    }
                } else throw new Error(r.symbol+ ' is required!');
            }
            // 
            for (var p in methods) proto[p] = methods[p];
            // 
            proto.constructor = constructor;
            proto.superclass = superclass;
            // 
            if (classname) proto.classname = classname;
            // 
            for (var i=-1, l=provides.length; ++i<l;) {
                var c = provides[i];
                for (var p in c.prototype) {
                    if (typeof c.prototype[p] != "function") continue;
                    if (p == "constructor" || p == "superclass") continue;
                    if (p in proto &&
                        typeof proto[p] == "function" &&
                        proto[p].length == c.prototype[p].length) continue;
                    throw new Error('Class \'' +classname+ '\' doesn\'t provide the following methods: ' +c.classname + '.' +p);
                }
            }
            // 
            constructor.prototype = proto;

            // 
            for (var p in statics) constructor[p] = config.statics[p];
            // 
            return constructor;
        },
        // validates if a package with the given name already exists
        isDefined: function(name) {
            return name in this.packages;
        },
        // reference to the global namespace
        globalNamespace: this,
        // list of loaded packages
        packages: {},
        // define a package
        Package: function(name, version)
        {
            // check the validity of the given name: the name must be declared,
            // should not start or end with a dot or having one dot after 
            // another
            if (!name) throw new Error('dmf.core.package(): name required');
            if (name.charAt(0) == '.' ||
                name.charAt(name.length-1) == '.' ||
                name.indexOf('..') != -1)
                throw new Error('dmf.core.package(): illegal name: ' +name);
            // split the name at the dots and create the needed hierarchy
            var parts = name.split('.');
            // for each namespace component either a object will be initiated
            // or it will be ensured that the object still exists
            var container = dmf.core.globalNamespace;
            for (var i=-1, l=parts.length; ++i<l;) {
                var part = parts[i];
                // if the container doesn't hold a property with the name, a
                // empty container will be created
                if (!container[part]) container[part] = {};
                else if (typeof container[part] != "object") {
                    // if the property is already set, ensure that it is a
                    // object
                    var n = parts.slice(0,i).join('.');
                    throw new Error(n+ ' still exists, but is not an object!');
                }
                container = container[part];
            }
            // the last traversed container is the new namespace
            var namespace = container;
            // check if a name already exists for the new namespace
            if (namespace.NAME) throw new Error('Package ' +name+ ' already exists');
            // initialise name and version
            namespace.NAME = name;
            if (version) namespace.VERSION = version;
            // register the namespace into the list if all packages
            dmf.core.packages[name] = namespace;
            return namespace;
        }
    }
};
})(window);/**
 * *****************************************************************************
 *
 * The dmf utils package
 *
 *
 * @package:    dmf.utils
 * @version:    0.1
 * @requires:   dmf.core 0.1, jQuery 1.4.2
 * @author:     Stefan Kloiber <hello@10.fresh-flava.net>
 * @copyright:  c 2010 FreshFlava
 *
 * $Revision: 23 $
 * $Author: stefan $
 * $Date: 2010-05-13 14:46:47 +0200 (Do, 13 Mai 2010) $
 *
 * *****************************************************************************
 */
 
dmf.core.Package('dmf.utils', 0.1);
/**
 * String extensions
 *
 * endsWith: 
 * startWith: 
 * ucFirst: 
 *
 */
String.prototype.endsWith = function(str) {
    return this.match(/str$/) == str;
};
String.prototype.startsWith = function(str) {
    return this.match(/^str/) == str;
};
String.prototype.ucFirst = function() {
    var str = this.match(/^(\w{1})(\w*)/);
    return str[1].toUpperCase()+str[2];
};


dmf.utils = 
    dmf.core.defineClass('utils', {
        construct: function() {
            this.$doc = jQuery(document);
        },
        requires: [{symbol:'jQuery',version:'1.4.2'}],
        methods: {
            include: function(type, opt) {
                if (!type) throw new Error('type not set');
                if (!opt || typeof opt !== 'object') throw new Error('options not set');
                var $head = this.$doc.find('head');
                switch (type) {
                    case "js":
                    case "javascript":
                    case "JavaScript":
                        var $lastScript = $head.find('script[type=text/javascript]:last'),
                            inc = jQuery('<script type="text/javascript" src="' +opt.src+ '"></script>');
                        if ($lastScript.length) inc.insertAfter($lastScript);
                            else $head.append(inc);
                        break;
                    case "css":
                    case "stylesheet":
                    case "cascadingstylesheet":
                    case "CascadingStyleSheet":
                        // IE
                        if (document.createStyleSheet) document.createStyleSheet(opt.src);
                        // W3C DOM
                        else {
                            var $lastSheet = $head.find('link[type=text/css]:last'),
                                inc = jQuery('<link type="text/css" href="' +opt.src+ '" rel="stylesheet" media="' +opt.media+ '" />');
    
                            if ($lastSheet.length) inc.insertAfter($lastSheet);
                                else $head.append(inc);
                        }
                        break;
                }
            }
        }
    })
;/**
 * *****************************************************************************
 *
 * Xella Feature Box
 *
 *
 * @package:    xella.featureBox
 * @requires:   dmf.core 0.1, dmf.utils 0.1,
 *              jQuery 1.4.2, jQuery.ui 1.8.1, jQuery.cookie
 * @version:    0.1
 * @author:     Stefan Kloiber <s.kloiber@zeros.ones.de>
 * @copyright:  c 2010 zeros+ones, Agentur fuer neue Medien GmbH
 *
 * *****************************************************************************
 */
var fbFromAjax = false;

dmf.core.Package('xella.featureBox', 0.1);

xella.featureBox =
{
    curNavItem: null,
    curNavTimer: null,

    init: dmf.core.defineClass('xella.featureBox', {
        requires: [{symbol:'jQuery', version:'1.4.2'}],
        construct: function(options) {
            var _this = this;
            // check the application state
            this.stateCookieName = "fbState";
            this.state = this.getState();





            // save a root elemen reference
            this.$doc = jQuery(document);
            // featureBox container
            this.$fbContainer = options.featureBox
                ? this.$doc.find(options.featureBox)
                : this.$doc.find('div#featureBox');
            this.$fbContent = this.$fbContainer.children();

            // check for IE
            this.isIE = !jQuery.support.opacity ? true : false;
            // check for IE6
            this.isIE6 = (jQuery.browser.msie && jQuery.browser.version <= 6) ?
                true : false;

            //
            this.buildFeatureBox();
        },

        methods: {

            buildFeatureBox: function() { 
                // remove nodes from container
                this.$fbContainer.empty();
                // rebuild the featureBox
                this.$fbContainer.append(
                    '<div id="fbMain">'
                    + '<ul id="fbNav"></ul>'
                    + '<div id="fbContent"></div>'
                    + '</div>'
                );
                var _this = this,
                    content = this.parseContent(),
                    fbGlobal = content.global,
                    fbLocale = content.locale,
                    subInterval,
                    $fbNav = this.$fbContainer.find('ul#fbNav'),
                    $fbContent = this.$fbContainer.find('div#fbContent'),
                    $bgContainer = jQuery('#typeA #layoutPositioner');

                // global top
                if (fbGlobal.top) {
                    this.$fbContainer.prepend('<div id="fbTop">' +fbGlobal.top.html()+ '</div>');
                }
                // content
                for (var i=-1, l=fbLocale.length; ++i<l;) {
                    var item = fbLocale[i],
                        ident = "";
                    // first nav level
                    $fbNav.append(
                        jQuery(item.navItem).find('a').bind('click', function(ev) {
                            ev.preventDefault();
                            var $this = jQuery(this),
                                $elem = jQuery('div#featureBox div#fbContent')
                            ;

                            // former method doesn't work with RedDot/IE
                            //ident = $this.attr('href').substring(2);
                            ident = jQuery(this).attr('href').split("#_");
                            ident = ident[1];

                            // hide overlay gallery
                            if ($elem.find('div.overlayFrame').length) {
                                $elem.find('div.overlayFrame').remove();
                            }

                            // set active nav item
                            $this.parent()
                                .addClass('active')
                                .siblings().removeClass('active')
                                .find('li').removeClass('active')
                                .end().end()
                                .find('li:first').addClass('active')
                                .siblings().removeClass('active')
                                .parent()
                                .children()
                                .find('li').removeClass('active');







                            // display content
                            $elem
                                .find('>div').hide()
                                .filter('div#' +ident).show()
                            ;
                            $elem =  $elem.find('div#' +ident);
                            // scrollable content
                            if ($elem.find('div.scrollable').length) {
                                // scrollable content
                                $elem.find('div.fbcontent')
                                    .scrollable({vertical:true, mousewheel:true, clickable:false, size:4})
                                ;
                            }

                            // image tooltip on news items
                            _this.newsTooltip($elem);



                            // scroll bar news
                            if($elem.find('div.news').length){
                                jQuery('#scroll-pane100').jScrollPane({showArrows:true,scrollbarWidth:16});
                            }



                            // photo gallery: references
                            if ($elem.find('div.fbcontent div.referenceGallery div.galleryItem').length) {
                                _this.switchGalleryItem($elem);
                            } else {
                                // remove background image on page change (if no reference gallery is set)
                                $elem
                                    .find('div.fbcontent')
                                    .css('background-image', 'none')
                                    .find('div.descriptionNew')
                                    .remove();
                            }

                            // photo gallery: overlay
                            if ($elem.find('div.fbcontent div.overlayGallery div.galleryItem').length) {
                                _this.showOverlayItem($elem);
                            }

                            // check for a second level navigation
                            if (jQuery('div#featureBox div#fbContent').find('div#' +ident+ ' div.submenu').length) {
                                jQuery('div#featureBox div#fbContent')
                                    .find('div#' +ident+ ' div.submenu div.subpage').hide()
                                    .end()
                                    .find('div#' +ident+ ' div.submenu div.subpage:first').show()
                                    .end()
                                    .find('div.subnavigationRight li').removeClass('active')
                                    .end()
                                    .find('div.subpageContent').css('right','-415px');

                                    // first close interval if already existing
                                    if(typeof(subInterval) !=  "undefined"){
                                        window.clearInterval(subInterval);
                                    }

                                    var numberOfSubpages = jQuery('div#featureBox div#fbContent').find('div#' +ident+ ' div.subpage').length,
                                        counter = 1;

                                    // trigger first subpage at the beginning
                                    jQuery('div#featureBox div#fbContent')
                                        .find('div#' +ident+' a[href*=#_' +ident+ 'Sub0]')
                                        .trigger('click');

                                    // interval for opening subpages
                                    subInterval = window.setInterval(function(){
                                        jQuery('div#featureBox div#fbContent')
                                            .find('div#' +ident+' a[href*=#_' +ident+ 'Sub' + counter +']')
                                            .trigger('click',[true]);

                                        if(counter == numberOfSubpages-1) {
                                            counter = 0;
                                        } else {
                                            counter++;
                                        }

                                    },5000);

                            } else {
                                // close interval if existing
                                if(typeof(subInterval) !=  "undefined"){
                                    window.clearInterval(subInterval);
                                }
                            }

                            // Title-Flash-Hash Bug in IE
                            if(_this.isIE) {
                                fixAnchorTitleBug();
                            }

                        })



                        .end()
                    );

                    // add and hide content
                    $fbContent.append(jQuery(item.content).hide());

                    // second nav level
                    if (item.subNavItems) {

                        $fbContent.find('div#'+item.ident+' div.submenu')
                            .append(jQuery('<div class="subnavigationRight"></div>')).find('div.subnavigationRight')
                            //.append('<h3>'+$fbNav.find('li:last').text()+'</h3>')
                            .append(
                                jQuery(item.subNavItems).find('a').bind('click', function(ev, isTrigger) {
                                    ev.preventDefault();
    
                                    // former method doesn't work with RedDot/IE
                                    //ident = jQuery(this).attr('href').substring(2);
                                    var ident = jQuery(this).attr('href').split("#_"),
                                        ident = ident[1],
                                        parentIdent = ident.split('Sub'),
                                        parentIdent = parentIdent[0];





                                    // set parent nav item active
                                    jQuery('a[href*=#_' +parentIdent+ ']')
                                        .parent()
                                        .addClass('active');
    
                                    // set active nav item
                                    jQuery(this)
                                        .parent().addClass('active')
                                        .siblings().removeClass('active')
                                        .parent()
                                        .closest('li').addClass('active')
                                        .siblings().removeClass('active');
                                    var $elem = jQuery('div#featureBox div#fbContent');




                                    // animate submenu
                                    $elem
                                        .find('div.subpageContent').hide()
                                        .end()
                                        .find('div#' +ident)
                                        .find('div.subpageContent').css('right','-415px').show().animate({right:'0px'}, 'slow');

                                    $elem
                                        .find('>div').hide().end()
                                        .find('div#' +ident).show()
                                        .closest('div.submenu').find('div.subpage').not('div#' +ident).hide()
                                        .closest('div.fbSubPage:hidden').show()
                                    ;

                                    // photo gallery
                                    if ($elem.find('div.fbcontent div.overlayGallery div.galleryItem').length) {
                                        _this.showOverlayItem($elem);
                                    } else {
                                        // remove background image on page change (if no reference gallery is set)
                                        $elem
                                            .find('div.fbcontent')
                                            .css('background-image', 'none')
                                            .find('div.descriptionNew')
                                            .remove();
                                    }

                                    // close interval if existing
                                    if(typeof(subInterval) != "undefined" && isTrigger !== true){
                                        window.clearInterval(subInterval);
                                    }

                                })
                                .end()
                        ).addClass('item_submenu')
                         .find('li:last').find('a').addClass('sub_last');
                        // hide second nav content
                        $fbContent.find('div.fbcontent.submenu:last div.subpage').hide();
                    }

                }





                // show either the first content or the content from the given state
                if (this.getState()) {
                    var mainPageState = this.getState().substring(0,7);



                    jQuery('a[href*=#_' +mainPageState+ ']').first().trigger('click');



                    var $bgContainer = jQuery('#typeA #layoutPositioner'),
                    ident = this.getState().split('Sub'),
                    ident = ident[0];

                    $bgContainer.removeClass().addClass('bg'+ident);
                } else {
                    this.$fbContainer.find('ul#fbNav>li:first a').trigger('click');
                }

            },

            // reference gallery
            switchGalleryItem: function(elem) {
                var $cont = elem.find('div.referenceGallery'),
                    firstItem = elem.find('div.galleryItem:first'),
                    firstImageSrc = firstItem.find('a').attr('href'),
                    firstImageDesc = firstItem.find('div.description').html(),
                    fbContent = jQuery('div#'+this.state+' div.fbcontent');

                // automatically set first reference image as background
                fbContent
                        .css('background-image', 'url(' + firstImageSrc + ')')
                        .find('div.descriptionNew').remove()
                        .end()
                        .append(
                            jQuery('<div class="descriptionNew">' + firstImageDesc + '</div>')
                        );
                // reset all thumbnail border colors
                elem
                    .find('div.galleryItem > a')
                    .removeClass('coloredBorder');
                // set first thumbnail border color
                firstItem.find('a').addClass('coloredBorder');
                $cont.delegate('div.galleryItem a', 'click', function(ev) {
                    ev.preventDefault();
                    var $this = jQuery(this),
                        imgSrc = $this.attr('href'),
                        imgDesc = $this.parent().find('div.description').html()
                    ;
                    // set link active
                    $this
                        .addClass('coloredBorder')
                        .parent()
                        .siblings()
                        .find('a').removeClass('coloredBorder');
                    fbContent
                            .css('background-image', 'url(' + imgSrc + ')')
                            .find('div.descriptionNew').remove()
                            .end()
                            .append(
                                jQuery('<div class="descriptionNew">' + imgDesc + '</div>')
                            );

                });
            },

            // overlay gallery
            showOverlayItem: function(elem) {

                var $cont = elem.find('div.overlayGallery');

                $cont.delegate('div.galleryItem a', 'click', function(ev) {
                    ev.preventDefault();
                    var $this = jQuery(this),
                        imgSrc = $this.attr('href'),
                        ident = window.location.hash.substring(2).split('Sub')[0],
                        imgClose = '<div class="closeFrame"><a href="#close"><img src="/de/img/overlay_close.gif" border="0" alt="Close frame" title="Close frame"></a></div>',
                        imgDesc = '<div class="descriptionNew">' +$this.parent().find('div.description').html()+'</div>'
                    ;

                    $this.addClass('coloredBorder')
                        .parent()
                        .siblings()
                        .find('a').removeClass('coloredBorder');

                   if (!elem.find('div.overlayFrame').length) {
                        jQuery('div#'+ident+' div.overlayGallery').before(
                            jQuery('<div class="overlayFrame"></div>')
                        );
                    }

                    elem.find('div.overlayFrame')
                        .css('background','url('+ imgSrc +') no-repeat')
                           .find('div.closeFrame').remove()
                        .end()
                        .append(imgClose)
                        .find('div.descriptionNew').remove()
                        .end()
                        .append(imgDesc);

                    elem.find('div.overlayFrame a[href*=#close]')
                        .bind('click', function(ev) {
                            ev.preventDefault();
                            elem.find('div.overlayFrame').remove();

                           $this.removeClass('coloredBorder')
                            .parent()
                            .siblings()
                            .find('a').removeClass('coloredBorder');

                        });
                });
            },

            // image tooltip on news items
            newsTooltip: function(elem)
            {
                if (elem.find('div.news').length) {
                    var newsItems = elem.find('div.news div.sNewsEntry'),
                        $newsItemFirstSrc = elem.find('div.news:first img').attr('src'),
                        $newsImageBig = jQuery('div#newsImageBig')
                    ;
                    if($newsItemFirstSrc != "") {
                        $newsImageBig
                               .removeClass('dummyPic')
                            .css('background','url('+$newsItemFirstSrc+') no-repeat');
                    } else {
                        $newsImageBig.addClass('dummyPic');
                    }
                    newsItems.each(function() {
                        var $newsItem = jQuery(this),
                            $newsItemImg = $newsItem.find('img').hide()
                        ;
                            $newsItem.hover(
                                function() {
                                    if($newsItemImg.attr('src') != "") {
                                        $newsImageBig
                                            .removeClass('dummyPic')
                                            .css('background','url('+$newsItemImg.attr('src')+') no-repeat');
                                    } else {
                                        $newsImageBig.addClass('dummyPic');
                                    }
                                }
                            );
                    });
                }
            },

            // state accessors
            setState: function(ident){
                if(!jQuery.browser.msie) {
                    var favicon = jQuery('link[type=image/x-icon]').remove().attr('href');
                }
                this.state = ident;
                window.location.hash = "_" +ident;
                if(!jQuery.browser.msie) {
                    jQuery('<link type="image/x-icon" href="' +favicon+ '" rel="shortcut icon" />').appendTo('head');
                }
            },
            getState: function() {
                if (this.state) return this.state;
                var fbHash = window.location.hash.substring(2);
                fbHash = (fbHash && jQuery('div#featureBox div#' +fbHash).length)
                    ? fbHash : false;
                this.state = fbHash || jQuery.cookie(this.stateCookieName);
                return this.state;
            },

            parseContent: function() {
                var _this = this,
                    $subPages = this.$fbContent.filter('div.fbSubPage'),
                    content = {
                        global:{
                            footer:this.$fbContent.filter('div.footer')
                        },
                        locale:[]
                    },
                    tmpContent = {};
                $subPages.each(function(key,value) {
                    var $this = jQuery(this),
                        tmpContent = {},
                        subNavItems = "",
                        ident = $this.attr('id'),
                        specialPage = $this.hasClass('fbNoBorder') ? ' class="fbNoBorderMenu"' : '';

                    if ($this.find('>div.fbcontent').hasClass('submenu')) {
                        $this.find('>div.fbcontent div.subpage').each(function(k,v) {
                            var $sub = jQuery(this);
                            subNavItems += '<li><a href="#_' +ident+ 'Sub' +k+ '">' +$sub.find('>h3').remove().html()+ '</a></li>';
                            $sub.attr('id', ident+ 'Sub'+k);
                            // add the global footer if the photo-gallery is empty
                            _this.addGlobalFooter($sub, content.global.footer.html());

                            // add content box to subpage
                            var subpageContent = $sub.find('div.fbcontent').html();
                            $sub.find('div.fbcontent')
                                .html('')
                                .append('<div class="outerSubpageContent"><div class="subpageContent">'+subpageContent+'</div></div>');
                        });
                    }

                    // add the global footer if the photo-gallery is empty
                    _this.addGlobalFooter($this, content.global.footer.html());

                    tmpContent = {
                        ident: ident,
                        navItem: jQuery('<li' +specialPage+ '><a href="#_' +$this.attr('id')+ '">' +$this.find('>h2').remove().html()+ '</a></li>'),
                        subNavItems: $this.find('>div.fbcontent').hasClass('submenu') ? jQuery('<ul class="submenu">' +subNavItems+ '</ul>') : '',
                        content: $this
                    };
                    content.locale.push(tmpContent);
                });
                return content;
            },

            addGlobalFooter: function(elem, content) {
                // add the global footer if the photo-gallery is empty
                if (!elem.find('div.photoGallery').children().length) {
                    elem.find('div.photoGallery').append(content);
                }
            }

        }

    })
};
 
function initPage() {
}

function addEvent( obj, type, fn )
{
   if (obj.addEventListener) {
      obj.addEventListener( type, fn, false );
   } else if (obj.attachEvent) {
      obj["e"+type+fn] = fn;
      obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
      obj.attachEvent( "on"+type, obj[type+fn] );
   }
}
function removeEvent( obj, type, fn )
{
   if (obj.removeEventListener) {
      obj.removeEventListener( type, fn, false );
   } else if (obj.detachEvent) {
      obj.detachEvent( "on"+type, obj[type+fn] );
      obj[type+fn] = null;
      obj["e"+type+fn] = null;
   }
}
 



    
socialmedia_init = function(url,send) {
    window.setTimeout(function() {
        var socialmediaCode = '<div class="socialmedia">';

        socialmediaCode += '<div id="fb-root"></div>';
        socialmediaCode += '<fb:like href="' + url + '" send="' + send + '" layout="standard" width="550" show_faces="false" font="arial"></fb:like>';
        socialmediaCode += '</div>';

        jQuery('#contentArea').prepend(socialmediaCode);

        /* Initialize Facebook Like */
        window.fbAsyncInit = function() {
            FB.init({appId: '', status: true, cookie: false, xfbml: true });
        }; 
    
        (function() {
            var e = document.createElement('script');
            e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
            e.type = 'text/javascript';
            e.async = 'true';
            document.getElementsByTagName('head')[0].appendChild(e);
        }());            
    }, 1);
}

socialmedia_cont_init = function(){
    var socialmediaCode = '<div class="socialmedia"></div>';

    jQuery('#contentArea').prepend(socialmediaCode);
}

socialmedia_fb_init = function(url){
    fb_code = '<script type="text/javascript">(function(d, s, id) {'
    fb_code += 'var js, fjs = d.getElementsByTagName(s)[0];'
    fb_code +=  'if (d.getElementById(id)) {return;}'
    fb_code += 'js = d.createElement(s); js.id = id;'
    fb_code += 'js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; '
    fb_code += 'fjs.parentNode.insertBefore(js, fjs);'
    fb_code += '}(document, "script", "facebook-jssdk"));'
    fb_code += '</script>'
    
    fb_code += '<div id="facebookLikeButton">';
    fb_code += '<div id="fb-root"></div>';
    fb_code += '<div class="fb-like" data-send="false" ';
    fb_code += 'data-layout="box_count" data-width="67" data-show-faces="false" ';
    fb_code += 'data-font="arial">';
    fb_code += '</div>';
    fb_code += '</div>';

    jQuery('div.socialmedia').prepend( fb_code );
}

socialmedia_google_init = function(url){
    google_code  =  '<div id="googlePlusOneButton">';
    google_code +=  '<div id="plusOne">';
    google_code +=  '</div></div>';
 
    jQuery('div.socialmedia').prepend( google_code );

    window.___gcfg = {
      lang: 'en-US',
      parsetags: 'explicit'
    };
    renderPlusone();
}

function renderPlusone() {
    gapi.plusone.render("plusOne",{"size": "tall"});
}

socialmedia_twitter_init = function(url){
    twitter_code = '<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>';

    twitter_code += '<div id="twitterTweetButton">';
    twitter_code += '<a href="https://twitter.com/share" class="twitter-share-button" ';
    twitter_code += 'data-count="vertical" data-lang="en">';
    twitter_code += '</a>';
    twitter_code += '</div>';

    jQuery('div.socialmedia').prepend( twitter_code );
}


// Product Template jQuery
jQuery(document).ready(function(){
    jQuery('div.imageHover > a').hover(
        function() {
            jQuery(this).children().first().css('display','none');
            jQuery(this).children().last().css('display','block');
        },
        function() {
            jQuery(this).children().first().css('display','block');
            jQuery(this).children().last().css('display','none');
        }
    );
});
