<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Fri, 10 Feb 2012 02:15:45 GMT--><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><title>Helpful Calculators</title><subtitle>Helpful Calculators</subtitle><id>http://dui-help.com/helpful-calculators/</id><link rel="alternate" type="application/xhtml+xml" href="http://dui-help.com/helpful-calculators/"/><link rel="self" type="application/atom+xml" href="http://dui-help.com/helpful-calculators/atom.xml"/><updated>2009-06-06T21:22:22Z</updated><generator uri="http://www.squarespace.com/" version="Squarespace Site Server v5.11.81 (http://www.squarespace.com/)">Squarespace</generator><entry><title>Gazza's Calculators</title><id>http://dui-help.com/helpful-calculators/2009/6/6/gazzas-calculators.html</id><link rel="alternate" type="text/html" href="http://dui-help.com/helpful-calculators/2009/6/6/gazzas-calculators.html"/><author><name>gotDUIHelp.com Staff</name></author><published>2009-06-06T18:40:56Z</published><updated>2009-06-06T18:40:56Z</updated><content type="html" xml:lang="en-US"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>  
  
 



  

  <meta name="MSSmartTagsPreventParsing" content="TRUE">
 
  <link rel="stylesheet" type="text/css" href="mainstyle.css">

  <script language="JAVASCRIPT" type="TEXT/JAVASCRIPT" src="utilityfunctions.js"></script> 
  <style type="text/css">


  </style>

  <script language="JavaScript" type="text/javascript">
<!--
 // ===================================================================
 // Gazza's Distance/Speed/Time Calculator
 // Author: Gary Nicholson <gary@nicholson.co.nz>
 // WWW: http://www.gazza.co.nz/
 //
 // NOTICE: You may use this code for any purpose, commercial or
 // private, without any further permission from the author. You may
 // remove this notice from your final code if you wish, however it is
 // appreciated by the author if at least my web site address is kept.
 //
 // Let me know if you use this on your site and I may link to your site.
 //
 // You may *NOT* re-distribute this code in any way except through its
 // use. That means, you can include it in your product, or your web
 // site, or any other form where the code is actually being used. You
 // may not put the plain javascript up on your site for download or
 // include it in your javascript libraries for download. Instead,
 // please just point to my URL to ensure the most up-to-date versions
 // of the files. Thanks.
 //
 // Permission to use this code without asking first may not apply
 // to other calculators on my site.  If in doubt ask me first.
 // ===================================================================

function calculatetime(){
    var form = document.timeform;
//  get conversion factors from selected options
    var i = form.distunits.selectedIndex;
    var distunitsvalue = form.distunits.options[i].value; 
    var j = form.speedunits.selectedIndex;
    var speedunitsvalue = form.speedunits.options[j].value;
//  calculate time in seconds    

    var d = form.distvalue.value;
    if (isblank(d)) d = '0';
      else
        d = parseFloat(d);
    
    var s = form.speedvalue.value;
    if (isblank(s)) s = '0';
      else
        s = parseFloat(s);


    var t = (d * distunitsvalue) / (s * speedunitsvalue);

//  convert to hours, minutes, seconds    
    form.hourvalue.value = Math.floor(t / 3600);
    t = t - (form.hourvalue.value * 3600);
    form.minutevalue.value = Math.floor(t / 60);
    form.secondvalue.value = Math.floor(t - (form.minutevalue.value * 60));

 return true;
}

function calculatedistance(){
    var form = document.distform;
//  get conversion factors from selected options
    var i = form.distunits.selectedIndex;
    var distunitsvalue = form.distunits.options[i].value; 
    var j = form.speedunits.selectedIndex;
    var speedunitsvalue = form.speedunits.options[j].value;

    var h = form.hourvalue.value;
    if (isblank(h)) h = '0';
      else
        h = parseFloat(h);

    var m = form.minutevalue.value;
    if (isblank(m)) m = '0';
      else
        m = parseFloat(m);

    var s = form.secondvalue.value;
    if (isblank(s)) s = '0';
      else
        s = parseFloat(s);

    var sp = form.speedvalue.value;
    if (isblank(sp)) sp = '0';
      else
        sp = parseFloat(sp);

//  convert time to seconds
    var temp = (h * 3600) + (m * 60) + s;
//  calculated distance
    form.distvalue.value = roundoff(((sp * speedunitsvalue) * temp) / distunitsvalue, 5); 
    
 return true;
}

