﻿$(document).ready( function() {
	//fetch the bio objects
	bios = ( $( '.hidebio' ).get() );
	frag = window.location.hash;
	fragbio = $( frag ).html();
	//set css for various bio bits
	$( '.hidebio' ).css( 'display', 'none' );
	$( '#showbio' ).css( 'display', 'block' );
	
	//if we got a hash, and it matches a bio id, show that. else show first bio
	fragbio != null ? $("#showbio").html( fragbio ) : $("#showbio").html($(bios[0]).html());

	//if we have a bio hash, I want to go to there.
	if( fragbio ) {
		var destination = $("#showcast").offset().top;
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 500 );
	}
	
	//make the clicky worky
	$( ".biolinks a" ).click( function() {
		fr = (this.hash);
		frcon = ( $(fr).html() );
		$('#showbio').html(frcon);
		return false;
	});
	
});
