/*
 * clientDetectionObj()
 *
 * Container object for clientDetection properties. Access any property [propName] within with browserDetection.propName;
 */
function clientDetectionObj() {

    this.osName = "";
    this.browserName = "";
    this.browserVersion = "";
  
    var _agentString = navigator.userAgent;
    var _version;
    
    //set osName Property
    if (/(Mac)/.test(_agentString)) {
      this.osName = "Mac";
    } else if (/(Windows)/.test(_agentString)) {
      this.osName = "Windows";
    } else if (/(Linux)/.test(_agentString)) {
      this.osName = "Linux";
    }
    
    //set browserName Property
    if (/(MSIE)/.test(_agentString)) {
      this.browserName = "IE";
    } else if (/(Gecko)/.test(_agentString)) {
      this.browserName = "Gecko";
    } else if (/(Opera)/.test(_agentString)) {
      this.browserName = "Opera";
    }

    //set browserVersion Property
    if (this.browserName == "IE") {
      var idxStartVersion = _agentString.indexOf("MSIE ") + 5;
      var idxEndVersion = _agentString.indexOf(";", idxStartVersion);
      _version = _agentString.substring(idxStartVersion, idxEndVersion);
    }
    else {
      _version = navigator.appVersion;
    }
    this.browserVersion = parseFloat(_version);
}

var clientDetection = new clientDetectionObj();