var ScreenWidth = screen.width;
var ScreenHeight = screen.height;
var ColorDepth = screen.colorDepth;

//document.write('<b>Screen Width: </b>'+ScreenWidth);
//document.write('<br><b>Screen Height: </b>'+ScreenHeight);
//document.write('<br><b>Color Depth: </b>'+ColorDepth);


var BrowserName = navigator.appName;
var BrowserVersion = navigator.appVersion;
var BrowserMinorVersion = navigator.appMinorVersion;
var BrowserCodeName = navigator.appCodeName;
var SystemPlatform = navigator.platform;
var UserAgent = navigator.userAgent;

//document.write('<br><br><b>Browser Name: </b>'+BrowserName);
//document.write('<br><b>Browser Version: </b>'+BrowserVersion);
//document.write('<br><b>Browser Minor Version: </b>'+BrowserMinorVersion);
//document.write('<br><b>Browser Code Name: </b>'+BrowserCodeName);
//document.write('<br><b>System Platform: </b>'+SystemPlatform);
//document.write('<br><b>User Agent String: </b>'+UserAgent);


var NSLanguage = navigator.language;
var IELanguage = navigator.browserLanguage;

//document.write('<br><br><b>Netscape Language: </b>'+NSLanguage);
//document.write('<br><b>IE Browser Language: </b>'+IELanguage);


var NSPluginsList = navigator.plugins;
var NSPluginsCount = navigator.plugins.length;
//document.write('<br><br><b>Netscape Plugins List: </b>'+NSPluginsList);
//document.write('<br><b>Netscape Plugins Count: </b>'+NSPluginsCount);


//document.write('<br><br><br><h3>Interpretation:</h3>');
//document.write('<b>Screen Resolution: </b>'+ScreenWidth+'x'+ScreenHeight);
if (ColorDepth < 16) {
//document.write('<br><b>Color Depth: </b>'+Math.pow(2,ColorDepth)+' colors');
}
else {
//document.write('<br><b>Color Depth: </b>'+ColorDepth+'bit');
}


//document.write('<br><br>');
var IBrowser = '';
var IBrowserVersion = '';
var IOperatingSystem = '';
var ILanguage = '';
var IScreenResolution = ScreenWidth+'x'+ScreenHeight;
var IColorDepth = ColorDepth;

if (BrowserVersion.indexOf("MSIE") > -1) {
	
	ILanguage = IELanguage;
	
	if (UserAgent.indexOf("Opera") > -1) {
	// opera modified IE
	
		//document.write("<b>Browser:</b> Opera (Opera -- Modified IE)");
		IBrowser = "Opera";
		
		
		IBrowserVersion = UserAgent.substring(UserAgent.indexOf("Opera")+5);
		var OperaSplit = IBrowserVersion.split("[");
		IBrowserVersion = OperaSplit[0];
		
		if (ILanguage == "") {
			var OperaSplit2 = OperaSplit[1].split("]");
			ILanguage = OperaSplit2[0];
		}
	
	
	}
	else {
	// plain vanilla IE
		//document.write("<b>Browser:</b> IE (Internet Explorer)");
		IBrowser = "IE";
		
		if (BrowserVersion.indexOf("MSIE 8.0b") > -1) {
			IBrowserVersion = "8.0b";
		}
		else if (BrowserVersion.indexOf("MSIE 8.0") > -1) {
			IBrowserVersion = "8.0";
		}
		else if (BrowserVersion.indexOf("MSIE 7.0b") > -1) {
			IBrowserVersion = "7.0b";
		}	
		else if (BrowserVersion.indexOf("MSIE 7.0") > -1) {
			IBrowserVersion = "7.0";
		}	
		else if (BrowserVersion.indexOf("MSIE 6.0b") > -1) {
			IBrowserVersion = "6.0b";
		}
		else if (BrowserVersion.indexOf("MSIE 6.0") > -1) {
			IBrowserVersion = "6.0";
		}	
		else if (BrowserVersion.indexOf("MSIE 5.5") > -1) {
			IBrowserVersion = "5.5";
		}
		else if (BrowserVersion.indexOf("MSIE 5.22") > -1) {
		// mac v5.22
			IBrowserVersion = "5.22";
		}
		else if (BrowserVersion.indexOf("MSIE 5.17") > -1) {
		// mac v5.17
			IBrowserVersion = "5.17";
		}
		else if (BrowserVersion.indexOf("MSIE 5.01") > -1) {
			IBrowserVersion = "5.01";
		}
		else if (BrowserVersion.indexOf("MSIE 5.0") > -1) {
			IBrowserVersion = "5.0";
		}
		else if (BrowserVersion.indexOf("MSIE 4.01") > -1) {
			IBrowserVersion = "4.01";
		}
		else if (BrowserVersion.indexOf("MSIE 4.0") > -1) {
			IBrowserVersion = "4.0";
		}
		else {
			IBrowserVersion = "";
		}
		
	}
	
		
	//document.write("<br><b>Browser Version:</b> "+IBrowserVersion);
	
	//document.write("<br><b>Language:</b> "+ILanguage);
		
	

}
else if (UserAgent.indexOf("Yahoo") > -1 || UserAgent.indexOf("Slurp") > -1) {
	// yahoo slurp bot
	
	//document.write("<b>Browser:</b> Yahoo Slurp Bot");
	IBrowser = "YahooBot";	
	
}
else if (UserAgent.indexOf("Google") > -1) {
	// google bot
	
	//document.write("<b>Browser:</b> GoogleBot");
	IBrowser = "GoogleBot";	
	
}
else if (UserAgent.indexOf("msnbot") > -1) {
	// MSN bot
	
	//document.write("<b>Browser:</b> MSN Bot");
	IBrowser = "MSNBot";	
	
}

