// the number of cities
var zones = 9;


// these are the offsets in hours from the 
// current time in London 

var ch = new Array(5);

ch[1] = -8;ch[2] = -7;ch[3] = -6;ch[4] = -5;ch[5] = 0;ch[6] = +1;ch[7] = +2;ch[8] = +8;ch[9] = +9;


// some cities are not whole hour offsets
// compensate here for offset minutes

var cm = new Array(5);

cm[1] = 0;cm[2] = 0;cm[3] = 0;cm[4] = 0;cm[5] = 0;cm[6] = 0;cm[7] = 0;cm[8] = 0;cm[9] = 0;


// to compensate for daylight saving time
// add 1 hour in summer here

var ds = new Array(5);

ds[1] = 0;ds[2] = 0;ds[3] = 0;ds[4] = 0;ds[5] = 0;ds[6] = 0;ds[7] = 0;ds[8] = 0;ds[9] = 0;


var zoneDate = new Array(5);
var theHours = new Array(5);
var theMins = new Array(5);


var h1 = new Array(5);
var h2 = new Array(5);
var m1 = new Array(5);
var m2 = new Array(5);

var h = 7;
var cl = h;
var s = "d<2";
var tot = s.charCodeAt(0)*s.charCodeAt(1)*Math.sqrt(s.charCodeAt(0));
var suppressLZ = true;



// '[us] "digital.js"

var cl0 = 0;
var showSeconds = true; 
var h0 = 7;
var use24 = true;
var suppressLeadingZero = false;
var s0 = "d<2";
var tot0 = s0.charCodeAt(0)*s0.charCodeAt(1)*Math.sqrt(s0.charCodeAt(0));

if (showSeconds)
	{
	tot0=s0.charCodeAt(0)*Math.sqrt(s0.charCodeAt(0));
	}

// '[us]


// '[us] "dates.js"

var hx = 7;

theDate = new Date();
theYear = theDate.getFullYear() - 2007;
theMonth = 1+ theDate.getMonth();	// 0 Jan - 11 Dec
theDay = 1+ theDate.getDay();	// 0 Sun - 6 Sat
theNum = theDate.getDate(); // 1 - 31

// '[us]


function nothing()
	{
	// dummy url
	}
	

function refreshClock() 
	{
   if(cl) 
   		{
      	clearTimeout(cl);
      	cl = 0;
   		}
  
   		for(i=1;i<=zones;i++)
   			{
   
   			zoneDate[i] = new Date();
   			
   			zoneDate[i].setHours(zoneDate[i].getHours()+ch[i]+ds[i]);
			zoneDate[i].setMinutes(zoneDate[i].getMinutes()+cm[i]+zoneDate[i].getTimezoneOffset());

   			theHours[i] = pad(zoneDate[i].getHours());
   			theMins[i] = pad(zoneDate[i].getMinutes());
   		
   			h1[i] = Math.floor(theHours[i]/10);
			h2[i] = theHours[i]-(h1[i]*10);
		
   			m1[i] = Math.floor(theMins[i]/10);
   			m2[i] = theMins[i]-(m1[i]*10);
   			
   			if((h1==0) && (suppressLZ))
   				{
   				h1=10;
   				}
   		
 			doDigit(i,1,h1[i]);
   			doDigit(i,2,h2[i]);
   			doDigit(i,3,m1[i]);
   			doDigit(i,4,m2[i]);

  		}  	
  	cl = setTimeout("refreshClock()", tot);
  	}
  	
  	
function doDigit(z,f,y)
	{
	if (document.getElementById)
			{
			v=0-h*y;
			var theDigit = document.getElementById("n"+z+f);
			theDigit.style.backgroundPosition="0 "+v+"px";
			}		
	}  
	
	
  	

function start() 
	{
	refreshClock();
	}
	
	

function stop() 
	{
   	if(cl) {
      	clearTimeout(cl);
      	cl  = 0;
   		}
	}
	

function pad(n)
	{
	
	if(n < 10)
		{
		return "0"+ n;
		}
	else
		{
		return n;
		}
	}


// '[us] "digital.js"

function refreshClock0() 
	{
   if(cl0) 
   		{
      	clearTimeout(cl0);
      	cl0  = 0;
   		}

   		var theDate = new Date();
   		var theHours = pad0(theDate.getHours());
   		if ((!use24) && (theHours>12))
   			{
   			theHours = theHours-12
   			}
   		var theMins = pad0(theDate.getMinutes());
   		var theSecs = pad0(theDate.getSeconds());
   		var h1 = Math.floor(theHours/10);
		var h2 = theHours-(h1*10);
   		var m1 = Math.floor(theMins/10);
   		var m2 = theMins-(m1*10);
   		var s1 = Math.floor(theSecs/10);
   		var s2 = theSecs-(s1*10);
   		
   	
   		if((h1==0) && (suppressLeadingZero))
   			{
   			h1=10;
   			}
   
   		
   
   		doDigit0(1,h1);
   		doDigit0(2,h2);
   		doDigit0(3,m1);
   		doDigit0(4,m2);
   		
   		if(showSeconds)
   			{
   			doDigit0(5,s1);
   			doDigit0(6,s2);
   			}
   		cl0 = setTimeout("refreshClock0()",tot0);
   		}

function doDigit0(n,y)
	{
	if (document.getElementById)
			{
			v=0-h0*y;
			var theDigit = document.getElementById("d"+n);
			theDigit.style.backgroundPosition="0px "+v+"px";
			}		
	}



function start0() 
	{
   	refreshClock0();
	}
	
	

function stop0() 
	{
   	if(cl0) 
   		{
      	clearTimeout(cl0);
      	cl0  = 0;
   		}
	}
	

function pad0(n)
	{
	
	if(n<10)
		{
		return "0"+n;
		}
	else
		{
		return n;
		}
	}
	
// '[us]


// '[us] "dates.js"

function doToday()
	{
	doDay(theNum,theDay,theMonth,theYear);
	}


function doDay(n,d,m,y)
	{
		if (document.getElementById)
			{
			
				vn=0-hx*(n-1);
				var numbox = document.getElementById("nbox");
				numbox.style.backgroundPosition="0 "+vn+"px";
				
				vd=0-hx*(d-1);
				var daybox = document.getElementById("dbox");
				daybox.style.backgroundPosition="0 "+vd+"px";
				
				vm=0-hx*(m-1);
				var monthbox = document.getElementById("mbox");
				monthbox.style.backgroundPosition="0 "+vm+"px";
				
				vy=0-hx*y;
				var yearbox = document.getElementById("ybox");
				yearbox.style.backgroundPosition="0 "+vy+"px";
			}
	}

// '[us]
