"document.getElementById" return null after a "document.write"
<p>I am using a javascript code to write on my document : </p>

<pre><code>nr = Math.floor(Math.random()*99999999999);
document.write('&lt;div class="wads-content-' + nr + '" id="flashcontent' + nr + '"&gt;'+ flashrequired +'&lt;/div&gt;');
var flashcontent = document.getElementById('flashcontent' + nr);
</code></pre>

<p>In my page, i execute this script twice. The first time everything works, but the second time,  flashcontent is null, but i know it's wrong because I just write the element before the : </p>

<pre><code> document.getElementById
</code></pre>

<p>Any idea what is happening?</p>
