$( document ).ready(
    function()
    { 
        if( IEVersion() == 6 )
        {
            if( $( '#sb-container' ).length == 0 )
            {
                $( document ).pngFix();
            }
        
            if( $( '.downloadArticleWrapper' ).length > 0 )
            {
                $( '.downloadArticleWrapper' ).each(
                    function()
                    {
                        $( this ).after( '<div style="clear:both"></div>' );
                    }
                );
            }
        }
        
        if( $( '#menu' ) )
        {
            // possible to cut down trips back to DOM to look for #menu down to just 1?
            var currentFontSize = $( '#menu ul' ).css( 'font-size' );
            $( '#menu li:even:not(:last)' ).append( ' /&nbsp;' ).css( 'font-size', currentFontSize );
        }

        if( $( '#leftPane' ) )
        {
            var rightPaneHeight = $( '#rightPane').height();
            var windowHeight = $( window ).height();

            var height = '1524px';
            //var height = ( rightPaneHeight > windowHeight ) ? rightPaneHeight : '100%';

            $( '#page' ).css( 'height', height );
            $( '#content' ).css( 'height', height );
            $( '#leftPane' ).css( 'height', height );
        }

        // have to do this because the parsed URL in PHP plugin is not usable
        if( $( '#rightPane table a' ).attr( 'target' ) == 'youtube' )
        {
            $( '#otherVideoContainer table table table a' ).each(
                function()
                {
                    if( $( this ).attr( 'href' ) == 'http://www.youtube.com/user/JohnCHuang' )
                    {
                        $( this ).parent().append( 'JohnCHuang' );
                        $( this ).remove();
                    }
                }
            );
            
            $( '#rightPane table table a.youtube' ).each(
                function()
                {
                    var movieId = $.url.setUrl( $( this ).attr( 'href' ) ).param( 'v' );
                    $( this ).attr( 'href', 'http://www.youtube.com/v/' + movieId );
                    
                    if( IEVersion() == 8 )
                    {
                        // remove the "player=swf" attribute for IE8 or else it won't work
                        var rel = $( this ).attr( 'rel' );
                        rel = rel.replace( /player=swf;/i, "" );
                        $( this ).attr( 'rel', rel );
                    }
                }
            );
        }
        
        /*
        $( 'a.pageTracker' ).click(
            function()
            {
                pageTracker._trackPageview( $( this ).attr( 'href' ) );
            }
        );
        */

    }
);

function IEVersion() 
{
    return ( navigator.appName == 'Microsoft Internet Explorer' ) ? parseFloat( ( new RegExp( "MSIE ([0-9]{1,}[.0-9]{0,})" ) ).exec( navigator.userAgent )[1] ) : -1;
}