
function UserAgent()
{
    var v = navigator.appVersion.toLowerCase(), 
        u = navigator.userAgent.toLowerCase(), 
        n = navigator.appName;
    
    this.mac = (v.indexOf("mac") + 1);
    this.win = (v.indexOf("win") + 1);
    this.netscape = (n == "Netscape" && u.indexOf("firefox") == -1);
    this.firefox = (u.indexOf("firefox") > -1);
    this.ie = (n == "Microsoft Internet Explorer");
    this.aol = (u.indexOf("aol") + 1);
    this.opera = (u.indexOf("opera") + 1);
    this.ver = (this.ie) ? parseFloat(v.split('msie ')[1]) : parseFloat(v);
    this.v4 = (parseInt(v) == 4);
    this.os = (this.mac) ? 'mac' : (this.win) ? 'win' : navigator.platform;
    this.name = (this.netscape) ? 'nn' : (this.ie) ? 'ie' : n;
    this.codeName = this.name +'_'+ parseInt(this.ver) + '_'+ this.os;
}

var agent = new UserAgent();