<!-- 			
			
			
			 /*
			 determine how many seconds have past since the last recorded profit which was 2/2006
			 
			 total gas profit is calculated in three steps:
			 
			 1. total gas profit up to the last recorded figure - total_profit_from_last_figure
			 2. gas profit from the last recorded figure to the previous month - in_between_profit
			 3. gas profit from the beginning of the current month to the current day
			 */
			
			// Step 1
			
			// var total_profit_from_last_figure = <?php echo($profit_to_date); ?>
			
			// var total_profit_from_last_figure = 11607252337;
			
			// old value since Q1 2006
			// var total_profit_from_last_figure = 288548000000;
			
			// new value since Q2 2006
			var total_profit_from_last_figure = 322619000000;
			
			// var apps = <?php echo($avg_profit_per_sec) ?>
			
			// var apps = 116.41;
			
			// var apps = 2818;
			
			var apps = 2818/10;
			
			var apps_2 = 2818;

			var total_profit;
			
			var current_hour;
			var current_minute;
			var current_seconds;
			
			function calculate_profit()
			{
			 			 
			 var last_recorded_month = 3;
			 
			 var seconds_in_a_month = 2629743;
			 
			 var d = new Date();
			 
			 var previous_month = d.getMonth();
			 
			 var current_month = previous_month + 1;
			 
			 
			 // Step 2
			 var months_in_between;
			 var profit_in_between;
			 var actual_mib;
			 
			 if(last_recorded_month < previous_month)
			 {
			  months_in_between = previous_month - last_recorded_month;
			  profit_in_between = months_in_between * seconds_in_a_month * apps_2;
			 }
			 else if(last_recorded_month > previous_month)
			 {
			  months_in_between = previous_month - last_recorded_month;
			  actual_mib = 12 - months_in_between;
			  profit_in_between = actual_mib * seconds_in_a_month * apps_2;
			 }
			 else {}
			 
			 // Step 3
			 var beginning_of_month = 1;
			 
			 var current_day = d.getDate();
			 
			 var days_in_between = current_day - beginning_of_month;
			 
			 var seconds_in_a_day = 86400;
			 
			 var current_month_profit = days_in_between * seconds_in_a_day * apps_2;
			 
			 // calculate up to the current hour
			 
			 current_hour = d.getHours();
			 
			 var seconds_in_a_hour = 3600;
			 
			 var current_hour_profit = current_hour * seconds_in_a_hour * apps_2;
			 
			 // calculate up to the current minute
			 
			 current_minute = d.getMinutes();
			 
			 var seconds_in_a_minute = 60;
			 
			 var current_minute_profit = current_minute * seconds_in_a_minute * apps_2;
			 
			 // calculate up to the current second;

			 current_seconds = d.getSeconds();
			 			 
			 var current_second_profit = current_seconds * apps_2;
			 
			 // Adds values from Steps 1-3 to total_profit
			 
			 total_profit = total_profit_from_last_figure + profit_in_between + current_month_profit + current_hour_profit + current_minute_profit + current_second_profit;
			 
			 update_counter();			 
			}
			
			function update_counter()
			{
			 // Profit Increment
			 
			 total_profit += apps;
			 
			 //total_profit = (total_profit * 100)/100;
			 
			 var string_profit = total_profit.toString();
			 
			 var profit_array = string_profit.split(".");
			 
			 // profit_array[0] = left decimal
			 // profit_array[1] = right decimal
			 
			 // two decimal places
			 if(profit_array[1] < 10)
			  profit_array[1] *= 10;
			  			  
			  // add commas to profit_array[0]
			  
			  //profit_array[0] = profit_array[0].replace("1","dfgf");
			  
			  var profit_length = profit_array[0].length;
			  
			  //document.write(profit_length + "\n");
			  
			  
			  var mod = profit_length % 3;
			  
			  if(mod != 0)
			   var number_of_commas = Math.floor(profit_length/3);
			  else
			   var number_of_commas = (profit_length/3) - 1;
			   
			   
			  //var number_of_commas = Math.ceil(profit_length/3);
			   
			   //document.write(number_of_commas);
			   
			   var comma_length = profit_length;
			   var sub_string;
			   var comma_array = new Array();
			   var index = 0;
			   
			   var last_value = number_of_commas;
			   
			   //document.write(last_value + "\n");
			   
			  while(number_of_commas > 0) 
			  {
			    sub_string = profit_array[0].substring(comma_length-3,comma_length);
				
				//document.write(" " + sub_string + " " + "\n");
			  
			    sub_string = sub_string.replace(sub_string, "," + sub_string);
			   
			    comma_array[index] = sub_string;
				
				//document.write(" " + comma_array[index] + " " + "\n");
			  
			    comma_length = comma_length - 3;
			   
			    number_of_commas--;
			    index++;
			  }
			  
			  var length_comma_string = 3 * last_value;
			  
			 //document.write(length_comma_string + "\n");
			  
			  var leading_profit = profit_length - length_comma_string;
			  
			  //document.write(leading_profit);
			  
			 var leading = profit_array[0].substr(0,leading_profit);
			 
			  comma_array[last_value] = leading;
			  			  
			  var comma_profit = comma_array[last_value];
			  
			  for(var i = last_value-1; i >= 0; i--)
			  {
			    comma_profit += comma_array[i];
			  }
			  
			  //var comma_profit = comma_array[0] + comma_array[3] + comma_array[2] + comma_array[1] + comma_array[0]; 
			  
			  // var concat_profit = "$" + comma_profit + "." + profit_array[1];
			  
			  var concat_profit = "$" + comma_profit;

			 // document.gas_form.gas.value = concat_profit;
			 
			 document.getElementById("counter").innerHTML = concat_profit;
			 
			 window.status = "Top 5 Gas Companies Profit Since 2003: " + document.getElementById("counter").innerHTML;
			 
			 // window.status = comma_profit;
			 
			 setTimeout("update_counter()", 100);
			}
						
						
						
						
// -->