title: Swap image/hyperlink based on pathname using Javascript
body: <p>I know this is probably pretty simple but I am a novice at JavaScript.</p>
  
  <p>Trying to change the image/link being displayed based on the url path.</p>
  
  <p>So any page at foo.com would display an image of a dog <code>&lt;div id="promo"&gt;&lt;a href="dog.html"&gt;&lt;img src="img/dog.jpg"&gt;&lt;/a&gt;&lt;/div&gt;</code></p>
  
  <p>Unless it was under a the directory foo.com/cat then <code>&lt;div id="promo"&gt;&lt;a href="cat.html"&gt;&lt;img src="img/cat.jpg"&gt;&lt;/a&gt;&lt;/div&gt;</code></p>
  
  <p>Many thanks!!!</p>