else if (BrowserName.indexOf("Netscape") > -1) {
//else if (UserAgent.indexOf("Mozilla") > -1) {


	if (UserAgent.indexOf("Gecko") > -1) {
		// gecko based (including netscape 6+ and later mozilla)
		
		if (UserAgent.indexOf("Netscape") > -1) {
			// netscape 6+
			//document.write("<b>Browser:</b> NS (Netscape Navigator)");
			IBrowser = "NS";
			
			if (UserAgent.indexOf("Netscape6/") > -1) {
			// netscape 6.x
				IBrowserVersion = UserAgent.substring(UserAgent.indexOf("Netscape6/")+10);
				//document.write("<br><b>Browser Version:</b> "+IBrowserVersion);
			}
			else if (UserAgent.indexOf("Netscape/7") > -1) {
			// netscape 7.x
				IBrowserVersion = UserAgent.substring(UserAgent.indexOf("Netscape/")+9);
				//document.write("<br><b>Browser Version:</b> "+IBrowserVersion);
			}
			else {
				IBrowserVersion = "";
			}
			
		}
		else if (UserAgent.indexOf("Firefox") > -1) {
			// firefox
			//document.write("<b>Browser:</b> Firefox");
			IBrowser = "FF";
			
			IBrowserVersion = UserAgent.substring(UserAgent.indexOf("Firefox/")+8);
			
			/*
			var FirefoxSplit = IBrowserVersion.split("(");
			IBrowserVersion = FirefoxSplit[0];
			*/
			
			var FirefoxSplit = IBrowserVersion.split(".");
			IBrowserVersion = FirefoxSplit[0]+"."+FirefoxSplit[1];
			
			
			//document.write("<br><b>Browser Version:</b> "+IBrowserVersion);
						
		}
		else if (UserAgent.indexOf("Safari") > -1) {
			// firefox
			//document.write("<b>Browser:</b> Safari");
			IBrowser = "SF";
			
			IBrowserVersion = UserAgent.substring(UserAgent.indexOf("Safari/")+7);
			
			var SafariSplit = IBrowserVersion.split(".");
			IBrowserVersion = SafariSplit[0];
					
			//document.write("<br><b>Browser Version:</b> "+IBrowserVersion);
						
		}
		else {
			// later mozilla
			//document.write("<b>Browser:</b> Moz (Mozilla)");
			IBrowser = "MZ";
			
			// knock off everything before and after the brackets
			var UASplit = UserAgent.split("(");
			var UASplit2 = UASplit[1].split(")");
			
			// now split it up by semi colons
			var UASplit3 = UASplit2[0].split(";");
			
			for (i = 0;i < UASplit3.length;++i) {
				if (UASplit3[i].indexOf("rv:") > -1) {
									
					IBrowserVersion = UASplit3[i].substring(UASplit3[i].indexOf("rv:")+3);
				
				}
			}
			
			
			//document.write("<br><b>Browser Version:</b> "+IBrowserVersion); 
			
			
		}
		
		
	}
	else {
		// old netscape
		//document.write("<b>Browser:</b> Netscape Navigator (Code: NS)");
		IBrowser = "NS";
		
		var VersionStringSplit = BrowserVersion.split("[");
		var IBV = VersionStringSplit[0];
		IBrowserVersion = parseFloat(IBV);
		//document.write("<br><b>Browser Version:</b> "+IBrowserVersion); 
			
	}
	
		
	
	ILanguage = NSLanguage.toLowerCase();
	//document.write("<br><b>Language:</b> "+ILanguage);

}
else if (UserAgent.indexOf("Opera") > -1) {
	// opera
	
	//document.write("<b>Browser:</b> Opera");
	IBrowser = "OP";
		
	
	IBrowserVersion = UserAgent.substring(UserAgent.indexOf("Opera")+6);
	var OperaSplit = IBrowserVersion.split("(");
	IBrowserVersion = OperaSplit[0];
	
	//document.write("<br><b>Browser Version:</b> "+IBrowserVersion); 
	
	
	
}
else {

	//document.write("<b>Browser:</b> Unknown (Send the UserAgent string as the Browser Version)");
	IBrowser = "Unknown";
	IBrowserVersion = UserAgent;
	ILanguage = "";
	
}



