	$(document).ready(function() {

		$('#background').fadeIn(2200);
	
		$('.invite_link').click(function() {		

			$.ajax({
				type: "POST",
				url: '/uitnodigen',
				error: function(msg){		
					$(div).html("Het is niet gelukt om de actie uit te voeren: "+msg);
				},
				success: function(msg){
					$('#overlay').html(msg);
				}
			});		
		});

		$('#newsletterForm .button').click(function() {	
		
			$.ajax({
				type: "POST",
				url: '/nieuwsbrief',
				data: $('#newsletterForm').serialize(),
				error: function(msg){		
					$(div).html("Het is niet gelukt om de actie uit te voeren: "+msg);
				},
				success: function(msg){
					$('#overlay').html(msg);
				}
			});	
			return false;
		});		
		
		$('.close').click(function() {
			$(this).parent('#block').css('top', '167px').delay(220).animate({top: '-350px'}, 'slow');
			$('#expand').css('top', '0px').delay(220).animate({top: '44px'}, 'slow');
			
			$.ajax({
				type: "POST",
				url: '/pages/session',
				data: {'data[Page][session]': '1' }
			});	
			return false;			
		});
		
		$('#expand').click(function() {
			$(this).css('top', '44px').delay(220).animate({top: '0px'}, 'slow').delay(220);
			$('#block').css('top', '-450px').delay(220).animate({top: '167px'}, 'slow');
			
			$.ajax({
				type: "POST",
				url: '/pages/session',
				data: {'data[Page][session]': '0' }
			});	
			return false;				
			
		});		
	});
