function setCookie(name, ID){
expireDate = new Date;
expireDate.setTime(expireDate.getTime()+(24*60*60*1000));//24
var curCookie = name + "=" + ID + ( "; expires=" + expireDate.toGMTString() + "; domain=" + '.worldwinner.com' + "; path=" + '/' );
document.cookie = curCookie;
}

// ConnectionSpeed Detection section
var datasize=33430; // in Bytes
var startTime=0;
var endTime=0;
var date=0;
var textMessage="";
var throughput=0;
function calcThroughput() {
    var diffTimeMilliseconds = endTime - startTime;
    var diffTimeSeconds = diffTimeMilliseconds/1000;
    var bits = (datasize*8);   // convert Bytes to bits,
    var kbits = bits/1024;     // convert bits to kbits
    throughput = kbits/(diffTimeSeconds);
    throughput = throughput * .93;  // account for IP packet header overhead - averages about 7%
    setCookie("ThroughPut", throughput);
    textMessage = "time to load: (sec): <B>" + diffTimeSeconds + "</B><BR>kbits:<B> " + kbits + "</B><BR>Throughput (kbps): <B>" + throughput +"</B>"
}

date = new Date();
startTime=date.getTime();
