var TUserAgent = { };
TUserAgent.AGENT     = navigator.userAgent;
TUserAgent.PLATFORM  = navigator.platform;
TUserAgent.OPERA     = typeof opera != "undefined";
TUserAgent.IE        = !TUserAgent.OPERA && TUserAgent.AGENT.indexOf('MSIE') != -1;
TUserAgent.SAFARI    = !TUserAgent.OPERA && TUserAgent.AGENT.indexOf('WebKit') != -1;
TUserAgent.KONQUEROR = !TUserAgent.OPERA && TUserAgent.AGENT.indexOf('Konqueror') != -1;
TUserAgent.GECKO     = !TUserAgent.OPERA && TUserAgent.AGENT.product == 'Gecko';
TUserAgent.CAMINO    =  TUserAgent.GECKO && TUserAgent.AGENT.vendor == 'Camino';
TUserAgent.MAC       = TUserAgent.PLATFORM.indexOf('Mac');
TUserAgent.WIN       = TUserAgent.PLATFORM.indexOf('Win');
TUserAgent.LINUX     = TUserAgent.PLATFORM.indexOf('Linux');
TUserAgent.VERSION   = 0;

var matches = TUserAgent.AGENT.match(/WebKit\/([^\s]*)/);
if (matches && matches[1]) { TUserAgent.VERSION = parseFloat(matches[1]); }
matches = TUserAgent.AGENT.match(/Opera( Mini)?[\s\/]([^\s]*)/);
if (matches && matches[2]) { TUserAgent.VERSION = parseFloat(matches[2]); }
matches = TUserAgent.AGENT.match(/MSIE\s([^;]*)/);
if (matches && matches[1]) { TUserAgent.VERSION = parseFloat(matches[1]); }
matches = TUserAgent.AGENT.match(/Gecko\/([^\s]*)/);
if (matches && matches[1]) {
  TUserAgent.VERSION = parseFloat(matches[1]);
  matches = TUserAgent.AGENT.match(/rv:([^\s\)]*)/);
  if (matches && matches[1]) { TUserAgent.VERSION = parseFloat(matches[1]); }
}

