path = new Array();
path.push('/static/js/lib/animator.js');
path.push('/static/js/lib/prototype.js');
path.push('/static/js/src/scriptaculous.js?load=effects');
path.push('/static/js/lightbox.js');
path.push('/static/js/lib/swfobject.js');
path.push('/static/js/calendar.js');
path.push('/static/js/elementsCalendar.js');
path.push('/static/js/stubai_classes.js');
path.push('/static/js/imgReplace.js');
if (lang == 'de') {
    path.push('/static/js/calendar-de.js');
} else {
    path.push('/static/js/calendar-en.js');
}
loadScrips(path);

function onDocumentLoad() {

    var elementhover = new classSwitcher([ $$('#nav ul li') ]);

    /*var teaserSlider = new newsSlider( {main_slider: '.frontLayer',
     slideMainItems: '.slider',
     items_slider: '.items_slider',
     Items: '.newsItem',
     prev: '.arrow_up',
     next: '.arrow_down'} );

     var lifeCamSlider = new imageSlider({sliderContainer: '.imageContainer',
     prev: '.arrow_left',
     next: '.arrow_right'} );	*/


    var newsletterbox = document.getElementById('topicalbox');
    if (newsletterbox != undefined) {
        entries = $(newsletterbox).getElementsByClassName('entry');
        slide = new verticalSlider(entries, 28, 100);
    }

    var portalteaser = document.getElementById('sliderBox');
    if (portalteaser != undefined) {
        pteaser = $(portalteaser).getElementsByClassName('entry');
        slide2 = new verticalSlider(pteaser, 28, 103);
    }

    var infobox = document.getElementById('infobox');
    if (infobox != undefined) {
        boxes = $(infobox).getElementsByClassName('info_entry');
        info = new infoSlider(boxes, 28);
    }

    /*
     var facilitybox = document.getElementById('categories');
     if(facilitybox != undefined)
     {
     category = $(facilitybox).getElementsByClassName('category');
     sfacility = new facilitySlider(category,28);
     }
     */

    new langSelect();

    if (lang == "de" || lang == "en" || lang == "it") {
        text2image($$('.portal_news_slider h3'), {
            font:'AFBatterseaBold.ttf',
            width:'250',
            height:'18',
            color:'ffffff',
            bgcolor:'05538f',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"gfx"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('#center #headline h1'), {
            font:'AFBatterseaBold.ttf',
            width:'540',
            height:'',
            color:'ffffff',
            bgcolor:'1a68a8',
            size:'23',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h1",
                className:"img"
            }
        });

        text2image($$('#nav li.none em'), {
            font:'AFBatterseaBold.ttf',
            width:'',
            height:'',
            color:'ffffff',
            bgcolor:'0967af',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"em",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('#nav li.active em'), {
            font:'AFBatterseaBold.ttf',
            width:'',
            height:'',
            color:'ff8c00',
            bgcolor:'0967af',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"em",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('#categories .category h3'), {
            font:'AFBatterseaBold.ttf',
            width:'500',
            height:'',
            color:'00487f',
            bgcolor:'ffffff',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('#sliderBox h3'), {
            font:'AFBatterseaBold.ttf',
            width:'180',
            height:'',
            color:'78828c',
            bgcolor:'e3e7eb',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('#rightside .weather .label h3'), {
            font:'AFBatterseaBold.ttf',
            width:'',
            height:'',
            color:'ffffff',
            bgcolor:'095fa3',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('#rightside .weather .weather_temp em'), {
            font:'AFBatterseaBold.ttf',
            width:'',
            height:'',
            color:'ffffff',
            bgcolor:'095fa3',
            size:'20',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"em",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('.weatherbox_2 .temperature em'), {
            font:'AFBatterseaBold.ttf',
            width:'80',
            height:'',
            color:'ffffff',
            bgcolor:'ff8f00',
            size:'20',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"em",
                className:"img"
            }
        });

        text2image($$('#rightside #infobox h3, #rightside .informationbox h3'), {
            font:'AFBatterseaBold.ttf',
            width:'',
            height:'',
            color:'ffffff',
            bgcolor:'1467a8',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('.weatherbox_2 h3'), {
            font:'AFBatterseaBold.ttf',
            width:'',
            height:'',
            color:'00487f',
            bgcolor:'ccd4dc',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });


        /**
         *  Winter = Sommer außer Fusszeile
         *  --> sicherung in load.bak111006.js
         */
        text2image($$('#textarea h2'), {
            font:'AFBatterseaBold.ttf',
            width:'500',
            height:'',
            color:'ff8d09',
            bgcolor:'ffffff',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h2",
                className:"img"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });

        text2image($$('.c_teaser .textfield h3, .entries .textfield h3'), {
            font:'AFBatterseaBold.ttf',
            width:'360',
            height:'',
            color:'ff8d09',
            bgcolor:'ffffff',
            size:'11.6',
            positionx:0,
            positiony:0,
            replaceElement:{
                tagName:"h3",
                className:"text"
            },
            modifyValue:function (vari) {
                return vari.toUpperCase();
            }
        });


        if (season == "winter") {

            // portal

            if ($$('.portal_news_slider').length > 0) {
                text2image($$('#topicalbox h3'), {
                    font:'AFBatterseaBold.ttf',
                    width:'180',
                    height:'',
                    color:'ffffff',
                    bgcolor:'05538f', // Winter
                    //bgcolor:'E88F27', // Sommer
                    size:'11.6',
                    positionx:0,
                    positiony:0,
                    replaceElement:{
                        tagName:"h3",
                        className:"img"
                    },
                    modifyValue:function (vari) {
                        return vari.toUpperCase();
                    }
                });
            }
            else {
                //content
                text2image($$('#topicalbox h3'), {
                    font:'AFBatterseaBold.ttf',
                    width:'180',
                    height:'',
                    color:'ffffff',
                    bgcolor:'05538f',
                    //bgcolor: 'E88F27',
                    size:'11.7',
                    positionx:0,
                    positiony:0,
                    replaceElement:{
                        tagName:"h3",
                        className:"img"
                    },
                    modifyValue:function (vari) {
                        return vari.toUpperCase();
                    }
                });
            }


            text2image($$('.teaser_center .message h3'), {
                font:'AFBatterseaBold.ttf',
                width:'180',
                height:'',
                color:'ffffff',
                bgcolor:'05538f',
                size:'11.6',
                positionx:0,
                positiony:0,
                replaceElement:{
                    tagName:"h3",
                    className:"img"
                },
                modifyValue:function (vari) {
                    return vari.toUpperCase();
                }
            });

            text2image($$('#footer #hotline h3'), {
                font:'AFBatterseaBold.ttf',
                width:'',
                height:'',
                color:'ffffff',
                bgcolor:'ff8c00',
                size:'11.6',
                positionx:0,
                positiony:0,
                replaceElement:{
                    tagName:"h3",
                    className:"img"
                },
                modifyValue:function (vari) {
                    return vari.toUpperCase();
                }
            });
        }
        else {

            text2image($$('#topicalbox h3, .teaser_center .message h3'), {
                font:'AFBatterseaBold.ttf',
                width:'180',
                height:'',
                color:'ffffff',
                bgcolor:'ff8d09',
                size:'11.6',
                positionx:0,
                positiony:0,
                replaceElement:{
                    tagName:"h3",
                    className:"img"
                },
                modifyValue:function (vari) {
                    return vari.toUpperCase();
                }
            });

            text2image($$('#footer #hotline h3'), {
                font:'AFBatterseaBold.ttf',
                width:'',
                height:'',
                color:'ffffff',
                bgcolor:'105c97',
                size:'11.6',
                positionx:0,
                positiony:0,
                replaceElement:{
                    tagName:"h3",
                    className:"img"
                },
                modifyValue:function (vari) {
                    return vari.toUpperCase();
                }
            });
        }
    }

    if ($('CamSliderBox')) {
        $('CamSliderBox').style.height = "130px";
    }
    if ($('arrow_left')) {
        $('arrow_left').style.height = "130px";
    }
    if ($('arrow_right')) {
        $('arrow_right').style.height = "130px";
    }

    try {
        if ($('button_first') != null) {
            initButtonBox = window.setInterval("changeButtonArea()", 5000);
        }
    } catch (e) {
    }


    if ($('calenderClick')) {
        new elementsCalendar({
            button:'calenderClick',
            output:"text",
            textfield:'sd',
            updateFieldOnStartup:false
        });
        new elementsCalendar({
            button:'calenderClick2',
            output:"text",
            textfield:'ed',
            updateFieldOnStartup:false
        });
    }


    initLightbox();
}

function changeButtonArea() {

    var z_style = $('button_second');
    var c_style = $('button_first');

    if ((z_style != null) && (c_style != null)) {

        if (z_style.getStyle('display') == "block") {
            z_style.setStyle({ display:'none' });
            c_style.setStyle({ display:'block' });
        }
        else {
            c_style.setStyle({ display:'none' });
            z_style.setStyle({ display:'block' });
        }
    }
}

window.onload = onDocumentLoad;


function loadScrips(path) {
    for (i = 0; i < path.length; i++) {
        document.write('<script type="text/javascript" src="' + path[i] + '"></script>');
    }
}


function getLink(link) {
    location.href = link;
}



