Multiple Random Advert Divs on Same Page PHP/JavaScript
<p>Ive exhausted my amateur scripting skills and seeking help.</p>

<p>Here is my sites main index and the current working script with one set of adds randomly displaying on my home page. </p>

<p><strong>http://blessone.netau.net/</strong></p>

<p>Ive managed after alot of tries with different codes ive come across to come up with this.</p>

<pre><code>divs = ['d1','d2','d3','d4'];

function hideDivs() {
for (var i=0; i&lt;divs.length; i++)
document.getElementsByClassName('adbox');

}

function showDiv() {
hideDivs(); //hide them all before we show the next one.
var randomDiv = divs[Math.floor(Math.random()*divs.length)];
var div = document.getElementsByClassName(randomDiv).style.display =
'block';

setTimeout(showDiv,500); //set a delay before showing the next div

}`
</code></pre>

<p>Im trying to display a div randomly on my home page from a set of divs in "adverts/pop_left_ad.php"` Popular Products.</p>

<p>Works great!</p>

<p>But one problem. When i try to use.....</p>

<pre><code>&lt;?php include("adverts/pop_left_ad.php"); ?&gt;
</code></pre>

<p>...twice on one page it doesn't give me two different random divs on my page, no matter where i place them. I am using different files for each set of divs that are than called upon randomly by their calling div.</p>

<p>I should point out im NOT sure how to edit the JS for my second inclusion. Do i only add a series of div ID's in there??? What elements do i change in the JS?</p>

<p>I have now learnt that the issue is my id setup and have changed that to a class setup.
So i need help making the additional changed to my JS to incorporate the Classes and so on.</p>

<p>Any help is greatly appreciated.</p>

<p>Many Thanks.</p>
