function w2mTester(){
this.flashdiv="flashplugindiv";
this.flashProxy=null;
this.lcId=new Date().getTime();
this.BWFirstRequest=0;
this.pingFirstRequest=0;
this.UPBWFirstRequest=0;
this.requester=null;
this.stringupload=null;
this.mailkey=null;
this.txtmailEmpty="Error email field is empty";
this.txtclicktest="Click on test button before";
this.testDone=false;
this.javaMonitor=null;
}

var w2m =new w2mTester();
w2mTester.prototype.cancel=function(){
var el = domUtil.getById("flashplugindiv");
el.innerHTML="";
setTimeout("w2m.goback()",1000);

};
w2mTester.prototype.goback=function(){
location.href='/';
};
w2mTester.prototype.putValue=function(id,txt){
var el = domUtil.getById(id);
el.innerHTML = txt;
};
function flashCheckEnv(compatible){
w2m.doitflash(true,true,compatible);
}
w2mTester.prototype.start = function(){
this.detect();
};
w2mTester.prototype.sendMail = function(){
//var form = domUtil.getById("emailform");
var emailfield = domUtil.getById("email");
var value= emailfield.value;
if(value!=""){
if(w2m.testDone===true){
w2m.copyvalue(w2m.mailkey,value);
document.emailform.submit();
}else{
alert(w2m.txtclicktest);
}
}else{
alert(w2m.txtmailEmpty);
}
};
w2mTester.prototype.runBandWidthTest = function(){
w2m.startUPBW();
w2m.startBW();
w2m.startPing();
};

function BWResponseReader() {}

BWResponseReader.prototype.readyListener = function (requesterObject) {
	var req = requesterObject.requester;
	var status = req.status;
	//alert("BWResponseReader readyListener status="+status);
	//setTimeout("w2m.startBW()", 10 * 60  * 1000);
	if ( status == 200) {
	
		w2m.endBW();
	} else {
   // alert ( "Not able to retrieve description" );
	}
};
function PingResponseReader() {}

PingResponseReader.prototype.readyListener = function (requesterObject) {
	var req = requesterObject.requester;
	//setTimeout("w2m.startPing()", 60 * 1000);
	if (req.status == 200) {
		w2m.endPing();
	} else {
   // alert ( "Not able to retrieve description" );
	}
};
function UploadResponseReader() {}

UploadResponseReader.prototype.readyListener = function (requesterObject) {
	var req = requesterObject.requester;
	//setTimeout("w2m.startPing()", 60 * 1000);
	if (req.status == 200) {
		w2m.endUPBW();
	} else {
   // alert ( "Not able to retrieve description" );
	}
};