var UserAgent = function () {
    this.getApp();
    this.getVersion();
    this.name = this.app+' '+this.version;
}

UserAgent.prototype.id = navigator.userAgent;

UserAgent.prototype.getApp = function () {
    if (this.id.indexOf('Firefox') > -1) this.app = 'Firefox';
    else if (this.id.indexOf('Opera') > -1) this.app = 'Opera';
    else if (this.id.indexOf('AppleWebKit/') > -1) this.app = 'Safari';
    else if (this.id.indexOf('KHTML') > -1) this.app = 'Konqueror';
    else if (this.id.match(/Apple.*Mobile.*Safari/)) this.app = 'iSafari';
    /*else if (this.id.indexOf('MSIE') > -1) this.app = 'MSIE';*/
    /*@cc_on this.app = 'MSIE';@*/
}

UserAgent.prototype.getVersion = function () {
    switch (this.app) {
        case 'Firefox':
            /([0-9.]*)$/.test(this.id);
            break;
        case 'Opera':
            /^Opera\/([0-9.]*)/.test(this.id);
            break;
        case 'MSIE':
            /MSIE ([^;]*);/.test(this.id);
            break;
        case 'Konqueror':
            /KHTML\/([0-9.]*)/.test(this.id);
            break;
    }
    this.version = RegExp.$1;
}
userAgent = new UserAgent;

window.location.getParameter = function (param) {
    var reg = new RegExp('^\\?.*&?'+param+'=([^&]*).*$');
    return window.location.search.match(reg) ? RegExp.$1 : false;
}