<script type="text/javascript">
// Function called when the test has completed
function passResults(mssid,detaillink,downspeed,upspeed,downqos,upqos,minrtt,avgrtt,rttconsistency,maxdelay,bandwidth,routespeed,forcedidle) {
downToKbps = addCommas(Math.round(downspeed/1000)); <!-- Converts the download speed to Kbps, rounds the number, then adds commas -->
upToKbps = addCommas(Math.round(upspeed/1000)); <!-- Converts the upload speed to Kbps, rounds the number, then adds commas -->
bwToKbps = addCommas(Math.round(bandwidth/1000)); <!-- Converts the bandwidth to Kbps, rounds the number, then adds commas -->
rtToKbps = addCommas(Math.round(routespeed/1000)); <!-- Converts the routespeed to Kbps, rounds the number, then adds commas -->
bodyPct = escape("%");
bodyQues = escape("?");
// Creates the email body to be used in the MailTo link
var emailbody = "";
emailbody += "Enter some details here about the problem you are having....";
emailbody += "%0D%0D";
emailbody += "Speed Test Results";
emailbody += "%0D%0D";
emailbody += "MSSID:" + mssid + "%0D";
emailbody += "http://mcsiad.visualware.com/myspeed/db/report" + bodyQues + "id=" + mssid + "%0D";
emailbody += "Download Speed: " + downToKbps + " Kbps %0D";
emailbody += "Upload Speed: " + upToKbps + " Kbps %0D";
emailbody += "Download Consistency of Service: " + downqos + bodyPct + " %0D";
emailbody += "Upload Consistency of Service: " + upqos + bodyPct + " %0D";
emailbody += "Min RTT: " + minrtt + "ms %0D";
emailbody += "Avg RTT: " + avgrtt + "ms %0D";
emailbody += "RTT Consistency: " + rttconsistency + bodyPct + " %0D";
emailbody += "Max Pause: " + maxdelay + "ms %0D";
emailbody += "Bandwidth: " + bwToKbps + " Kbps %0D";
emailbody += "Route Speed: " + rtToKbps + " Kbps %0D";
emailbody += "Forced Idle: " + forcedidle + bodyPct + " %0D";
// Populates in innerHTML with the mailto link, which includes the MSSID in the subject line and the email body above as the body
document.getElementById("theemaillink").innerHTML = '<br><br><a href="mailto:someone@company.com&subject=Speed Test: ' + mssid + '&body=' + emailbody + '">Click here to email support for test ID: ' + mssid + '</a>';
// Makes the DIV visible
document.getElementById("theemaillink").style.display = 'block';
}
// Function used to add commas
function addCommas(str){
var arr,int,dec;
str += '';
arr = str.split('.');
int = arr[0] + '';
dec = arr.length>1?'.'+arr[1]:'';
return int.replace(/(\d)(?=(\d{3})+$)/g,"$1,") + dec;
}
</script>
|