/**
 * Webinars Behavior
 *
 * Augments the interface for the Webinars page.
 *
 * Each course featured on the Webinars page contains a byline 
 * with a bio for each instructor. I added behaviors that hide
 * the bio on page load, show the bio when a user clicks on the
 * author's byline, and hide the bio when a user clicks either
 * the "hide" link (appended to each bio on page load) or the
 * author's name while the bio is showing.
 *
 * @since 11/3/09
 * @author Charlie Tysse <ctysse@gannetthg.com>
 * @filesource /webinars/index.html
 * @todo Append the plus/minus UI element as well as the anchor for each byline at page load. Could cause confusion if JS is disabled.
 */

$(document).ready(function(){
	// Add a "hide" link to each bio, then hide all bios
	$('.bio').append('<p><a href="#" class="hide-bio">[x] hide</a></p>').hide();
	// Add expansion functionality to each byline
	$('.byline').click(function(){
		// Toggle the plus sign for the clicked byline and show/hide the bio.
		if ($(this).next().is(":hidden"))
		{
			$(this).addClass('expanded').next().slideDown("fast");
		} else {
			$(this).removeClass('expanded').next().slideUp("fast");
		}
		// Block native A behavior.
		return false;
	});
	$('a.hide-bio').click(function(){
		$(this).parent().parent().slideUp("fast").prev().removeClass('expanded');
		return false;
	});
});
