$(
    function() {
        $( '#accordion' ).accordion( { autoHeight: false } );
        
        $( '.output' ).click(
            function() {
                var id = $( this ).attr( 'id' );
                
                switch( id ) {
                    case 'SaveAsWordDoc':
                        if( typeof( _gaq ) != 'undefined' ) {
                            _gaq.push( ['_trackEvent', 'Output', 'Save as Word Doc'] );
                        }
                        break;
                    case 'SaveAsPdf':
                        if( typeof( _gaq ) != 'undefined' ) {
                            _gaq.push( ['_trackEvent', 'Output', 'Save as PDF'] );
                        }
                        break;
                    case 'Print':
                        window.print();
                        if( typeof( _gaq ) != 'undefined' ) {
                            _gaq.push( ['_trackEvent', 'Output', 'Print'] );
                        }
                        return false;
                        break;
                }
                
            }
        );
        
        $( '.toggler' ).click(
            function() {
                if( typeof( _gaq ) != 'undefined' ) {
                    var el = $( this );
                    _gaq.push( ['_trackEvent', 'View', el.attr( 'id' )] ); 
                }
            }
        );
    }
);
