var transferSize = 12 * 1024;

var startTime = parent.QUERY.document.getElementById( "stTime" ).value;
var endRendTime = null;

if(document.addEventListener) {
	if(document.getBoxObjectFor) {
		document.addEventListener("DOMContentLoaded", setPageTiming2, null);		//Gecho
	}
	else {
		window.addEventListener("load", setPageTiming2, false);
	}
}
else if(document.attachEvent) {
	document.attachEvent("onreadystatechange", setPageTiming2);
}
else {
//			window.onload = setPageTiming2;
	window.addEventListener('load', setPageTiming2, false);			// 8.3.0.0 (2022/08/01)
}

function setPageTiming2(evt) {
	var bSetIt;
	if( document.attachEvent ) { bSetIt = (document.readyState=="complete" ); }
	else					   { bSetIt = true; }

	if(bSetIt) {
		var queryTime = parent.QUERY.getValue( document.getElementById("queryTime") );
		var viewTime  = parent.QUERY.getValue( document.getElementById("viewTime" ) );
		timecheck2( queryTime, viewTime );
	}
}

function timecheck2( queryTime,viewTime ) {
	endRendTime = (new Date()).getTime();
	var pageTime = (endRendTime - startTime - queryTime - viewTime);

	timeCheck3();

	document.getElementById("qTime").innerHTML = queryTime;
	document.getElementById("vTime").innerHTML = viewTime;
	document.getElementById("pTime").innerHTML = pageTime;

	basicInformation();
}

function timeCheck3() {
	var endTime = (new Date()).getTime();
	var headerTime = (endTime - endRendTime);
	var totalTime = (endTime - startTime);

	document.getElementById("hTime").innerHTML = headerTime;
	document.getElementById("tTime").innerHTML = totalTime;

	transStartTime = new Date();
	$.ajax({
		url : "test.bmp"
		,async : false
	})
	transEndTime = new Date();

	trnsTime = transEndTime - transStartTime;
	trnsSpeed = Math.round( transferSize / ( trnsTime ) * 1000 );

	document.getElementById("sTime").innerHTML = trnsTime;
	document.getElementById("rTime").innerHTML = trnsSpeed;
}

function basicInformation() {
	document.getElementById("platform").innerHTML = navigator.platform;
	document.getElementById("browser").innerHTML = navigator.appName;
	document.getElementById("version").innerHTML = navigator.appVersion;
	document.getElementById("cpu").innerHTML = navigator.cpuClass
}
