<html>

<head>
<title>Java Clock</title>
<script LANGUAGE="JavaScript">
//added to original code
<!--- hide script from old browsers
/******GLOBAL DECL *****************/
var lclID;			/* timeout handles */
var stdID;
var nDBG = 0;		/* debug level:  0-none 3-extreme */
var ticks = 0;	/* ticks of standard clock */
var nDSToffset = 0;	/* hours offset for non DST compatible browsers */
/***** MAIN *******************V3*****/
function Main()
{
	
	start_std_clock();
	start_lcl_clock();
}

function WinOpen() 
   {
   //alert('\nPage will load to full screen.\n\nUse View/Document Source from menu bar to view source.\n\nClose new window to return to this page. ');
   var mywin = window.open("ClockResults.shtm","CalculationWindow","menubar=yes,scrollbars=yes");  //location=yes,status=yes
	//mywin.document.frmMain.txtStdTime.value = "HelloWorld"
   }
/* checks the type of browser */
/* returns the DST offset if needed */
function check_browser_env() 
{
	// check the type of browser
	if (navigator.appName == "Microsoft") {
		return 0 }
	else if (navigator.appName == "Netscape") {
		return 1 }
	else	{
		return 0 }
}

//cease hiding-->
</script>
<script language="JavaScript">
<!-- begin
function stop() {
	clearTimeout(lclID);
	clearTimeout(stdID); 
}

function start_std_clock() {
// variables declaration
	//var dt=new Date();
	var dt = dateStrg_to_Date(document.frmCntl.txtStdGMTTime.value);	/* convert string to a date */
	dt.setTime(dt.getTime() + (ticks * 1000));
	ticks++;
	
	var mm,dd,yy,h,m,s;
	var date="  ",time="      ";

	// find out date(mm,dd,yy) and time(h,m,s)
	mm=dt.getMonth();
	dd=dt.getDate();
	yy=dt.getYear();
	if (yy<10) {var yr= "0" + yy}
	h=dt.getHours();
	if (h<10) {h= "0" + h}
	m=dt.getMinutes();
	if (m<10) {m= "0" + m}
	s=dt.getSeconds();
	if (s<10) {s= "0" + s}

	// show it separated
//	document.frmStdTime.month.value=mm;
	document.frmStdTime.day.value=dd;
//	document.frmStdTime.year.value=yr;
	document.frmStdTime.hours.value=h;
	document.frmStdTime.minutes.value=m;
	document.frmStdTime.seconds.value=s;

	// show it together
	if(mm==1) date+="January";
	if(mm==2) date+="February";
	if(mm==3) date+="March";
	if(mm==4) date+="April";
	if(mm==5) date+="May";
	if(mm==6) date+="June";
	if(mm==7) date+="July";
	if(mm==8) date+="August";
	if(mm==9) date+="September";
	if(mm==10) date+="October";
	if(mm==11) date+="November";
	if(mm==12) date+="December";
	date+=" "+dd+", "+(2000+yy);
	time+=h+":"+m+":"+s;
//	document.frmStdTime.date.value=date;
	document.frmStdTime.time.value=time;
	// run again in 999 ms
	stdID=setTimeout("start_std_clock()",999); 
}

/********* run LOCAL clock */
function start_lcl_clock() {
// variables declaration
	var dt=new Date();
	
	dt = dateStrg_to_Date(dt.toGMTString());	/* convert string to a date */
	//dt.setTime(dt.getTime() + (ticks * 1000));
	/*ticks++; */			/* handled in std clock */

	var mm,dd,yy,h,m,s;
	var date="  ",time="      ";
// find out date(mm,dd,yy) and time(h,m,s)
	mm=dt.getMonth();
	dd=dt.getDate();
	yy=dt.getYear();
	if (yy<10) {var yr= "0" + yy}
	h=dt.getHours() + nDSToffset;		/* +1 DAYLIGHT SAVINGS TIME?*/
	if (h<10) {h= "0" + h}
	m=dt.getMinutes();
	if (m<10) {m= "0" + m}
	s=dt.getSeconds();
	if (s<10) {s= "0" + s}
// show it separated
//	document.frmLclTime.month.value=mm;
	document.frmLclTime.day.value=dd;
//	document.frmLclTime.year.value=yr;
	document.frmLclTime.hours.value=h;
	document.frmLclTime.minutes.value=m;
	document.frmLclTime.seconds.value=s;
// show it together
	if(mm==1) date+="January";
	if(mm==2) date+="February";
	if(mm==3) date+="March";
	if(mm==4) date+="April";
	if(mm==5) date+="May";
	if(mm==6) date+="June";
	if(mm==7) date+="July";
	if(mm==8) date+="August";
	if(mm==9) date+="September";
	if(mm==10) date+="October";
	if(mm==11) date+="November";
	if(mm==12) date+="December";
	date+=" "+dd+", "+(2000+yy);
	time+=h+":"+m+":"+s;
//	document.frmLclTime.date.value=date;
	document.frmLclTime.time.value=time;
// run again in 999 ms
	lclID=setTimeout("start_lcl_clock()",999); 
}

