My first script works! - except for IE and Safari - please help
<p>Hey all,
I'm trying to teach myself Javascript. The following is my first script so bear with me if there are some "rookie" mistakes. :)</p>

<p>It works in FF and Chrome, but not in IE or Safari.</p>

<p>JSLint won't process past the for loop. </p>

<p>IE debugger is giving me an Invalid argument error on the line(#37):</p>

<pre><code>document.getElementById(progBarId).style.width = barWidth + 'px';
</code></pre>

<p>I've confirmed that the barWidth variable is a number.</p>

<p>I've Googled IE issues with my syntax and came up empty.</p>

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

<pre><code>window.onload = upDtProgBars;

function upDtProgBars() {
    var allTags = document.getElementsByTagName("div");

    for (var i = 0; i &lt; allTags.length; i++) {
        if (allTags[i].className.indexOf("progBar") &gt; -1) {
            progBarId = setProgBarWidth(allTags[i].id);
        }
        // END if
    }
    // END for loop
    function setProgBarWidth(progBarId) {
        var today = new Date();
        var startDate;
        var numWeeks;
        var barWidth = 0;
        var progBarID = "";
        switch (progBarId) {
        case "html":
            startDate = new Date('5,1,2009')
            break;
        case "html5":
            startDate = new Date()
            break;
        case "js":
            startDate = new Date('1, 1, 2011')
            break;
        case "csharp":
            startDate = new Date('9,3, 2010')
            break;
        default:
        }
        // END Switch
        if (progBarId != "") {
            numWeeks = getNumWeeks(today, startDate);
            barWidth = parseInt(numWeeks * 2.76);
            document.getElementById(progBarId).style.width = barWidth + 'px';
        }
        // END if not empty string
    }
    // END setProgBarWidth
    function getNumWeeks(d1, d2) {
        var ONE_WEEK = 1000 * 60 * 60 * 24 * 7;
        var diffInWeeks = Math.round(Math.abs(d2.getTime() - d1.getTime())) / ONE_WEEK;
        return diffInWeeks;
    }
    // END getNumWeeks
}
// END upDtProgBars
</code></pre>
