window.addEvent('domready', function(){
    
    $$('#contactForm input', '#contactForm textarea').addEvent('focus', function(e){
        var error = this.getNext('small');
        if (error != null) {
            (function(){
                new Fx.Tween(error, {
                    onComplete: function(e){
                        error.destroy();
                    }
                }).start('opacity', 1, 0);
            }).delay(500);
        }
    });
    
    (function(){
        var waitTime = 0;
        $$('#contactForm small').each(function(error){
            waitTime += 150;
            (function(){
                new Fx.Tween(error, {
                    onComplete: function(e){
                        error.destroy();
                    }
                }).start('opacity', 1, 0);
            }).delay(waitTime);
        });
    }).delay(5000);
    
});
