If that's what you want, it's surely not what you're doing in your above code... the code above has 2 date inputs, the page only takes 1.. that's clear proof that you're performing the wrong calculation right there.
"Week number" is not the same thing as "number of weeks in a year". Europe and USA do indeed have different numbering system for the week number of a year, but that code above is not how you calculate it. If you want to know how, look no further than the JS source of the URL you posted-- you can port that implementation to mIRC.
I don't see how this is a bug-- the code you gave works fine..