function calculatespeed(){
    var form = document.speedform;
//  get conversion factors from selected options
    var i = form.distunits.selectedIndex;
    var distunitsvalue = form.distunits.options[i].value; 
    var j = form.speedunits.selectedIndex;
    var speedunitsvalue = form.speedunits.options[j].value;

    var h = form.hourvalue.value;
    if (isblank(h)) h = '0';
      else
        h = parseFloat(h);

    var m = form.minutevalue.value;
    if (isblank(m)) m = '0';
      else
        m = parseFloat(m);

    var s = form.secondvalue.value;
    if (isblank(s)) s = '0';
      else
        s = parseFloat(s);

    var d = form.distvalue.value;
    if (isblank(d)) d = '0';
      else
        d = parseFloat(d);

//  convert time to seconds
    var temp = (h * 3600) + (m * 60) + s;
//  calculate speed
    form.speedvalue.value = roundoff(((d * distunitsvalue)  / (temp * speedunitsvalue)), 5); 

 return true;
}


function roundoff(x,y){              //round off x to y decimal places
  x = parseFloat(x);
  y = parseFloat(y);
  x = Math.round(x * Math.pow(10,y))/Math.pow(10,y);
  return x;
}

function isblank(s)
{
  for(var i = 0; i < s.length; i++) {
      var c = s.charAt(i);
      if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
  }
  return true;
}


//-->
  </script></head><body>



<p>


</p>
<p>
Check the <a href="http://www.gazza.co.nz/calculators.html" target="_blank">Calculators Home Page</a> for information about these calculators including how to use them on your site.
</p>
<p>
<table cellpadding="10"><tbody><tr><td valign="top">
<form name="timeform">
<table bgcolor="#aaaaaa" width="510">
<tbody><tr><td>
<table bgcolor="#cccccc" border="1" width="100%">
<tbody><tr><td>
<table border="0" cellpadding="0" width="100%">
<tbody><tr>

<td colspan="7" bgcolor="#000080" align="center"><h2 style="color: white;">Time from Distance and Speed</h2>
</td></tr>

</tbody></table>
<hr>
<table>
<tbody><tr>
<td>Enter distance value and unit:</td> 
<td><input type="text" size="15" value="1" name="distvalue"></td>
<td><select name="distunits"><option value="1">Metres</option><option value="0.001">Millimetres</option><option value="0.01">Centimetres</option><option value="1000">Kilometres</option><option value="0.0254">Inches</option><option value="0.3048">Feet</option><option value="0.9144">Yards</option><option value="1.8288">Fathoms</option><option value="1609.344">Statute Miles</option><option value="1852">Nautical Miles</option><option value="299792458">Light Second</option><option value="17987547480">Light Minute</option><option value="1079252848800">Light Hour</option><option value="9460895208540000">Light Year</option><option value="30842518379800000">ParSec</option><option value="149597870000">Astronomical Unit</option></select>

</td>
</tr>
<tr>
<td>Enter speed value and units:</td> 
<td><input type="text" size="15" value="1" name="speedvalue"></td>
<td><select name="speedunits"><option value="1">Metres per Second</option><option value="0.01666666666666666666666666">Metres per Minute</option><option value="0.277777777777777777777777777777777777">Kilometre per Hour</option><option value="0.3048">Feet per Second</option><option value="0.00508">Feet per Minute</option><option value="0.01524">Yard per Minute</option><option value="0.44704">Statute Mile per Hour</option><option value="0.514444444444">Knot</option><option value="299792458">Speed of Light</option></select></td>
</tr>

</tbody></table>
<table>
<tbody><tr>

<td>Time is:</td>
<td><input type="text" size="15" value="" name="hourvalue"></td>
<td>Hours</td>
<td><input type="text" size="5" value="" name="minutevalue"></td>
<td>Minutes</td>
<td><input type="text" size="5" value="" name="secondvalue"></td>
<td>Seconds</td>
</tr>
<tr><td colspan="7">

<input type="button" value=" Calculate! " onclick="calculatetime(this.form)" class="red">
</td></tr>
</tbody></table>
</td></tr></tbody></table>

</td></tr></tbody></table>
</form>

<form name="distform">
<table bgcolor="#aaaaaa" width="510">
<tbody><tr><td>
<table bgcolor="#cccccc" border="1" width="100%">
<tbody><tr><td>
<table border="0" cellpadding="0" width="100%">
<tbody><tr>
<td colspan="7" bgcolor="#000080" align="center"><h2 style="color: white;">Distance from Speed and Time</h2>

</td></tr>
</tbody></table>
<hr>

<br><br>

<table>
<tbody><tr>

