// <![CDATA[

( function( $ )
{
    
    var list = [
        'current',
        'past',
        'future'
    ];
    
    // var _log = ( console && console.log ) ? console.log : alert;
    
    function toggleActive( activeLink )
    {
        var id        = activeLink.attr( 'rel' );
        var activeDiv = $( '#' + id );
        
        if( activeDiv.hasClass( 'tx-ycm-hidden' ) ) {
            
            activeLink.parent().addClass( 'tx-ycm-active' );
            activeDiv.removeClass( 'tx-ycm-hidden' );
        }
        
        for( var i = 0; i < list.length; i++ ) {
            
            if( list[ i ] !== id ) {
                
                $( '#' + list[ i ] ).addClass( 'tx-ycm-hidden' );
                $( '#' + list[ i ] + '-li' ).removeClass( 'tx-ycm-active' );
            }
        }
    }
    
    function inArray( needle, haystack )
    {
        for( key in haystack ) {
            
            if( haystack[ key ] === needle ) {
                
                return true;
            }
        }
        
        return false;
    }
    
    $( document ).ready( function()
    {
        $( '.tx-ycm-exhibitions-menu LI A' ).click( function( event )
        {
            event.preventDefault();
            
            toggleActive( $( this ) );
        } );
        
    } );
    
} )( jQuery );

// ]]>
