title: Rewriting specific links with javascript, except links to specific directory
body: <p>I have a page which contains links, that needed to be rewrited with Javascript. All the links in the div id="container" are needed to be rewrited from "post=post-number-234" to "?id=blog&amp;post=post-number-234".</p>
  
  <p>Currently I have this script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--
  var content = document.getElementById('content');
  var list = div.getElementsByTagName("A");
  for( var i = 0; i &lt; list.length; i++ ) 
  { 
    document.links[i].href = '?id=blog&amp;' + document.links[i].href
  }
  // --&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>This works fine. But I have links to images, that are used by Fancybook. All these links are originally linked to "img/image-name.jpg". But now fancybook doesn't work because it searches for  images inside "?id=blog&amp;img/image-name.jpg".</p>
  
  <p>How can I apply rewriting to all the links inside the div "content", that are NOT linked to the directory "img"?</p>
  
  <p>Thanks!</p>