/** 
 * av_hide_show_transcript.js - Show / hide transcript(s) on reason av pages
 *
 * Expected structure:
 *
 * <div class="transcript">
 * <* class="transcriptHead">Transcript</*>
 * <blockquote>
 * .....
 * </blockquote>
 * </div>
 *
 * @author Nathan White
 * @requires jQuery
 */
$(document).ready(function()
{
	var divs = new Array();
	
	$("div.transcript").each(function(index)
	{
		divs[index] = this;
		hideTranscript(index, $(".transcriptHead:first", this).text());
	});
	
	function hideTranscript(index, text)
	{
		$("blockquote", divs[index]).hide();
		var link_text = $('<a href="#transcript_text_'+index+'">' + "Show " + text + '<a/>').click(function()
		{
			return showTranscript(index, text);
		});
		$(".transcriptHead:first", divs[index]).html(link_text);
		return false;
	}
	
	function showTranscript(index, text)
	{
		$("blockquote", divs[index]).show();
		var link_text = $('<a href="#transcript_text_'+index+'">' + "Hide " + text + '<a/>').click(function()
		{
			return hideTranscript(index, text);
		});
		$(".transcriptHead:first", divs[index]).html(link_text);
		return false;
	}
});