I'm working on an upload interface that let's the user upload images. I write PHP quite well and the server side of things is finished, including validation. I'm now working on the actual upload page itself but I'm new to Javascript and I'm sort of making it up as I go along...

I want my javascript to do 3 things:

Style the upload interface to look great, or at least be styleable.

Check the file size (client side).

Check the file extension (client side).

Using a great script from Viget I'm making headway on point 1, and I've added in some checks for point 2 and 3. The issue I'm having is that if you select a file with the incorrect extension, it warns you, but then if you select a new file, the warning remains. This happens vice versa, so if you add a file that's got the correct file extension, but then change to one with a bad file extension, it doesn't warn you. So I can't get the javascript to "refresh".

If you could have a look at this code and make any comments, any comments at all, I'd really appreciate it as I'm very new to this:

(even layout comments would be appreciated)
(the code below is ready to try, so just copy and paste)