new Event.observe(window, 'load', function() {
    Slider.initialize({
        step:             -1,
        interval:         110,
        delay:            600,
        rememberStop:     true,
        containerElement: 'sliderContainer',
        slideElement:     'sliderContent',
        width:            1619,
        cookie:           true
    });

});
new Event.observe(window, 'resize', contentFit);

document.observe("dom:loaded", function() {
    $$('a.nav').each(function(el) {
        if (el.hasClassName('nav-active')) {
            el.update('<img src="/ecritcms/dynimages/txtgen.php?p=nika&amp;t=' + escape(el.innerHTML) + '&amp;c=000000" border="0" width="235" height="16" />');
        } else {
            el.update('<img src="/ecritcms/dynimages/txtgen.php?p=nika&amp;t=' + escape(el.innerHTML) + '" onmouseover="this.src=\'/ecritcms/dynimages/txtgen.php?p=nika&amp;t=' + escape(el.innerHTML) + '&amp;c=000000\';" onmouseout="this.src=\'/ecritcms/dynimages/txtgen.php?p=nika&amp;t=' + escape(el.innerHTML) + '\';" border="0" width="235" height="16" />');
        }
    });
    contentFit();
});

function getWindowHeight(w) {
    var width, height;
    w = w ? w : window;
    height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);

    return height;
}

function contentFit() {

    if ($('fs-content')) {
        var pos = $('fs-content').cumulativeOffset()[1] + Math.max($('fs-content').getHeight(), $('fs-navigation').getHeight()) + 10;
        var winHeight = getWindowHeight();
        if (pos < winHeight - $('fs-footer').getHeight()) {
            $('fs-footer').setStyle({ position: 'absolute', top: (winHeight - 18 - $('fs-footer').getHeight()) + 'px' });
        } else {
            $('fs-footer').setStyle({ position: 'relative', top: '0' });
        }
    }
}