/* this converts the GMT date string to a date and returns the date */
function dateStrg_to_Date(sGMTtime)
{
	/* Expected Time String: "Tue, 26 May 1998 04:50:37 UTC"   (29 char)*/
	/* Expected Time String: "01234567890123456789012345678  */
	/* or 			 "Mon, 1 Jun 1998 18:47:32 UTC"   (28 char)*/
	/* or 			 "Mon, 17 Jun 1998 18:47:32"   (25 char)*/
	/* or 			 "Mon, 1 Jun 1998 18:47:32"   (24 char)*/
	
	var nLen = sGMTtime.length
	
	/* parse the GMT date */
	if (nLen == 28 || nLen == 24)  {
		/* parse the GMT date */
		var theDay = sGMTtime.substring(4,6)
		var theYear = sGMTtime.substring(13,15)
		var theMonth = sGMTtime.substring(7,10)	
		//alert("Month:_" + theMonth + "_ Year:_" + theYear + "_ Time String:_" + sGMTtime + "_" + " Len:" + sGMTtime.length)
	}
	else if (nLen == 29 || nLen == 25) {
		/* parse the GMT date */
		var theDay = sGMTtime.substring(5,7)
		var theYear = sGMTtime.substring(14,16)
		var theMonth = sGMTtime.substring(8,11)
		//alert("Month:_" + theMonth + "_ Year:_" + theYear + "_ Time String:_" + sGMTtime + "_" + " Len:" + sGMTtime.length)
	}
	
	if (theMonth == "Jan" ) {
		theMonth = 1 }
	else if ( theMonth == "Feb" ) {
		theMonth = 2 }
	else if ( theMonth == "Mar" ) {
		theMonth = 3 }
	else if ( theMonth == "Apr" ) {
		theMonth = 4 }
	else if ( theMonth == "May" ) {
		theMonth = "05" }
	else if ( theMonth == "Jun" ) {
		theMonth = 6 }
	else if ( theMonth == "Jul" ) {
		theMonth = 7 }
	else if ( theMonth == "Aug" ) {
		theMonth = 8 }
	else if ( theMonth == "Sep" ) {
		theMonth = 9 }
	else if ( theMonth == "Oct" ) {
		theMonth = 10 }
	else if ( theMonth == "Nov" ) {
		theMonth = 11 }
	else if ( theMonth == "Dec" ) {
		theMonth = 12 }

	if (nDBG > 1) {alert ("Y/M/D:" + theYear + theMonth + theDay)}

	/* get the time */
	if (nLen == 28 || nLen == 24)  {
		sGMTtime=sGMTtime.substring(16,24);
	}
	else {
		sGMTtime=sGMTtime.substring(17,25);
	}
	var theHours=sGMTtime.substring(0,2);

	if(theHours.substring(1,2)==":") {
		theHours = theHours.substring(0,1);
		var theMins = sGMTtime.substring(2,4);
	   var theSecs = sGMTtime.substring(5,7);
	}
	else {
		var theMins = sGMTtime.substring(3,5);
		var theSecs = sGMTtime.substring(6,8);
	}

	//alert("Hours are:_" + theHours + "_" + "Minutes are:_" + theMins + "_" + "Seconds are:_" + theSecs + "_")}
		
	if (nDBG > 0) {alert("strg_to_Date Args:" + theYear + ", " + theMonth + ", " + theDay + ", " + theHours + ", " + theMins + ", " + theSecs)}

	var newDate = new Date(theYear, theMonth, theDay, theHours, theMins, theSecs);
	//var fresh = "December 17, 1999 23:22:49"
	//var newDate = new Date(fresh);
	//alert("year: " + newDate.getYear());
	//alert("month:" + newDate.getMonth());
	//alert("hours:" + newDate.getHours());

	return newDate 
	
}


// end -->
</script>
</head>

<body TEXT="0000FF" onload="Main()" onunload="stop()">

<p align="left" style="border: medium solid"><big><strong>Local System Clock (GMT)</strong></big></p>

