$(function() {
    // Change the label into a default value
    $('label', '#newsletter-form').each(function() {
        var $this = $(this);
        var $input = $('#'+$this.attr('for'));
        $this.css({
            color: '#bababa',
            paddingLeft: 3 + parseFloat($input.css('padding-left')) + parseFloat($input.css('border-left-width')),
            paddingTop: ($.support.style ? 3 : 5) + parseFloat($input.css('padding-top')) + parseFloat($input.css('border-top-width')),
            position: 'absolute',
            zIndex: $('#newsletter-signup').val() == '' ? 1 : -99
        });
        $input.bind('blur focus keyup', function(ev) {
            if(this.value == '' && ev.type != 'keyup') {
                $(this).prev().css({
                    color: ev.type == 'blur' ? '#bababa' : '#ccc',
                    'z-index': 1
                })
            } else {
                $(this).prev().css('z-index', this.value == '' ? 1 : -99);
            }
        });
    });
    // The carousels.
    $('#featured-work, #buzz').rightRound();
    if($('#featured-work')[0]) {
        var t, nav = $('#featured-work').parent().prev().find('div.right-round-nav'), clicked = true;
        nav.find('a').click(function() {
            if(clicked) {
                clearInterval(t);
            }
        });
        t = setInterval(function() {
            clicked = false;
            nav.find('a.next').click();
            clicked = true;
        }, 7800);
    }
    // THe follow part of the left nav, show and hide, etc.
    var $follow = $('div', '#follow-nav').css('visibility', 'hidden').parent().hover(function() {
        $follow.css('visibility', '');
    }, function() {
        $follow.css('visibility', 'hidden');
    }).end();
});