
		// rate 
		var rate = .03; 															// rate - tons per second
 		var startTotal = 3034000; 										// total start tons 
 		
 		// date globals
 		var curDate = new Date(); 										// todays date
		var startDate = new Date("Jan 1, 2009");  		// start of calculation 
		
		var diff = curDate - startDate;								// MS between today and start
		var secsDiff = diff / 1000;
		
		// create calc function
		$(document).ready(function() {
		
			setInterval( function () {
				
				var curDate = new Date(); 								// todays date
				var startDate = new Date("Jan 1, 2009");  // start of calculation 
				var diff = curDate - startDate;						// MS between today and start
				var secsDiff = diff / 1000;
	
				total = (secsDiff * rate) + startTotal;
				total = addCommas(total.toFixed(2) );
			
				// display results
				$("#counter").html( "<span id='wrapper'>" + total + "<\/span> <span id='label' class='grey'>TONS TO DATE<\/span>" );
	
			},100);			
			
		});
		
		function addFormat(nStr){
			nStr += '';
			x = nStr.split('.');
			x1 = x[0];
			x2 = x.length > 1 ? x[1] : '';
			
			var rgx = /(\d+)(\d{1})/;
			while (rgx.test(x1)) {
				x1 = x1.replace(rgx, '$1' + '<span class="grey bar">|<\/span>' + '$2');
			}
			
			while (rgx.test(x2)) {
				x2 = x2.replace(rgx, '$1' + '<span class="grey bar">|<\/span>' + '$2');
			}
			
			return x1 + ' . ' + x2;
		}
		
		
		function addCommas(nStr){
      nStr += '';
      x = nStr.split('.');
      x1 = x[0];
      x2 = x.length > 1 ? '.' + x[1] : '';
      var rgx = /(\d+)(\d{3})/;
      while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
      }
      return x1 + x2;
    }

