jQuery(document).ready(function () {
    (function ($) {
        function hide_popup(){
            $('.messages').slideUp("slow");
        };
        window.setTimeout( hide_popup, 15000 );
        //queue a nice animation?
    })(jQuery);
});

;
jQuery(document).ready(function () {
    (function ($) {
        /** This bit will make sure that the page is always higher then 1200**/
        var pageHeight = $('#background-wrapper').height();
        if(pageHeight < 1200){
            $('#content').height(1250);
        }
        
        if ($('#twitter-block').length ) {
            $('#yellow-fella-wrapper').addClass('show');
        }       
    })(jQuery);    
});
;
jQuery(document).ready(function () {
    (function ($) {
        
        // Dripping tap animation
        // http://stackoverflow.com/questions/3949123/cycle-animation
        var $red_drip_image1 = $('#red-drip-1'),
            red_delay1 = 1000,
            red_duration1 = 1800,
            red_moveDown1 = function(){
                $red_drip_image1.delay(red_delay1).animate({
                    bottom: "190px"
                }, {
                    duration: red_duration1,
                    complete: red_moveUp1
                });
            },
            red_moveUp1 = function(){
                $red_drip_image1.animate({
                    bottom: "370px"
                }, {
                    duration: 1,
                    complete: red_moveDown1
                });
            };
        red_moveDown1();
        
        var $red_drip_image2 = $('#red-drip-2'),
            red_delay2 = 1500,
            red_duration2 = 1800,
            red_moveDown2 = function(){
                $red_drip_image2.delay(red_delay2).animate({
                    bottom: "190px"
                }, {
                    duration: red_duration2,
                    complete: red_moveUp2
                });
            },
            red_moveUp2 = function(){
                $red_drip_image2.animate({
                    bottom: "370px"
                }, {
                    duration: 1,
                    complete: red_moveDown2
                });
            };
        red_moveDown2();        
        
        //// Snake animation (left to right)
        //var $snake_image = $('#green-snake'),
        //    delay = 2000,
        //    duration = 6000,
        //    moveRight = function(){
        //        $snake_image.delay(delay).animate({
        //            left: $snake_image.parent().width() + $snake_image.width()
        //        }, {
        //            duration: duration,
        //            complete: moveLeft
        //        });
        //    },
        //    moveLeft = function(){
        //        $snake_image.animate({
        //            left: 0 - $snake_image.width()
        //        }, {
        //            duration: 1,
        //            complete: moveRight
        //        });
        //    };
        //moveRight();
        
        var $snake_image = $('#green-snake'),
            wrapper_size = $snake_image.parent().width() - $snake_image.width(),
            snake_delay = 2000,
            snake_duration = 3000,
            snake_moveUp = function(){
                $snake_image.delay(snake_delay).animate({
                    bottom: "120px",
                    height: "234px"
                }, {
                    duration: snake_delay + snake_duration,
                    complete: snake_moveDown
                });
            },
            snake_moveDown = function(){
                $snake_image.delay(snake_duration).animate({
                    bottom: "0px",
                    height: "10px"
                }, {
                    duration: snake_duration
                });
                $snake_image.delay(snake_duration).animate({
                    bottom: "0px",
                    left: Math.ceil(Math.random()*wrapper_size) + "px"
                }, {
                    duration: snake_duration,
                    complete: snake_moveUp
                });                
            };
        snake_moveUp();        
    })(jQuery);    
});
;

