/*****
 * Athens Popfest 2011
 * Custom Javascript Code
 * Matt Farmer
 *
 * (c) 2011 Boxkite Media
*****/

/**
 * When the DOM is loaded, attach the popfest specific event handlers
**/
$(document).ready(function() {
	// shows the slickbox on clicking the noted link
	$('#slick-show').click(function() {
		$('#home-updates-right-box').slideToggle('slow');
		return false;
	});

	//handles the submission of the newletter signup
	$('#btn-submit-newsletter').click(function() {
		$.ajax({
			url: Application.appUrl + "/email/signup",
			type: 'post',
			data: {
				spool_lists_id: 4,
				email: $('#newsletter-email').val()
			},
			dataType: 'text',
			success: function(data) {
				//empty newsletter email field
				$('#newsletter-email').val("");

				//hide the email subscribe box
				$('#home-updates-right-box').slideToggle('slow');

				//Create the div for the dialog and open it
				dialog = $('<div></div>').html(data).dialog({
					spool_lists_id: 4,
					title: 'Newsletter Signup'
				});
			}
		});
	});
});

