Free screen resolution redirection JavaScript

This screen resolution redirection script will redirect your visitors based on their screen resolution. I did not write this script I just found it to be useful and thought I would pass it along.



<script>

function resRedirect(){

var width = screen.width;
var res =(((!(640-width))*1)+((!(800-width))*2)+((!(1024-width))*3)+((!(1152-width))*4)+((!(1280-width))*5));

if(!(res)) res = 1;

if (res=='1') // 640 X 400
      location.replace('RES-PAGE1.HTML');

if (res=='2') // 800 X 600
      location.replace('RES-PAGE2.HTML');

if (res=='3') // 1024 X 768
      location.replace('RES-PAGE3.HTML');

if (res=='4') // 1152 X 864
      location.replace('RES-PAGE4.HTML');

if (res=='5') // 1280 X 720
      location.replace('RES-PAGE5.HTML');

else // anything else
      location.replace('OTHER_RES.HTML');

}
resRedirect();
</script>