Javascript Banner Swap
<p>The section is foo.com/agriculture.  It has a banner image corresponding to the name in the javascript. I need the internal page foo.com/agriculture/harvest to have a separate banner than the foo.com/agriculture. The script I am working with for the banner swap for each page is as follows:</p>

<pre><code>&lt;script type="text/javascript"&gt; 
var dir = location.pathname.split("/")[1]; 
//var dir2 = location.pathname;
if (dir == "agriculture")        
document.write('&lt;IMG SRC="/images/ib_agriculture.jpg" WIDTH=1024 HEIGHT=91 BORDER=0&gt;')  
else if (dir == "showcase")
document.write('&lt;IMG SRC="/images/ib_show.jpg" WIDTH=1024 HEIGHT=91 BORDER=0&gt;')  
else if (dir == "contact")      
document.write('&lt;IMG SRC="/images/ib_contact.jpg" WIDTH=1024 HEIGHT=91 BORDER=0&gt;')   
else if (dir == "distribution")     
&lt;/script&gt;
</code></pre>

<p>I tried the following different codes to try and assign the internal page foo.com/agriculture/harvest a separate banner. </p>

<pre><code>var dir = location.pathname.split("/")[1]; 
//var dir2 = location.pathname;
if (dir == "agriculture/harvest")        
document.write('&lt;IMG SRC="/images/ib_agriculture_harvest.jpg" WIDTH=1024 HEIGHT=91 BORDER=0&gt;')  
else if (dir == "showcase") 

var dir = location.pathname.split("/")[1]; 
//var dir2 = location.pathname;
if (dir == "harvest")        
document.write('&lt;IMG SRC="/images/ib_agriculture_harvest.jpg" WIDTH=1024 HEIGHT=91 BORDER=0&gt;')  
else if (dir == "showcase") 
</code></pre>

<p>Both of the scripts above continue to grab the foo.com/agriculture banner (ib_agriculture.jpg) instead of the called foo.com/agriculture/harvest (ib_agriculture_harvest.jpg). I am not sure how to get the script to call the appropriate banner per page.</p>
