JavaScript Res Detection in Firefox

I’m trying to use a JavaScript detection to determine the user’s screen resolution. My script works fine in every browser except Firefox. No matter what resolution I use, my alert notifies me that I’m using 1024x768.

What could I be doing wrong?


<script language="Javascript1.1">
function detect(){
alert("Sorry. your current resolution is "+screen.width+" by "+screen.height+".  If possible please change your 
alert("Whoa, nice resolution.")


<body onLoad="detect()">