$(document).ready(function() {

	// Make error lists reveal down
	$('.error:not(.disable-slide)').hide().slideDown('normal');
	if ($('.error:not(.disable-slide)')) $('h2').css('marginBottom', '14px')
	
	// Make success reveal down
	$('.success').hide().slideDown('normal');
	
	
	// Form inputs - remove value on focus, and reinstate on blur
	var toggleValue = $('input.toggle-value').val();
	$('input.toggle-value').focus(function() {
		if ($(this).val() == 'Username' || $(this).val() == 'Password')
			$(this).val('');
	}).blur(function() {
		if ($(this).val() == '')
			$(this).val(toggleValue);
	});
	
	
	// Profile link tooltip - logged in navbar
	var profile_tooltip = '<p id="profile-link-tooltip"><span>Send people a link to your profile page to let them know your status</span></p>';
	// append the tooltip to the navbar
	$('#navigation').append(profile_tooltip);
	// style the tooltip
	$('#profile-link-tooltip').hide().css({
		position: 'absolute',
		zIndex: '10',
		right: '185px',
		top: '14px',
		width: '130px',
		height: '104px',
		textAlign: 'justify',
		background: 'transparent url("http://stateim.in/images/profile-link-tooltip.png") no-repeat',
		font: '13px/18px Helvetica, Arial, sans-serif',
		color: '#222'
	});
	$('#profile-link-tooltip span').css({
		display: 'block',
		padding: '20px 13px 0 13px'
	});
	
	// add hover action to the Profile link in navbar
	$('#navigation li.profile').hover(function() {
		$('#profile-link-tooltip').fadeIn(400);
	}, function() {
		$('#profile-link-tooltip').fadeOut(400);
	});

});
