$(document).ready(function() {
	//Clear Form Fields
	$('#s').focus(function() {
		if (this.value == 'Search the Blog') {
			this.value = '';	
		}
	});
	$('#s').blur(function() {
		if (this.value == '') {
			this.value = 'Search the Blog';	
		}
	});
	$('#newsletter-field').focus(function() {
		if (this.value == 'your@email.com') {
			this.value = '';	
		}
	});
	$('#newsletter-field').blur(function() {
		if (this.value == '') {
			this.value = 'your@email.com';	
		}
	});
	
	//Show and Hide Sidebar Sections
	$('.side-section ul, #flickr #photoAlbum, .twitter').hide();
	$('#recent-posts ul').show();
	$('.side-section h3').addClass('clickable');
	
	//Categories and News Tab Box
	$('#head-blog').click(function() {
		$(this).removeClass('inactive-tab');
		$(this).addClass('active-tab');
		$('#head-news').addClass('inactive-tab');
		$('#list-news').slideUp();
		$('#list-blog').slideDown();
		return false;					 
	});
	$('#head-news').click(function() {
		$(this).removeClass('inactive-tab');
		$(this).addClass('active-tab');
		$('#head-blog').addClass('inactive-tab');
		$('#list-blog').slideUp();
		$('#list-news').slideDown();
		return false;						 
	});
	
	//Toggle Recent Posts
	$('#recent-posts .toggler, #recent-posts h3').click(function() {
		$('#recent-posts ul').slideToggle();
		$('#recent-posts .toggler').text($('#recent-posts .toggler').text() == 'Hide Categories' ? 'Show Categories' : 'Hide Categories');
		return false;
	});
	
	//Toggle Recent Tweets
	$('#recent-tweets .toggler, #recent-tweets h3').click(function() {
		$('.twitter').slideToggle();
		$('#recent-tweets .toggler').text($('#recent-tweets .toggler').text() == 'Show posts' ? 'Hide posts' : 'Show posts');
		return false;
	});
	
	//Toggle Flickr
	$('#flickr .toggler, #flickr h3').click(function() {
		$('#flickr #photoAlbum').slideToggle();
		$('#flickr .toggler').text($('#flickr .toggler').text() == 'View Images' ? 'Hide Images' : 'View Images');
		return false;
	});
});
