$(document).ready(function () {
	$('div#top-bar div a span').click(function() {
		$('div#client-login').slideToggle(750);
		$('div#top-bar div a').click(function() { 
			return false; 
		});
	});

	$('ul#featured-projects li a').hover(function () {
		if ($(this).find('span').is(':animated')) {
			$(this)
				.find('span')
				.queue([])
				.stop();
		}
		$(this).find('span').animate({ opacity: .85 }, 250);
	}, function () {
		$(this).find('span').animate({ opacity: 0 }, 500);
	});	
	
	
	$('ul.thumb-list li').each(function() {
		var imgTitle = $(this).find('img').attr('title');
		var overlay = '<div class="thumb-back"><p>' + imgTitle + '</p></div>';
		$(this).find('a').append(overlay).children('.thumb-back').animate({ opacity: 0 }, 0);
	});
	
	$('ul.thumb-list li').hover(function() {
		if ($(this).find('div.thumb-back').is(':animated')) {
			$(this)
				.find('div.thumb-back')
				.queue([])
				.stop();
		}
		$(this).find('div.thumb-back').animate({ opacity: .85 }, 250);
	}, function() {
		$(this).find('div.thumb-back').animate({ opacity: 0 }, 500);
	});
	
	$('input#name').focus(function() {
		if (this.value == 'Name') {
			$(this).attr('value', '');
		}
	});
	
	$('input#email').focus(function() {
		if (this.value == 'Email') {
			$(this).attr('value', '');
		}
	});
	
	$('textarea#message').focus(function() {
		if (this.value == 'Your Message') {
			$(this).text('');
		}
	});
	
	if ($('#article').length > 0) {
		$('.main-nav li').eq(3).addClass('current_page_item');
	}
	
	$('#article img.aligncenter').wrap('<div class="centered-image" />').css('margin-bottom', '0');
	console.log($('#article img.aligncenter'));
});
