
// Функция создает объект управления броузером.
// Имя создаваемого объекта = obj_name
function InitBrowser(obj) {
	o = new Object();
  o.id = obj; eval(o.id+'=o');
  o.IEVersion = 0;
  o.online = window.navigator.onLine;
  o.application = window.navigator.appName;
  o.appCodeName = window.navigator.appCodeName;
  o.agent = window.navigator.userAgent;
  o.version = window.navigator.appVersion;
  o.minVersion = window.navigator.appMinorVersion;
  o.language = window.navigator.browserLanguage;
  o.userLanguage = window.navigator.userLanguage;
  o.cookie = window.navigator.cookieEnabled;
  o.java = window.navigator.javaEnabled();
  o.cpu = window.navigator.cpuClass;
  o.os = window.navigator.oscpu;
  o.platform = window.navigator.platform;

  o.isIE  = function() { return (this.application == 'Microsoft Internet Explorer'); }
  o.isIE6 = function() { return (this.isIE() && this.IEVersion >= 6); }
  o.isIE7 = function() { return (this.isIE() && this.IEVersion >= 7); }
  o.isIE8 = function() { return (this.isIE() && this.IEVersion >= 8); }
  o.isWin = function() { return (this.version.toLowerCase().indexOf("win") != -1 ? true : false); } 
  o.isOpera = function() { return (this.agent.indexOf("Opera") != -1 ? true : false); } 
  
  o.getIEVersion = function() {
    var idx = this.agent.indexOf('MSIE');
  	if (idx == -1)
    	return parseFloat(this.version); else
    	return parseFloat(this.agent.substr(idx+5));
  }	// function
  o.getHTML = function() {
    var str = '';
  	var html =
"\n<div style='padding-top:10px'>"+
"\n\t<table border='1' cellpadding='0' cellspacing='1' class='crm_object_info'>";
		for (o in this) {
    	str = eval(this.id+'.'+o);
      if (typeof(str) != 'function')
      	html += "\n\t<tr><td class='label'>"+this.id+'.<b>'+o+'</b> = </td>'	+
        				"<td class='data'>"+str+'</td></tr>';
    }	// for
		html +=
"\n\t</table>"+
"\n</div>";
		return html;
	} // function

	o.Draw = function() {
  	html = this.getHTML();
		document.write(html);
  }	// function

  o.IEVersion = o.getIEVersion();
  return o;
}	// function