Effect of server and/or CMS on JavaScript execution?

This is utterly wacky, and I can’t figure out what the problem is. I have JS that plays a video, either natively in HTML5 or via a .SWF in older browsers. It works fine when served from my local machine (Apache 2.x on Mac OS X Lion), but when I check the code in to our company CMS and compile it in Tomcat, the JavaScript throws an error! The error is “Object does not support this method”, and it happens when running the playVideo method on a video object (see code below).

            play.title = 'Play';
            play.className = 'video-button video-play';
            play.onclick = function() {
                if ($(video).is('#flashObject')){
                    if (play.title === "Play"){
                        play.title = 'Pause';
                        // Additional class names for container and button while playing
                        root.className += ' video-on';
                        play.className += ' video-play-on';
                    } else {
                        play.title = 'Play';
                        // Remove additional class names for container and button in paused state
                        root.className = root.className.replace( ' video-on', '' );
                        play.className = play.className.replace( ' video-play-on', '' );
                } else { ...

BTW, this is happening specifically in IE8; I suspect IE7 will throw the same error. How can this be happening with client-side code??? Any ideas? Thanks in advance for your input!

That error will occur when you try to access a property or method of an undefined object.

If you can provide a test page that demonstrates the problem, we can use developer tools to pinpoint the precise location of the issue.

Thanks, I found what the problem was; I had forgotten to check one last .SWF file into our CMS. </me slaps forehead>