Detect resolution and load respective .swf

hi,

is there any way to get e browser to detect the resolution and then get .html to auto load the respective .swf (eg. flash800.swf for 800 x 600, flash1024.swf for 1024 x 768, etc) inside that parent .html (eg. it’s flash800.swf tt is embedded inside, when a user with 1024x768 resolution visits the page, the browser will automatically replace the flash800.swf w the flash1024.swf file)?

tried something (script below) but it affects my actionscript.

[LEFT]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
function loadFlash()
{    if(screen.width > 800)
    {
        document.getElementById('flashhold').innerHTML = '<object type="application/x-shockwave-flash" data="1005x768flash" width="1005" height="768">'
        +'<param name="movie" value="1024x768flash.swf">'
        +'<\/object>';
    }
    else if(screen.width <= 800)
    {
        document.getElementById('flashhold').innerHTML = '<object type="application/x-shockwave-flash" data="780x600.swf" width="780" height="600">'
        +'<param name="movie" value="780x600flash.swf">'
        +'<\/object>';
    }
}
window.onload = loadFlash;
</script>
</head>
<body>
<div id="flashhold">
    <noscript>
        <object type="application/x-shockwave-flash" data="780x600.swf" width="780" height="600">
            <param name="movie" value="780x600flash.swf">
        </object>
    </noscript>
</div>
</body>
</html>
 

anybody pls help…thanks![/LEFT]