ieFocus = function()
{
    var i = 0;
    var fields = document.getElementsByTagName("input");
    for(i = 0; i < fields.length; i++)
    {
      fields[i].onfocus = function() {this.className += ' focused';}
      fields[i].onblur = function() {this.className = this.className.replace(' focused', '');}
    }

    fields = document.getElementsByTagName("textarea");
    for(i = 0; i < fields.length; i++)
    {
      fields[i].onfocus = function() {this.className += ' focused';}
      fields[i].onblur = function() {this.className = this.className.replace(' focused', '');}
    }
};

if (window.attachEvent) window.attachEvent("onload", ieFocus);
