function speed(){
var imageAddr="http://www.sipring.ru/speed.jpg"+"?n="+Math.random();
var startTime,endTime;
var downloadSize=205342;
var download=new Image();
download.onload=function(){
endTime=(new Date()).getTime();
showResults();
};
startTime=(new Date()).getTime();
download.src=imageAddr;
function pause(n){
sTime=(new Date()).getTime();
while((new Date()).getTime()<=sTime+n);
};
function showResults(){
var duration=Math.round(endTime-startTime);
var bitsLoaded=downloadSize*8;
var speedBps=Math.round(bitsLoaded*1000/duration);
var speedKbps=(speedBps/1024).toFixed(2);
var speedMbps=(speedKbps/1024).toFixed(2);
chan=Math.round(speedBps/72000);
document.all("graf").style.background="#ededed";
document.all("graf1").style.background="#ededed";
document.all("graf3").style.background="#ededed";
document.all("graf5").style.background="#ededed";
document.all("graf10").style.background="#ededed";
document.all("graf31").style.background="#ededed";
if (chan > 1) {
document.all("graf1").style.background="red";
};
if (chan > 3) {
document.all("graf3").style.background=" #00b4ed";
};
if (chan > 5) {
document.all("graf5").style.background=" #00b4ed";
};
if (chan > 10) {
document.all("graf10").style.background=" #00b4ed";
};
if (chan > 30) {
document.all("graf").style.background=" #00b4ed";
};
if (chan > 31) {
document.all("graf31").style.background=" #00b4ed";
};
document.all("txt").innerHTML="Скорость: <i>"+ speedMbps + " Mbps</i> <br>";
};
};

