function AOFr() {

  var ua = window.navigator.userAgent;

  this.IE = (ua.indexOf("MSIE") >=0);
  this.IE5 = (ua.indexOf("MSIE 5.0") >=0);
  this.Safari = (ua.indexOf("Safari") >=0);
  this.Opera = (ua.indexOf("Opera") >=0);
  this.MACFF = (ua.indexOf("Macintosh") >=0 && ua.indexOf("Firefox") >= 0);
  if (this.Opera) {this.IE=false; this.IE5=false;};  

  this.get=function(id) {
    if(document.getElementById) {
      return document.getElementById(id);
    } else {
      return document.all(id);
    }
  };
  
  this.$=this.get;
  
  this.onload=function(of) {
    if(this.IE) {
      window.attachEvent("onload", of);
    } else {
      window.addEventListener("load", of, false);
    }
  }
}

var AOFR = new AOFr();

function AOForm(f) {

  this.form = f; 

  this.required=function(id, msg) {
  
  };
  
  this.focus=function(eId) {
    var e;
    if(eId) {
      e = AOFR.$(eId);
    } else {
      for(var i=0; i<this.form.elements.length; i++) {
        if(this.form.elements[i].type=="text") {
          e=this.form.elements[i];
          break;
        } 
      }      
    }
    if(e) e.focus();    
  };
}

/*automatically focus the first textbox in form.*/
AOFR.onload(function(){
  var AOFORM = new AOForm(document.forms[0]);
  AOFORM.focus();
});