                                                       // Internet Time routine
// Info on this routine and about Internet Time?
// Check http://pro.wanadoo.fr/pl.lamballais/itime/

// In order to display an iTime which is correct according to the
// computer time, we must often call the routine.
// But in order to avoid "transfert for nothing", we must
// display the time only when it has changed!  So we note the old iTime
// and we compute each time the new one. If they are different,
// we display and we say that old_iTime is now new time.
var old_iT = 0;

	function gfx_iTime() 
	{
// Declare all variables (easier)
		var h;
		var mn;
		var sec;
		var gs;
		var gm;
		var now;
		var iS;
		var IT;
		var iV;
		var Ngfx;
// As usual. We call us many time!
	window.setTimeout( "gfx_iTime()", 200 ); 

// Fill the date structure
		now = new Date();
// Get the GMT offset from the computer time to Greenwich.
		gm = now.getTimezoneOffset();
// Add 60 minutes because Swatch'City is not on GMT Meridian!
		gs = (gm+ 60) * 60;

// Now get hours, minutes and second, and compute the total number
// of seconds. We add the GMT offset and * by 10 in order to avoid 
// math complication for the little JavaScript motor!
		h = now.getHours();
		mn = now.getMinutes();
		sec = now.getSeconds();
		iV = 10 * ((h * 3600) + (mn * 60) + sec + gs);	
// Due to GMT offset addition, perhaps we are now at 27 o'clock!
// But as time is a circular value if we're bigger than a day, we just
// have to substract one day to get the correct time.
		if (iV > 864000)
				{iV = iV - 864000};
// Now compute iTime (avoiding the rest of the division)
		iT = (iV - (iV%864)) / 864; 

// Do we have to display it?
		if (iT != old_iT)
		{
// Yes: so change value to string.		
			iS = iT.toString();
// Build the name of the first digit. Notice that I've build the 10 digits
// (0->9) with special filename, so it's easy to get the name of the
// good digit, easier than with name like 'first.gif', 'second.gif' and so on.
			Ngfx = "images/NUMBERS/NUM_" + iS.charAt(0) + ".gif";
// indicate the browser to display this picture.
			document.Digit1.src = Ngfx;
// And now the same for the second one...
			Ngfx = "images/NUMBERS/NUM_" + iS.charAt(1) + ".gif";
			document.Digit2.src = Ngfx;
// And the third one.
			Ngfx = "images/NUMBERS/NUM_" + iS.charAt(2) + ".gif";
			document.Digit3.src = Ngfx;
			old_iT = iT;
		}
}



