YUI().use('node', function(Y)
{

    if (Y.one('#language'))
    {
        var languageForm = Y.one('#language form'),
            languageSelect = Y.one('#language select');
        languageSelect.on('change', function()
        {
            languageForm.submit();
        });
    }

    if (Y.one('#archives'))
    {
        var archivesSelect = Y.one('#archives select');
        archivesSelect.on('change', function()
        {
            var value = this.get('options').item(this.get('selectedIndex')).get('value');
            location.href = value;
        });
    }

    if (Y.one('#categories'))
    {
        var archivesSelect = Y.one('#categories select');
        archivesSelect.on('change', function()
        {
            var value = this.get('options').item(this.get('selectedIndex')).get('value');
            location.href = value;
        });
    }

    if (Y.one('#comment-form')) {
        var comment = Y.one('#comment-form'),
            commentForm = Y.one('#comment-form form'),
            commentAuthor = Y.one('#comment-form #comment-author'),
            commentText = Y.one('#comment-form textarea');
        commentForm.on('submit', function(e)
        {
            if ((commentAuthor.get('value') == '') || (commentAuthor.get('value').match(/^s+$/)) || (commentText.get('value') == '') || (commentText.get('value').match(/^s+$/)))
            {
                e.halt();
                alert('Please enter a name and comment.');
            }
        });
    }

});
