jQuery(document).ready(function() {
	// dumb IE css fixes
	if(jQuery.browser.msie) {
		jQuery('#navigation ul li:last a').css('backgroundImage', 'none').css('padding-right', '12px');
	}	

	initAutoClears();

	// functionality for SpringStage recent / popular posts
	jQuery('div#bottom ul.nav a').click(function() {
		var el = jQuery(this);
		el.addClass('current');
		el.parent().siblings().find('a').removeClass('current');
		jQuery('div'+el.attr('href')).show().siblings('div').hide();
		return false;
	});
});


function initAutoClears(context) {
	jQuery(':input.autoclear', context).each(function() {
		if(this.value == '' || this.value == this.title) {
			this.value = this.title;
			jQuery(this).addClass('labeled');
		}
	})
	.focus(function() {
		if(this.value == this.title) {
			this.value = '';
			jQuery(this).removeClass('labeled');
		}
	})
	.blur(function() {
		if(this.value == '') {
			this.value = this.title;
			jQuery(this).addClass('labeled');
		}
	});	
}
