function mytime() {
var x=new Date();
h=x.getHours();
m=x.getMinutes();
// convert local to gmt time - does not work if time zone is one of those
// weird ones that's off by 1/2 hour
var def = x.getTimezoneOffset()/60; 
var gmt = (h + def); 
// convert to mountain time.  To convert to another time zone figure the
// difference between that time zone and gmt.
// hint: pacific time would be - 8; mtn = 7; central - 6; eastern - 5.
// add 1 for daylight savings time of year.
// for AZ and others which do not use daylight savings time, you'll need to
// account for that here
dst = checkTimeZone()
var mtn = gmt - 7 + dst;
if (mtn>24) mtn = mtn - 24;
if (mtn<=0) mtn = mtn + 24;
// convert from 24 hr to 12 hr clock
a="AM";
if(m<=9) m="0"+m;
if(mtn==12) a="PM";
if(mtn>12) 
	{
	if (mtn==24) 
		{
		mtn=12;
		a="AM";
		}
	else
		{
		mtn=mtn-12; 
		a="PM";
		}
	}
// format
if(mtn<=9) mtn="0"+mtn;
time=mtn+":"+m+" "+a;
document.rclock.rtime.value=time;
// setTimeout("mytime()",1000); 
}
function TZDemo(){
   var d, tz, s = "The current local time is ";
   d = new Date();
   tz = d.getTimezoneOffset();
   if (tz < 0)
      s += tz / 60 + " hours before GMT";
   else if (tz == 0)
      s += "GMT";
   else
      s += tz / 60 + " hours after GMT";
document.write(s);
   return;
}
function checkTimeZone() {
var rightNow = new Date();
var date1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
var date2 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
var temp = date1.toGMTString();
var date3 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var temp = date2.toGMTString();
var date4 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var hoursDiffStdTime = (date1 - date3) / (1000 * 60 * 60);
var hoursDiffDaylightTime = (date2 - date4) / (1000 * 60 * 60);
if (hoursDiffDaylightTime == hoursDiffStdTime) { 
// alert("Time zone is GMT " + hoursDiffStdTime + ".\nDaylight Saving Time is NOT observed here.");
return(0)
} else {
// alert("Time zone is GMT " + hoursDiffStdTime + ".\nDaylight Saving Time is observed here.");
return(1)
}
}