if (IBrowser == "IE" || IBrowser == "NS" || IBrowser == "MZ" || IBrowser == "OP" || IBrowser == "FF" || IBrowser == "SF") {

	var OSStringsArray = new Array();
	var OSDescriptionsArray = new Array();
	var OSCodesArray = new Array();
	var OSArrayCount = -1;
	var StopFlag = 0;
	var NumberFound = -1;
	
	
	OSDescriptionsArray[OSArrayCount] = "Unknown";
	OSCodesArray[OSArrayCount] = "Unknown";
	

	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Win 9x 4.90";
	OSDescriptionsArray[OSArrayCount] = "Windows ME";
	OSCodesArray[OSArrayCount] = "WinME";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Win98";
	OSDescriptionsArray[OSArrayCount] = "Windows 98";
	OSCodesArray[OSArrayCount] = "Win98";
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows 98";
	OSDescriptionsArray[OSArrayCount] = "Windows 98";
	OSCodesArray[OSArrayCount] = "Win98";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Win95";
	OSDescriptionsArray[OSArrayCount] = "Windows 95";
	OSCodesArray[OSArrayCount] = "Win95";
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows 95";
	OSDescriptionsArray[OSArrayCount] = "Windows 95";
	OSCodesArray[OSArrayCount] = "Win95";
	
		
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows NT 5.0";
	OSDescriptionsArray[OSArrayCount] = "Windows 2000";
	OSCodesArray[OSArrayCount] = "Win2000";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows NT 5.1";
	OSDescriptionsArray[OSArrayCount] = "Windows XP";
	OSCodesArray[OSArrayCount] = "WinXP";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows NT 5.2";
	OSDescriptionsArray[OSArrayCount] = "Windows Server 2003 / XP x64";
	OSCodesArray[OSArrayCount] = "Win2003x64";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows NT 6.0";
	OSDescriptionsArray[OSArrayCount] = "Windows Vista";
	OSCodesArray[OSArrayCount] = "WinVista";
	
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows NT 4.0";
	OSDescriptionsArray[OSArrayCount] = "Windows NT 4.0";
	OSCodesArray[OSArrayCount] = "WinNT4";
	
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows CE";
	OSDescriptionsArray[OSArrayCount] = "Windows CE";
	OSCodesArray[OSArrayCount] = "WinCE";
	
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "WinNT";
	OSDescriptionsArray[OSArrayCount] = "Windows (Unknown Version)";
	OSCodesArray[OSArrayCount] = "WinNT";
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Windows NT";
	OSDescriptionsArray[OSArrayCount] = "Windows (Unknown Version)";
	OSCodesArray[OSArrayCount] = "WinNT";
	
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "FreeBSD";
	OSDescriptionsArray[OSArrayCount] = "FreeBSD";
	OSCodesArray[OSArrayCount] = "FreeBSD";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Linux";
	OSDescriptionsArray[OSArrayCount] = "Linux";
	OSCodesArray[OSArrayCount] = "Linux";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "OS X";
	OSDescriptionsArray[OSArrayCount] = "Mac OSX";
	OSCodesArray[OSArrayCount] = "MacOSX";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "PPC";
	OSDescriptionsArray[OSArrayCount] = "Mac PowerPC";
	OSCodesArray[OSArrayCount] = "MacPowerPC";
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "PowerPC";
	OSDescriptionsArray[OSArrayCount] = "Mac PowerPC";
	OSCodesArray[OSArrayCount] = "MacPowerPC";
	
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "Macintosh";
	OSDescriptionsArray[OSArrayCount] = "Mac";
	OSCodesArray[OSArrayCount] = "Mac";
	
	/*
	OSArrayCount++;
	OSStringsArray[OSArrayCount] = "";
	OSDescriptionsArray[OSArrayCount] = "";
	OSCodesArray[OSArrayCount] = "";
	*/


	for (i = 0;i <= OSArrayCount;++i) {
		if (StopFlag < 1) {
			if (UserAgent.indexOf(OSStringsArray[i]) > -1) {
				IOperatingSystem = OSCodesArray[i];
				NumberFound = i;
				StopFlag = 1;
			}
		}
	}
	
	//document.write("<br><b>Operating System:</b> "+OSCodesArray[NumberFound]+" ("+OSDescriptionsArray[NumberFound]+")");

}

var Referal = escape(document.referrer);
var EncodedString = '';
var CurrentConversion = '';
for (i = 0;i < Referal.length;++i) {
		
	CurrentConversion = '';
			
	CurrentConversion = Referal.charCodeAt(i);
	
	if (CurrentConversion < 10) {
		CurrentConversion = '00'+CurrentConversion;
	}
	else if (CurrentConversion < 100) {
		CurrentConversion = '0'+CurrentConversion;
	}
	
	EncodedString = EncodedString + CurrentConversion;

}


document.write('<img src="'+CounterURL+CurrentPage+'/'+EncodedString+'/'+IScreenResolution+'/'+IColorDepth+'/'+IBrowser+'/'+IBrowserVersion+'/'+IOperatingSystem+'" width="1" height="1" border="0" alt="">');

//alert(CounterURL+CurrentPage+'/'+escape(document.referrer)+'/'+IScreenResolution+'/'+IColorDepth+'/'+IBrowser+'/'+IBrowserVersion+'/'+IOperatingSystem);
