jQuery( document ).ready( function ( ) {
  jQuery( '.ancestor_control' ).bind( 'click', function ( e ) {
    var generation = jQuery( this ).attr( 'rel' );
    jQuery( '#anc_con_' + currentGen ).attr( 'src', contentBase + 'base/charsheet/anc_tabs/' + ( parseInt( currentGen ) + 1 )+ '_off.png' );
    jQuery( '#gen_' + currentGen ).hide( );
    jQuery( '#anc_con_' + generation ).attr( 'src', contentBase + 'base/charsheet/anc_tabs/' + ( parseInt( generation ) + 1 ) + '_on.png' );
    jQuery( '#gen_' + generation ).show( );
    currentGen = generation;
  } );

  jQuery( '.ancestor_control' ).bind( 'mouseover', function ( e ) {
    var imgSrc = jQuery( this ).attr( 'src' );
    jQuery( this ).attr( 'src', imgSrc.replace( '_off', '_over' ) );
  } );

  jQuery( '.ancestor_control' ).bind( 'mouseout', function ( e ) {
    var imgSrc = jQuery( this ).attr( 'src' );
    jQuery( this ).attr( 'src', imgSrc.replace( '_over', '_off' ) );
  } );
} );
