// Handles default values in text fields
jQuery.each(jQuery("input[type='text']"), function() {
	//Collect the default value
	jQuery.data(this, 'value', this.value);
	
	//Clear the value on focus, if it's still the default
	jQuery(this).bind('focus',function() {				
		if (this.value == jQuery.data(this, 'value')) this.value = ''; 
	});
	
	//If a value hasn't been set restore it to the default
	jQuery(this).bind('blur',function() {
		if (this.value == '' ) this.value = jQuery.data(this, 'value'); 
	});
});


//Function will equalize the heights of a group of elements
function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = jQuery(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}


// Most Recent & Tweets & Comments WIdget
jQuery('#sidebar #RecentComments').hide();

jQuery('.most_recent .popular-header').click(function() {
	jQuery('#sidebar #RecentComments').hide();	
	jQuery('#sidebar #MostPopular').show();
	jQuery('.most_recent .comments-header').removeClass('active');
	jQuery(this).addClass('active');
	return false;
});
jQuery('.most_recent .comments-header').click(function() {
	jQuery('#sidebar #MostPopular').hide();	
	jQuery('#sidebar #RecentComments').show();
	jQuery('.most_recent .popular-header').removeClass('active');
	jQuery(this).addClass('active');
	return false;
});

//equalize the height
equalHeight(jQuery('#sidebar .most_recent ul'));
