 	//---usage: writeclock();RunClock();
	

   var  TimeHandleClock;//clearInterval(TimeHandleClock); 


	var weekdays=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); 
 						 
		fCol='brown'; //face colour.
		sCol='white';//seconds colour.
		mCol='SeaGreen';//minutes colour.
		hCol='SeaGreen';//hours colour.


		H='....';
		H=H.split('');
		M='.....';
		M=M.split('');
		S='.....';
		S=S.split('');
		Ypos=0;
		Xpos=0;
		Ybase=8;
		Xbase=8;
		
		dots=12;
		ns=(document.layers)?1:0;
	 
			
	function writeclock(){	
		//clock 0
			document.write('<div id =00 style="position: relative;	width: 124px; height: 206px;	border: 1px dotted brown;">');
	   
				document.write('<div id =000 style="position:absolute;top:0px;left:0px;  "><div style="position:relative"><img src="../img100/clockBG.gif"></img>');
			 	for (i=1; i < dots+1; i++){
					document.write('<div id="ieDigits'+ i +'" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial,Verdana;font-size:12px;color:'+fCol+';text-align:center;padding-top:10px;font-weight:bold">'+i+'</div>');
				}
				document.write('</div></div>')
				
				document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
				for (i=0; i < M.length; i++){
					document.write('<div id="Minute'+ i +'"  style="position:absolute;width:4px;height:4px;font-size:2px; "><img src="../img100/clockminute.gif"></img></div>');
				}
				document.write('</div></div>')
				
				document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
				for (i=0; i < H.length; i++){
					document.write('<div id="Hour'+ i +'" style="position:absolute;width:6px;height:6px;font-size:2px;"><img src="../img100/clockhour.gif"></img></div>');
				}
				document.write('</div></div>')
				
				document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
				for (i=0; i < S.length; i++){
				document.write('<div id="Second'+ i +'" style="position:absolute;width:4px;height:4px;font-size:2px;"><img src="../img100/clocksecond.gif"></img></div>');
				}
				document.write('</div></div>')
			
			
				document.write('<div id="All" ALIGN = CENTER style="position: absolute;top:124px;left:0px;	width: 120px; height: 86px;');
				document.write('border: 2px dotted brown; background-color:steelblue;'); 
	 			document.write(' FONT-SIZE: 10pt; COLOR: silver; FONT-FAMILY:  Courier New" >');
				document.write('   </div>');
				
				
				document.write('</div>');
				
				
				//clock 1
			document.write('<div style="position: relative; 	width: 124px; height: 206px;	border: 1px dotted brown;">');
	   
				document.write('<div style="position:absolute;top:0px;left:0px;  "><div style="position:relative"><img src="../img100/clockBG.gif"></img>');
			 	for (i=1; i < dots+1; i++){
					document.write('<div id="ieDigitsB'+ i +'"  style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial,Verdana;font-size:12px;color:'+fCol+';text-align:center;padding-top:10px;font-weight:bold">'+i+'</div>');
				}
				document.write('</div></div>')
				
				document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
				for (i=0; i < M.length; i++){
					document.write('<div id="MinuteB'+ i +'" style="position:absolute;width:4px;height:4px;font-size:2px;"><img src="../img100/clockminute.gif"></img></div>');
				}
				document.write('</div></div>')
				
				document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
				for (i=0; i < H.length; i++){
					document.write('<div id="HourB'+ i +'" style="position:absolute;width:4px;height:4px;font-size:2px;"><img src="../img100/clockhour.gif"></img></div>');
				}
				document.write('</div></div>')
				
				document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
				for (i=0; i < S.length; i++){
				document.write('<div id="SecondB'+ i +'" style="position:absolute;width:4px;height:4px;font-size:2px; "><img src="../img100/clocksecond.gif"></img></div>');
				}
				document.write('</div></div>')
			

				
				document.write('<div id="All1" ALIGN = CENTER style="position: absolute;top:124px;left:0px;	width: 120px; height: 86px;');
				document.write('border: 2px dotted brown; background-color:steelblue;'); 
	 			document.write(' FONT-SIZE: 10pt; COLOR: silver; FONT-FAMILY:  Courier New" >');
				document.write('   </div>');
				
				document.write('</div>');
			
		}
		
		function cleanUpClockTimer(){
			clearInterval(TimeHandleClock);
		 }

			
		function RunClock(){
		   TimeHandleClock =window.setInterval("RunClockThread()",100);
  
		}
		
		
		function RunClockThread(){
			var thetime=getAtlantaTimeAnywhere();

			var nhours=thetime.getHours();
			var nmins=thetime.getMinutes();
			var nsecn=thetime.getSeconds();
			var nday=thetime.getDay();
				
			var nmonth=thetime.getMonth() +1;
				var ntoday=thetime.getDate();
				var nyear=thetime.getYear();
				var AorP=" ";

		
			
			
			var Beijingtime = new Date();
			Beijingtime.setTime(Number(thetime) + (13* 60 * 60000));

			var nyearBeijing =Beijingtime.getYear();
			var nmonthBeijing=Beijingtime.getMonth() +1;
			var ndayBeijing  =Beijingtime.getDay();
			var nhoursBeijing= Beijingtime.getHours();
			var ntodayBeijing= Beijingtime.getDate();
		

			if (nhours>=12)				AorP="P.M.";
			else						AorP="A.M.";
				
			if (nhours>=13)					nhours-=12;
			if (nhours==0)					nhours=12;
			
				
			if (nhoursBeijing>=12)			AorPBeijing ="P.M.";
			else							AorPBeijing ="A.M.";
				
			if (nhoursBeijing>=13)						nhoursBeijing-=12;
			if (nhoursBeijing==0)						nhoursBeijing=12;
		

			if (nsecn<10)						nsecn="0"+nsecn;

			if (nmins<10)						nmins="0"+nmins;

			nday =weekdays[nday];
				ndayBeijing =weekdays[ndayBeijing];
			
			if (nyear<=99)						nyear= "19"+nyear;

			if ((nyear>99) && (nyear<2000))	nyear+=1900;
			
			if(document.all){
				document.getElementById('All').innerText=nhours+": "+nmins+": "+nsecn+" "+AorP+" "+nday+", "+nmonth+"/"+ntoday+"/"+nyear + " Easten Time  U.S.A.";
				document.getElementById('All1').innerText=nhoursBeijing+": "+nmins+": "+nsecn+" "+AorPBeijing +" "+ndayBeijing+", "+nmonthBeijing+"/"+ntodayBeijing+"/"+nyearBeijing + "   BeiJing Time   China";

			} else{///firefox
				document.getElementById('All').textContent=nhours+": "+nmins+": "+nsecn+" "+AorP+" "+nday+", "+nmonth+"/"+ntoday+"/"+nyear + " Easten Time  U.S.A.";
 				document.getElementById('All1').textContent=nhoursBeijing+": "+nmins+": "+nsecn+" "+AorPBeijing +" "+ndayBeijing+", "+nmonthBeijing+"/"+ntodayBeijing+"/"+nyearBeijing + "   BeiJing Time   China";
    		}
 			//----------------------------------
			var time =  getAtlantaTimeAnywhere();
			 secs = time.getSeconds();
			sec = -1.57 + Math.PI * secs/30;
			mins = time.getMinutes();
			min = -1.57 + Math.PI * mins/30;
			hr = time.getHours();
			hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;
			
			
			hrBeijing = nhoursBeijing;
			hrsBeijing = -1.57 + Math.PI * hrBeijing/6 + Math.PI*parseInt(time.getMinutes())/360;
			Ypos=60 ;
			Xpos=60 ;
			
			
			// roll clock0
			for (i=1; i < dots+1; i++){
				
				document.getElementById('ieDigits'+i).style.top=Ypos-15+40*Math.sin(-0.49+dots+(i-1)/1.9);
				document.getElementById('ieDigits'+i).style.left=Xpos-14+40*Math.cos(-0.49+dots+(i-1)/1.9);
			}
			for (i=0; i < S.length; i++){
				document.getElementById('Second'+i).style.top =Ypos+i*Ybase*Math.sin(sec);
				document.getElementById('Second'+i).style.left=Xpos+i*Xbase*Math.cos(sec);
			}
			for (i=0; i < M.length; i++){
				document.getElementById('Minute'+i).style.top =Ypos+i*Ybase*Math.sin(min);
				document.getElementById('Minute'+i).style.left=Xpos+i*Xbase*Math.cos(min);
			}
			for (i=0; i < H.length; i++){
				document.getElementById('Hour'+i).style.top =Ypos+i*Ybase*Math.sin(hrs);
				document.getElementById('Hour'+i).style.left=Xpos+i*Xbase*Math.cos(hrs);
			}
			
			// roll clock1  hrsBeijing
			for (i=1; i < dots+1; i++){
				
				document.getElementById('ieDigitsB'+i).style.top=Ypos-15+40*Math.sin(-0.49+dots+(i-1)/1.9);
				document.getElementById('ieDigitsB'+i).style.left=Xpos-14+40*Math.cos(-0.49+dots+(i-1)/1.9);
			}
			for (i=0; i < S.length; i++){
				document.getElementById('SecondB'+i).style.top =Ypos+i*Ybase*Math.sin(sec);
				document.getElementById('SecondB'+i).style.left=Xpos+i*Xbase*Math.cos(sec);
			}
			for (i=0; i < M.length; i++){
				document.getElementById('MinuteB'+i).style.top =Ypos+i*Ybase*Math.sin(min);
				document.getElementById('MinuteB'+i).style.left=Xpos+i*Xbase*Math.cos(min);
			}
			for (i=0; i < H.length; i++){
				document.getElementById('HourB'+i).style.top =Ypos+i*Ybase*Math.sin(hrsBeijing);
				document.getElementById('HourB'+i).style.left=Xpos+i*Xbase*Math.cos(hrsBeijing);
			}
			
			
				 
			}
			
			
		function getAtlantaTimeAnywhere(){
				//----------start of universal clock offset setting----------------------

				var atlantaofficeoffset = 300;      //atlanta offset
				//  360                         middle area offset

				var visitortime = new Date();
				var visitoroffset = visitortime.getTimezoneOffset();
				
				if(visitoroffset < 0) { visitoroffset = Math.abs(visitoroffset) + 720; }
				else { visitoroffset = 720 - visitoroffset; }
				
				if(atlantaofficeoffset < 0) { atlantaofficeoffset = Math.abs(atlantaofficeoffset) + 720; }
				else { atlantaofficeoffset = 720 - atlantaofficeoffset; }
				
				var diff = atlantaofficeoffset - visitoroffset;
				
				var atlantaofficetime = new Date();
				atlantaofficetime.setTime(Number(visitortime) + (diff * 60000));
				
				//----------end of universal clock offset setting----------------------
			return atlantaofficetime;


			}