
	String.prototype.replaceAll=function(old, rep ){
		foundat = 0;
		ret = this;
		do{
			foundat = ret.indexOf(old, foundat);
			if (foundat!=-1){
				ret = ret.substring(0,foundat)+rep+ret.substr(foundat+1);
				foundat += rep.length;     
			}
		}while (foundat!=-1);
		return ret;
	}

	function getFlashVersion(){
		var version = "undefined";
	
		if(navigator.plugins && navigator.mimeTypes.length){
			var x = navigator.plugins["Shockwave Flash"];
			if(x && x.description) {
				version = x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
			}
		}else{
			try{
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				for (var i=3; axo!=null; i++) {
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				}
			}catch(e){}
			
			try{
				version = axo.GetVariable("$version").split(" ")[1].split(",");
			}catch(e){}
		}
		var versionStr = String(version);
		return versionStr.replaceAll(',', '.');
	}

	function getAdobeReaderVersion() {
		var acrobatVersion = 0;
		var acrobatInstalled = false;

		var agent = navigator.userAgent.toLowerCase(); 
	
		// NS3+, Opera3+, IE5+ Mac, Safari (support plugin array):  check for Acrobat plugin in plugin array
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			for (i=0; i < navigator.plugins.length; i++ ) {
				var plugin = navigator.plugins[i];
				if (plugin.name.indexOf("Adobe Acrobat") > -1) {
					acrobatVersion = parseFloat(plugin.description.substring(30));
					if (isNaN(acrobatVersion)) {
						acrobatVersion = escape(plugin.description);
					}
				}
			}
		}	
		// IE4+ Win32:  attempt to create an ActiveX object using VBScript
		else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
			try 
			{ 
				oAcro7=new ActiveXObject('AcroPDF.PDF.1'); 
				if (oAcro7) 
				{ 
					acrobatInstalled=true; 
					acrobatVersion='7.0'; 
				} 
			} 
			catch(e) {} 
			
			if(!acrobatInstalled)
			{
				try
				{
					oAcro6 = new ActiveXObject('GBDetect.Detect.1');
					if(oAcro6)
					{
						acrobatInstalled=true; 
						acrobatVersion='6.0'; 
					} 
				}
				catch(e) {}
				
				if(!acrobatInstalled)
				{
					try
					{
						oAcro5=eval("new ActiveXObject('PDF.PdfCtrl.5');"); 
							if (oAcro5) 
							{ 
								acrobatInstalled=true; 
								acrobatVersion='5.0';  
							} 
					}
					catch(e) {}
					
					if(!acrobatInstalled)
					{
						try 
						{ 
							oAcro4=new ActiveXObject('PDF.PdfCtrl.1'); 
							if (oAcro4) 
							{ 
								acrobatInstalled=true; 
								acrobatVersion='4.0'; 
							} 
						} 
						catch(e) {}
						if(!acrobatInstalled)
						{
							acrobatVersion = 0;
						}
					}
				}
			}
		}
		return acrobatVersion
	}

	var http = getHTTPObject(); 

	function getHTTPObject() {

		var xmlhttp;
		
		/*@cc_on			
		@if (@_jscript_version >= 5)
		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
		    	xmlhttp = false;
			}
		}
		@else
			xmlhttp = false;
		@end @*/
		
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp = false;
			}
		}
		if (!xmlhttp && window.createRequest) {
			try {
				xmlhttp = window.createRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}

		return xmlhttp;
	}


	function browserStatReport() {
		//alert('pageonload');
		var ck = "undefined";
		var w = "undefined";
		var h = "undefined";
		var v = "undefined";
		var conn = "undefined";
		var fv = "undefined";
		var av = "undefined";
	
		var browserVersionNum = parseFloat(navigator.appVersion);
	
		if (browserVersionNum >= 4) {
	
			//Detect whether cookies are turned on or off
			var cookieName = 'testCookie';
			document.cookie = cookieName + '=test';
			ck = document.cookie.indexOf(cookieName) != -1;
			
			//Detect screen resolution 
			w = screen.width; 
			h = screen.height; 
			
			v = navigator.appName; 
			
			//Detect number of colors supported
			if (v != 'Netscape') {
				c=screen.colorDepth;
			}
			else {
				c=screen.pixelDepth;
			}
			
			//For all Windows, IE 5 and above, detect whether connectionType is lan or modem,	
			if (v == 'Microsoft Internet Explorer') {
				var intMSIELoc;
				var intWinLoc;
				intMSIELoc = navigator.appVersion.indexOf('MSIE');
				intWinLoc = navigator.userAgent.indexOf('Win');
				if (intWinLoc != -1 && intMSIELoc != -1 && navigator.appVersion.substr(intMSIELoc + 5, 1) >= 5) {
					document.body.addBehavior('#default#clientCaps');
					conn = document.body.connectionType;
				}
			}
			
			//Detect Flash version
			fv = getFlashVersion();
			
			//Detect Adobe Reader version
			av = getAdobeReaderVersion();
		}
		info = '?page=' + document.URL + '&w=' + w + '&h=' + h + '&c=' + c + '&conn=' + conn + '&ck=' + ck + '&fv=' + fv + '&av=' + av;
		
		var beginDomain = document.URL.indexOf('://')+3;
		var domain = document.URL.substring(beginDomain, document.URL.indexOf('/',beginDomain));
		var protocal = document.URL.substring(0, beginDomain-3);
		var file = protocal + '://' + domain + '/browserstats/browserstats.htm';	
		
		if(http) {
			http.open("GET", file + info, true);	
	  		http.onreadystatechange = handleHttpResponse;	
	  		http.send(null);
		}
	}
	
	function handleHttpResponse() {	
	 /* if (http.readyState == 4) {
	  	if (http.status == 200) alert("URL Exists!")
	   		else if (http.status == 404) alert("URL doesn't exist!")
	    			else alert("Status is " + http.status)
	  }	*/
	}