<script type="text/javascript">
<!--

  function roundNumber()
  {
      var OurNumber = document.getElementById( 'theNumber' ).value;
	  var RoundedTo = document.getElementById( 'roundedto' ).value;
	  
	  RoundedTo = parseFloat(RoundedTo);
	  
	  var separator = ',';
	  var minFixed = 0;
	  var decPlace = " ";
	  
	  switch (RoundedTo)
				      {
				       case 1: // to nearest whole unit
						 minFixed = 0;
						 decPlace = " ";
					   break;
	                   case 0.1: // to nearest tenth
						 minFixed = 1;
						 decPlace = ".";
					   break;
	                   case 0.01: // to nearest hundredth
						 minFixed = 2;
						 decPlace = ".";
					   break;
	                   case 0.001: // to nearest thousandth
						 minFixed = 3;
						 decPlace = ".";
					   break;
	            
				       } //end of switch

      var OurNumberCleaned = OurNumber.replace(/[^\d\.\-\ ]/g, '');
	  
	  if (isNumber (OurNumberCleaned) && RoundedTo > 0)
	  {
      var worksheetOutput = "";
	  var result = Math.round(OurNumberCleaned/RoundedTo)*RoundedTo;
	  
	  result1 = formatNumber(result,minFixed ,separator,decPlace,'','','-','')
	  
	  worksheetOutput += result1 ;
      // Output HTML to our DIV...
      document.getElementById( 'output' ).innerHTML = worksheetOutput;
	  }
  }
  
  function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
  }
  
    // number formatting function
// copyright Stephen Chapman 24th March 2006, 22nd August 2008
// permission to use this function is granted provided
// that this copyright notice is retained intact

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0'); if (z<0) z = 1; y.splice(z, 0, pnt); if(y[0] == pnt) y.unshift('0'); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}
  -->
</script>

The entries are the properties of their respective owners.
Powered by Flask, SQLAlchemy, Pygments and Bootstrap.