Help! need to resize image to user's resolution

Hi, glad if anyone can help me. I want my image to be resized according to the user’s computer resolution. I worked up this script bt it seems nt to work. thanks for your assisstance.

function width(){
var size = 0;

if((screen.width==400)&&(screen.height==300))
return size=400;
else if((screen.width==640)&&(screen.height==480))
return size=630;
else if ((screen.width == 800) && (screen.height == 600))
return size=800;
else if ((screen.width == 1024) && (screen.height == 768))
return size=1000;
else if ((screen.width == 1280) && (screen.height == 1024))
return size=1200;

In the main body ->
img src=“ria_webpage3%20_v2copy.jpg” width=width() height=“600”