$(document).ready(function() {
	$('#newsletter-signup').css('display','none');
	$('#newsletter-signup-link').css('display','inline');
	
	$('#newsletter-signup-link').unbind('click').click(function() {
		$('#newsletter-signup').animate({height:'show'});
		$('#follow-us-logo').animate({height:'hide'});
		$('input#newsletterEmail').select().focus();
		$('#newsletter-cancel').css('display','inline');
		
		$('#newsletter-cancel-link').unbind('click').click(function () {
			$('#follow-us-logo').animate({height:'show'});
			$('#newsletter-signup').animate({height:'hide'});
			$('#newsletter-cancel-link').unbind('click');
			$('label#newsletterError').empty();
		});
		
	});
	
	$('#newsletterSubmit').unbind('click').click(function () {
		if ($('input#newsletterEmail').val() == '') {
			$('label#newsletterError').html('Incorrect email address.');
			return false;
		}
		
		$.ajax({
			type:'post',
			url:'/newslettersubmit/',
			data:{newsletterEmail:$('input#newsletterEmail').val(),js:true},
			success:function(data) {
				
				$('label#newsletterError').html(data);
			}
		});
		return false;
	});
	
	$('#videoEmbedCode').hide();
	$('#videoURLCode').hide();
	$('#comments-container').hide();
	
	$('#videoEmbed').click(function() {
		$('#videoURLCode').hide();
		$('#comments-container').hide();
		
		$('#videoEmbedCode').slideToggle("normal");
	});
	
	$('#videoURL').click(function() {
		$('#videoEmbedCode').hide();
		$('#comments-container').hide();
		
		$('#videoURLCode').slideToggle("normal");
	});
	
	$('#videoComments').click(function() {
		$('#videoEmbedCode').hide();
		$('#videoURLCode').hide();
		
		$('#comments-container').slideToggle("normal");
	});
});