
/**
	ALL NOTES HEREIN ARE NOT MADE BY THE CODE AUTHOR, so they may be inaccurate
	
	Creates a cmTP object, and then copies all of it's non-null values into this coremetrics object.
	This seems strange, it may be intentional obfuscation.
	
	@method addTp
	
	@return _cm
*/



_cm.prototype.addTP = function() {

	var tp = new cmTP(new cmApp());
	for(var o in tp) {
		if (tp[o]==null || tp[o]=="" || tp[o].toString().indexOf("function ") == 0) 
			continue;
		this[o] = cmEncode(cmStrip(tp[o]));
	}
	return this;
}



/**
	A class which simply encapsulates the browser version
		
	@class cmApp
	
	@prop b String the browser type, will be "ns" for netscape, "ie" for internet explorer, or other
	@prop v Integer the browser version
*/
function cmApp() {
	var n=navigator, b=n.appName, c=this;
	if (b=="Netscape") {
		c.b="ns"
	} else if (b == "Microsoft Internet Explorer") {
		c.b="ie"
	} else { 
		c.b=b
	}
	c.v=parseInt(n.appVersion);
}



/**
	@class cmTP
	
	@param c cmApp
	
	@param np0,np1,... String the name of all installed plugins
	@param je String "y" or "n" depending on whether java is installed or not
	@param ce -- browser cookieEnabe property
	@param ce -- cpuClass
	@param sw Integer window.screen.width
	@param sh Integer window.screen.height
	@param pd Integer window.screen.colorDepth or window.screen.pixelDepth
	@param fs String "y" or "n" depending on window.screen.fontSmoothingEnabled
	@param tz Integer the timezoneOffset;
*/
function cmTP(c) {
	
	var n=navigator, w=window.screen;
	this.jv=cmJv; //<-- This appears to do nothing?
	
	if (c.b=="ns" && c.v>=3)
		for (var i=0; i < n.plugins.length; i++) 
			eval('this.np'+i+'=n.plugins['+i+'].name');
			
	if (c.v>3) {
		
		if( c.v >= 4 && (c.b=="ns" || c.b=="ie") ) {
			this.je = (n.javaEnabled() == true) ? "y":"n";
		}
		if (c.b=="ie") {
			this.ce = n.cookieEnabled;
			this.cp = n.cpuClass;
		}
		
		this.sw=w.width;
		this.sh=w.height;
		this.pd=w.colorDepth;
		if(this.pd==0) {
			this.pd=w.pixelDepth;
		}
		var fs = w.fontSmoothingEnabled;
		if(fs){
			this.fs=fs?"y":"n";
		}
	}

	var tz = new Date();
	this.tz = tz.getTimezoneOffset()/60;

}