<form name="frmLclTime">
  <table border="3" cellpading="3" cellspacing="4" width="563" height="115">
    <tr>
      <th colspan="3" width="256" height="17"></th>
      <th colspan="3" width="268" height="17">Time</th>
    </tr>
    <tr align="center">
      <td colspan="3" width="256" height="24" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><strong><input type="text" name="date" size="20" style="font-family: sans-serif, serif; font-size: 12pt"></strong></td>
      <td colspan="3" width="268" height="24" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><strong><input type="text" name="time" size="20" style="font-family: sans-serif, serif; font-size: 12pt"></strong></td>
    </tr>
    <tr>
      <td width="81" height="19"></td>
      <td width="80" height="19"></td>
      <td width="79" height="19"></td>
      <td width="73" height="19"></td>
      <td width="79" height="19"></td>
      <td width="100" height="19"></td>
    </tr>
    <tr align="center">
      <td width="81" height="19"></td>
      <td width="80" height="19">Day</td>
      <td width="79" height="19"></td>
      <td width="73" height="19">Hours</td>
      <td width="79" height="19">Minutes</td>
      <td width="100" height="19">Seconds</td>
    </tr>
    <tr align="center">
      <td width="81" height="23" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><input type="text" name="month" size="4"></td>
      <td width="80" height="23" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><input type="text" name="day" size="4"></td>
      <td width="79" height="23" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><input type="text" name="year" size="4"></td>
      <td width="73" height="23" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><input type="text" name="hours" size="4" style="font-family: sans-serif, serif; font-size: 12pt"></td>
      <td width="79" height="23" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><input type="text" name="minutes" size="4" style="font-family: sans-serif, serif; font-size: 12pt"></td>
      <td width="100" height="23" style="font-family: sans-serif; font-size: larger; color: rgb(0,128,0)"><input type="text" name="seconds" size="4" style="font-family: sans-serif, serif; font-size: 12pt"></td>
    </tr>
  </table>
</form>

<p><br>
</p>

<p align="left" style="border: medium solid"><big><strong>Standard Time (GMT)</strong></big></p>

<form name="frmStdTime">
  <table border="3" cellpading="3" cellspacing="4" width="563" height="115">
    <tr>
      <th colspan="3" width="256" height="17"></th>
      <th colspan="3" width="268" height="17">Time</th>
    </tr>
    <tr align="center">
      <td colspan="3" width="256" height="24"><input type="text" name="date" size="20" style="font-family: sans-serif, serif; font-size: 12pt"></td>
      <td colspan="3" width="268" height="24"><input type="text" name="time" size="20" style="font-family: sans-serif, serif; font-size: 12pt"></td>
    </tr>
    <tr>
      <td width="81" height="19"></td>
      <td width="80" height="19"></td>
      <td width="79" height="19"></td>
      <td width="73" height="19"></td>
      <td width="79" height="19"></td>
      <td width="100" height="19"></td>
    </tr>
    <tr align="center">
      <td width="81" height="19"></td>
      <td width="80" height="19">Day</td>
      <td width="79" height="19"></td>
      <td width="73" height="19">Hours</td>
      <td width="79" height="19">Minutes</td>
      <td width="100" height="19">Seconds</td>
    </tr>
    <tr align="center">
      <td width="81" height="23"><input type="text" name="month" size="4"></td>
      <td width="80" height="23"><input type="text" name="day" size="4"></td>
      <td width="79" height="23"><input type="text" name="year" size="4"></td>
      <td width="73" height="23"><input type="text" name="hours" size="4" style="font-family: sans-serif, serif; font-size: 12pt"></td>
      <td width="79" height="23"><input type="text" name="minutes" size="4" style="font-family: sans-serif, serif; font-size: 12pt"></td>
      <td width="100" height="23"><input type="text" name="seconds" size="4" style="font-family: sans-serif, serif; font-size: 12pt"></td>
    </tr>
  </table>
</form>

<p><a href="ClockResults.shtm"><strong>Calculate Results</strong></a></p>
<p><a href="SetTime.shtm"><strong>Set your Clock!</strong></a></p>

<p><!--webbot bot="HTMLMarkup" StartSpan -->
<!--#config timefmt="%a, %d %h %Y %T" -->
<form name="frmCntl">
  <input type="hidden" name="txtStdGMTTime" value="<!--#echo var="DATE_GMT" -->" size=30>
  <input type="hidden" name="txtLclGMTTime" size=30><div><p>
	<!-- <input type="button"name="Button1" value="Calculate Results" onclick="WinOpen()"> -->
	<input type="button" name="cmdClose"  value="Close Window" onclick="self.close()"></p>
  </div>
</form>
<!--webbot BOT="HTMLMarkup" endspan --></p>

<p align="center">&nbsp;</p>
<!--webbot bot="Include" U-Include="../_private/navbar.htm" TAG="BODY" startspan --><strong>[_private/navbar.htm]</strong><!--webbot bot="Include" endspan i-checksum="39368" -->

</body>
</html>