<td>Enter speed value and units:</td> 
<td><input type="text" size="15" value="1" name="speedvalue"> </td>
<td><select name="speedunits"><option value="1">Metres per Second</option><option value="0.01666666666666666666666666">Metres per Minute</option><option value="0.277777777777777777777777777777777777">Kilometre per Hour</option><option value="0.3048">Feet per Second</option><option value="0.00508">Feet per Minute</option><option value="0.01524">Yard per Minute</option><option value="0.44704">Statute Mile per Hour</option><option value="0.514444444444">Knot</option><option value="299792458">Speed of Light</option></select></td>

</tr>
</tbody></table>




<br><br>




<table>
<tbody><tr>
<td>Enter time:</td>
<td><input type="text" size="15" value="0" name="hourvalue"></td>
<td>Hours</td>
<td><input type="text" size="5" value="0" name="minutevalue"></td>

<td>Minutes</td>
<td><input type="text" size="5" value="0" name="secondvalue"></td>
<td>Seconds</td>
</tr>

</tbody></table>
<table>
<tbody><tr>
<td>Distance is (select unit before calculating):</td> 
<td><input type="text" size="15" value="" name="distvalue"></td>
<td><select name="distunits"><option value="1">Metres</option><option value="0.001">Millimetres</option><option value="0.01">Centimetres</option><option value="1000">Kilometres</option><option value="0.0254">Inches</option><option value="0.3048">Feet</option><option value="0.9144">Yards</option><option value="1.8288">Fathoms</option><option value="1609.344">Statute Miles</option><option value="1852">Nautical Miles</option><option value="299792458">Light Second</option><option value="17987547480">Light Minute</option><option value="1079252848800">Light Hour</option><option value="9460895208540000">Light Year</option><option value="30842518379800000">ParSec</option><option value="149597870000">Astronomical Unit</option></select>

</td>
</tr>
<tr><td colspan="7">
<input type="button" value=" Calculate! " onclick="calculatedistance()" class="red">
</td></tr>
</tbody></table>

</td></tr></tbody></table>
</td></tr></tbody></table>
</form>

<form name="speedform">
<table bgcolor="#aaaaaa" width="510">
<tbody><tr><td>
<table bgcolor="#cccccc" border="1" width="100%">
<tbody><tr><td>
<table border="0" cellpadding="0" width="100%">

<tbody><tr>
<td colspan="7" bgcolor="#000080" align="center"><h2 style="color: white;">Speed from Distance and Time</h2>
</td></tr>
</tbody></table>
<hr>
<table>

<tbody><tr>
<td>Enter distance value and unit:</td> 
<td><input type="text" size="18" value="1" name="distvalue"></td>
<td><select name="distunits"><option value="1">Metres</option><option value="0.001">Millimetres</option><option value="0.01">Centimetres</option><option value="1000">Kilometres</option><option value="0.0254">Inches</option><option value="0.3048">Feet</option><option value="0.9144">Yards</option><option value="1.8288">Fathoms</option><option value="1609.344">Statute Miles</option><option value="1852">Nautical Miles</option><option value="299792458">Light Second</option><option value="17987547480">Light Minute</option><option value="1079252848800">Light Hour</option><option value="9460895208540000">Light Year</option><option value="30842518379800000">ParSec</option><option value="149597870000">Astronomical Unit</option></select>

</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<td>Enter time:</td>
<td><input type="text" size="15" value="0" name="hourvalue"></td>
<td>Hours</td>
<td><input type="text" size="5" value="0" name="minutevalue"></td>
<td>Minutes</td>
<td><input type="text" size="5" value="0" name="secondvalue"></td>

<td>Seconds</td>

</tr>
</tbody></table>
<table>
<tbody><tr>
<td>Speed is (select units before calculating):</td> 
<td><input type="text" size="18" value="1" name="speedvalue"></td>
<td><select name="speedunits"><option value="1">Metres per Second</option><option value="0.01666666666666666666666666">Metres per Minute</option><option value="0.277777777777777777777777777777777777">Kilometre per Hour</option><option value="0.3048">Feet per Second</option><option value="0.00508">Feet per Minute</option><option value="0.01524">Yard per Minute</option><option value="0.44704">Statute Mile per Hour</option><option value="0.514444444444">Knot</option><option value="299792458">Speed of Light</option></select></td>

</tr>
<tr><td colspan="7">
<input type="button" value=" Calculate! " onclick="calculatespeed()" class="red">
</td></tr>
</tbody></table>
</td></tr></tbody></table>

</td></tr></tbody></table>
</form>
</td></tr></tbody></table>
</p>
<p>
<script type="text/javascript">
<!--
writeFooter();
//-->
</script>
</p>
<br>

<hr size="5" width="75%">



      
<blockquote>
<blockquote>
<center></center>

<blockquote><center></center>
</blockquote>
</blockquote>
      </blockquote>




</body></html>]]></content></entry></feed>
