Возникла необходимость при разрешении экрана шириной меньше 800, уменьшить размер видео.пробую так, не срабатывает почему-то.

<script type="text/javascript">
alert();
if(screen.width<=800)
{
document.write('
<div align="center">
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/4CQr9vb-MLs?fs=1&amp;hl=ru_RU"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/4CQr9vb-MLs?fs=1&amp;hl=ru_RU" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
</div>');
} else
{
document.write('
<div align="center">
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/4CQr9vb-MLs?fs=1&amp;hl=ru_RU"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/4CQr9vb-MLs?fs=1&amp;hl=ru_RU" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="686" height="551"></embed></object>
</div>');
}
</script>