//alert('very beginning');
var domainid = 1;
//with (navigator) alert(browserLanguage+' '+systemLanguage+' '+userLanguage);
//requesterURL = '://127.0.0.1/eric/statmaster/stattrack.cfm?ds=ETI';
requesterURL = '://dev1.businessgrade.com/cf/statmaster/stattrack.cfm?ds=DEMO';

function checkLoad(){
   if(loaded){
		var requester2 = new Image();
		req="http"+(document.URL.indexOf('https:')==0?'s':'')+requesterURL+"&rt=1";
		if (document.fileSize){
			var size = (document.fileSize)*1;
			var y = document.images;
			var imglength = 0;
			for (i=0;i<y.length;i++){
				imglength += (y[i].fileSize)*1;
			}
			A("sz", size+imglength);
		}
		var hits = document.images ? document.images.length + 1 : 0;
		A("hi", hits);
		var pageend = new Date();
		A("tt", pageend-pagestart);
		A("ti", document.title);
		A("di", domainid);
		A("rd", Math.round(Math.random()*999999999));
		//alert('second request\n'+req);
		requester2.src = req;
		clearInterval(loadwatch);
	}
	else return;
}

//var loaded = false;
//var pagestart = new Date();

function A( B, C){
	req+="&"+B+"="+escape(C);
}

var t = new Date();
//alert('setting req');
req="http"+(document.URL.indexOf('https:')==0?'s':'')+requesterURL+"&rt=0";

A("tz", t.getTimezoneOffset());
A("ua", navigator.userAgent.toLowerCase())
A("js", "js");
A("ul", navigator.appName=="Netscape" ? navigator.language : navigator.userLanguage);
A("jv", navigator.javaEnabled()?1:0);

if(typeof(screen)=="object"){
	A("sr", screen.width+"x"+screen.height);
	A("cd", screen.colorDepth);
}

A("ti", document.title);
A("di", domainid);

var tmp = window.document.URL.split('?');
A("qu", tmp[1]?tmp[1]:'')
var temp = tmp[0];
var tmp = temp.split('/');
var tmp2= tmp[0].split(':');
A("up", tmp2[0]);
var hp = tmp[2].split(':');
A("uh", hp[0]);
A("po", hp[1]?hp[1]:'80');
var ss='';
for (var i=3;i<tmp.length;i++){
	ss+='/'+tmp[i];
}
A("st", ss);

if (window.document.referrer!=''){
	var tmp = window.document.referrer.split('?');
	A("rq", tmp[1]?tmp[1]:'');
	A("rs", tmp[0]);

	var temp = tmp[0];
	var tmp = temp.split('/');
	var tmp2= tmp[0].split(':');
	A("rp", tmp2[0]);
	var hp = tmp[2].split(':');
	A("rh", hp[0]);
	A("ro", hp[1]?hp[1]:'80');
	var ss='';
	for (var i=3;i<tmp.length;i++){
		ss+='/'+tmp[i];
	}
	A("rs", ss);
}

A("rd", Math.round(Math.random()*999999999));

/*
if(navigator.mimeTypes){
	var pluginsmimetype = {
		aa:'application/pdf',
		fl:'application/x-shockwave-flash',
		wm:'video/x-ms-wm'
	}
	for(var mime in pluginsmimetype){
		var mimeType = pluginsmimetype[mime];
		if (navigator.mimeTypes[mimeType]){
			var plugin = navigator.mimeTypes[mimeType].enabledPlugin;
			var pluginDesc = plugin.description;
			alert(mime+' '+pluginsmimetype[mime]+' '+pluginDesc+'\n');
			A(mime, pluginDesc);
		}
	}
}
*/

function detectingFLASH() {
  var browser = navigator.userAgent.toLowerCase();
  flashVersion = 0;
	// NS3+, Opera3+, IE5+ Mac
	if ( navigator.plugins != null && navigator.plugins.length > 0 ) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if ( typeof flashPlugin == 'object' ) {
			if ( flashPlugin.description.indexOf('7.') != -1 ) flashVersion = 7;
			else if ( flashPlugin.description.indexOf('6.') != -1 ) flashVersion = 6;
			else if ( flashPlugin.description.indexOf('5.') != -1 ) flashVersion = 5;
			else if ( flashPlugin.description.indexOf('4.') != -1 ) flashVersion = 4;
			else if ( flashPlugin.description.indexOf('3.') != -1 ) flashVersion = 3;
		}
	} // IE4+ Win32 (VBscript)
	else if ( browser.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && browser.indexOf("win")!= -1 && browser.indexOf("16bit")== -1 ) {
	  document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('DIM obFlash \n');
		document.write('SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
		document.write('IF IsObject(obFlash) THEN \n');
		document.write('flashVersion = 7 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") END IF \n');
		document.write('IF flashVersion < 7 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 6 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") END IF \n');
		document.write('IF flashVersion < 6 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 5 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") END IF \n');
		document.write('IF flashVersion < 5 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 4 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") END IF \n');
		document.write('IF flashVersion < 4 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 3 \n');
		document.write('END IF');
	  document.write('</scr' + 'ipt\> \n');
  } // no Flash
  else {
	flashVersion = -1;
  }
return flashVersion;
}
A("fl", detectingFLASH());
A("ac", useAcrobat?1:0);

A("bl", navigator.browserLanguage?navigator.browserLanguage:'');
A("ul", navigator.userLanguage?navigator.userLanguage:navigator.language.toLowerCase());
A("sl", navigator.systemLanguage?navigator.systemLanguage:'');

//alert(window.document.URL);


var requester1 = new Image();
//alert('first request\n'+req);
requester1.onload = function(){
	loadwatch = window.setInterval("checkLoad()",200);
	//alert('cookie:\n'+document.cookie);
}

requester1.src = req;
