Image.width on IE browsers
<p>I have the following javascript (resizes images in blogspot blogs):</p>

<pre><code>  var imageTags = document.getElementsByTagName('img');
  for(i = 0 ; i &lt; imageTags.length; i++){
    if( imageTags[i].src.indexOf('/s400/', 0)&gt;-1 ) {
      if(imageTags[i].style.width=='400px' || imageTags[i].width==400) {
      imageTags[i].style.width='556px';
        imageTags[i].style.height='368px';
      } else {
        imageTags[i].style.width='368px';
        imageTags[i].style.height='556px';
      }
      imageTags[i].src=imageTags[i].src.replace('/s400/', '/s556/');

    }
  }
</code></pre>

<p>it works perfectly on Firefox and Chrome, but on IE (tested IE9) it seems to always get into the second branch, as if <code>imageTags[i].width==400</code> always evaluated to false. How can I fix in on IE browsers?</p>

<p>EDIT:
As suggested I temporarily added an alert to display the width of the image and on IE9 it was.... 416. It looks like IE added margins to the width from the html.</p>
