Cufon.replace('#navigation a, #navigation_references a, #subnavigation a, #slidenav a', {
    hover:true
});

$(document).ready(function() {
    if ($('#slider').length > 0) {
        var slider = new Lectric();
        slider.init('#slider', {next: '#next', previous: '#prev'});
    }

    var awards = function(awarditems, speed) {
        var speed = (speed == null) ? 2000 : speed;
        var timer = setInterval(showaward, speed);

        var awarditems = (awarditems == null) ? $('.fce_awards > h1') : awarditems;
        var length = awarditems.length;
        var index = 0;
        var awardsound = null;
        
        awarditems.hide();
        soundManager.url = '/fileadmin/templates/flash/';
        soundManager.flashVersion = 9; // optional: shiny features (default = 8)
        soundManager.useFlashBlock = false; // optionally, enable when you're ready to dive in
        soundManager.debugMode = false;
        // enable HTML5 audio support, if you're feeling adventurous. iPad/iPhone will always get this.
        //soundManager.useHTML5Audio = false;
        soundManager.onready(function() {
          awardsound = soundManager.createSound({
            id: 'awardsoundid',
            url: '/fileadmin/templates/flash/award.mp3'
          });
          showaward();
        });
        
        function showaward() {
             awardsound.stop();
             awarditems.eq(index).hide();
             if(index >= 0) {
                awarditems.eq(index - 1).hide();    
             }
             awardsound.play();
             awarditems.eq(index).show();
             index++;
             if (index >= length) {
                 index=0;
             }
        }    
    }
    
    if ($('.fce_awards > h1').length > 0) {
        awards(null, 1800);
    }
    
    


    /*
    $("#clientlist h1 a").each(function() {
        $(this).bind({
            mouseenter: function() {
                $(this).stop().animate({ color: '#999' }, 'fast');
            },
            mouseleave: function() {
                $(this).stop(false, true).animate({ color: '#000' }, 'fast');
            },
            focusin: function() {
                $(this).stop().animate({ color: '#999' }, 'fast');
            },
            focusout: function() {
                $(this).stop(false, true).animate({ color: '#000' }, 'fast');
            }
        })
    });
    */

});

function flashybaby(interval) {

    jwplayer().stop();
    $('#flashybaby, #logo, #navigation, #header hr, #subnavigation, #col3_content').css({'opacity': 0});
    $('#flashybaby').oneTime(500, function() {
        $(this).show().animate({opacity: 1}, 200, function() {
            $('#flashybaby').remove();
            $(this).animate({'opacity': 0}, 500).hide();
            $(this).oneTime(500, function() {
                $('#logo').fadeTo(500, 1.0, function() {
                    $('#navigation').fadeTo(500, 1.0, function() {
                        $('#header hr').fadeTo(500, 1.0, function() {
                            jwplayer().play();
                            $('#subnavigation').fadeTo(500, 1.0, function() {
                                $('#col3_content').css({'opacity': 1});
                            });
                        });
                    });
                });
            });
        });
    });

}

var flashybaby2;
flashybaby2 = {
    interval: 1,

    flashybaby: $('#flashybaby'),

    init: function() {
        this.hideall();
        this.flashing(interval);
    },

    hideall: function() {
        $('#flashybaby, #logo, #navigation, #header hr, #subnavigation, #col3_content').css({'opacity': 0});
    },

    flashing: function(interval) {
        for(var i=1; i<=interval; i++) {
            this.flashybaby.animate({opacity: 1}, 200, function() {

            });
        }
    }

};




