var highlightOnFocus = function(){
  if(document.forms){ //find all forms
    var forms = document.forms; //build array of all forms
    for(y=0;y<forms.length;y++){
      var formEls = document.forms[y].elements; //find all elements within each form
      for(g=0;g<formEls.length;g++){
        if(formEls[g].type=="text" || formEls[g].type=="select" || formEls[g].type=="textarea" || formEls[g].type=="password"){
          formEls[g].onfocus = function(){ //add event when form field is focused on
            if(!this.className.match(/focus/gi))
              this.className += " focus";
            else if(!this.className)
              this.className += "focus";
          }
          formEls[g].onblur = function(){ //add event when form field is no longer focused
            if(this.className.match(/focus/gi))
              this.className = this.className.replace(/focus/gi,"");
          }
        }
      }
    }
  }
}

//window.onload = highlightOnFocus;

//window.onload CONFLICTS with <body onLoad="someFunction()">
// highlightOnFocus is in onLoad function in body tag
