Hey, im new to javascript, i've found a way of detecting the broswer size via js and using different sections of my css to style the page depending on this, but is there any way that i can use this same function to decide which image to display?

(At the moment images get resized to a certain width depending on the browser size and then cropped so they look crap)

I'm thinking that i can make a few different sizes of each image and then using js to choose which one to display? Unless one of you guys with a lot more experience can suggest a more effiecient way of getting around this problem?

Thanks in advance