<!-- hide this stuff from other browsers 
//<![CDATA[
					 
/*
Date: 03/12/2008
Created by: www.christopherjones.com.au
Precis: Ticker counting down to Earth Hour
Instructions: Add "<div id="eh-counter"></div>" to your page and include this javascript file. Modify the settings below if necessary.
*/

// SETTINGS
var earthHour = new Date("July 24, 2009 01:00:00");		
var stylePath = "counter.css";


// -----------------------------------------------------------------------------------------
// Do the Math
function calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
	//Add leading zero
  if (s.length < 2) {
    s = "0" + s;
	}
  return s;
}

//Change the Time
function getInterval() {
	
	//Init Values
	//var seconds = 0;
	var minutes = 0;
	var hours = 0;
	var days = 0;
	var now = new Date();
	
	datediff = new Date(earthHour-now);
	interval = Math.floor(datediff.valueOf()/1000);
	
	// Calculate values
	if (interval > 0) {		
		//seconds = calcage(interval,1,60);		
		minutes = calcage(interval,60,60);		
		hours = calcage(interval,3600,24);		
		days = calcage(interval,86400,100000);		
	}

	//Update Values
	document.getElementById('ehc-d').innerHTML= days;
	document.getElementById('ehc-h').innerHTML= hours;
	document.getElementById('ehc-m').innerHTML= minutes;
	//document.getElementById('ehc-s').innerHTML= seconds;

	//Repeat 
	window.setTimeout(getInterval, 1000);

}

function initCounter() {
	//document.getElementById('eh-counter').innerHTML= '<ul><li id="ehc-d"></li><li id="ehc-h"></li><li id="ehc-m"></li><li id="ehc-s"></li></ul>';
	document.getElementById('eh-counter').innerHTML= '<ul><li id="ehc-d"></li><li id="ehc-h"></li><li id="ehc-m"></li></ul>';
	getInterval();
}

// Start Script
document.write('<link href="' + stylePath + '" type="text/css" rel="stylesheet" media="all" />');
window.onload = initCounter;


//]]>
// end hiding javascript -->