jQuery(document).ready(function(){
    // <a href="page.html" class="new-window">Page</a>
    jQuery('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });

    jQuery('.question input[type=text], .question textarea').focus(function(){
        jQuery('label[for='+jQuery(this).attr('id')+']').hide();
    });
    jQuery('.question input[type=text], .question textarea').blur(function(){
        if (jQuery(this).val() == '') {
            jQuery('label[for='+jQuery(this).attr('id')+']').show();
        }
    });

    jQuery('#s').focus(function(){
        if (jQuery(this).val() == 'Search this blog') {
            jQuery(this).val('').removeClass('default');
        }
    });
    jQuery('#s').blur(function(){
        if (jQuery(this).val() == '') {
            jQuery(this).val('Search this blog').addClass('default');
        }
    });

    jQuery('#archive-dropdown').change(function(){
        if (jQuery(this).val() != '') {
            document.location.href = jQuery(this).val();
        }
    });

    // Onload instantiation
    jQuery('.question input[type=text], .question textarea').each(function(){
        if (jQuery(this).val() != '') {
            jQuery('label[for='+jQuery(this).attr('id')+']').hide();
        }
    });
});