If you use the web site project model of 2005/2008, then everything in a directory will be part of the "project" (I quote it because a web site project is really just a directory of files not a true project, with a file that manages it). However, if you use the web application project model you can fine control over the included files within the project.
When you talk about the javascript being included in the build, it's a little confusing. No javascript is compiled with an application build, but a
js file can be a member of the project and thus visual studio will treat it in some way. Perhaps what you are experiencing can be dealt with using a VS setting. I'm not that familiar with VS2008 so I don't know what you might change, but I expect there's something that allows for turning off javascript checking or whatever VS is doing that's getting in the way.