// enable fancy interactions

window.addEvent("domready", function()
{
    // flowplayer setup
    if( $('fplayer') ) {
        var splashImg = $$('img.fsplash').getProperty('src');
        var mfile = $('fmedia').getProperty('href');

        //afer readout, empty container for flowplayer!
        $('fmedia').set('html','');

        if( $('fmedia') ) {
            $f("fmedia", {src: "fileadmin/templates/flash/flowplayer-3.1.5.swf"}, {
                
                playlist: [
                    // this first PNG clip works as a splash image
                    splashImg ,

                    // second clip is a video or audio. when autoPlay is set to false the splash screen will be shown
                    {
                        url: mfile, //'http://vod01.netdna.com/vod/demo.flowplayer/flowplayer-700.flv',
                        autoPlay: false
                        //autoBuffering: true  // <-- LEAVE THIS OUT!
                    }
                ],
                plugins: {
                    audio: { url: 'flowplayer.audio-3.1.2.swf' }
                    //controls: null
                }
            });
        }

    }

    // filter dropdown
    if( $('ttnews-cat-tree') )
    {
        var togglers = $$("#treeRoot > li > ul > li > a:not(.pm)");

        new Fx.Accordion(togglers, $$("#treeRoot > li > ul > li > ul"),{
            display: -1,
            alwaysHide: true,
            onActive: function(toggler){
                toggler.getParent().addClass("exp");
            },
            onBackground: function(toggler){
                toggler.getParent().removeClass("exp");
            }
        });

        togglers.addEvent("click", function(e){
            new Event(e).stop();
        })
    }
})