function SetInitialDate() {
	var time=new Date()
	var x=time
	var hs=x.getHours();  (hs<10) ? hs="0"+hs : hs
	var ms=x.getMinutes();(ms<10) ? ms="0"+ms : ms
	var ampm = 0;	// 0 = AM, 1 = PM
	// Hours into 12 hour time:
	(hs > 12) ? ampm = 1 : ampm = 0;
	(hs > 12) ? hs = hs - 12 : hs = hs;
	var f = eval("document.forms['CForm']");
	f.hour.value = hs;
	f.min.value = ms;
	f.ampm.options[ampm].selected = true;
	
	UpTime(document.CForm.FObj.options[document.CForm.FObj.selectedIndex].value, document.CForm.ZObj.options[document.CForm.ZObj.selectedIndex].value, document.CForm.chkLSav.checked, document.CForm.chkRSav.checked, false);
}

  function UpTime(raw_from, raw_to, local_ds, remote_ds, new_event)
  {
    from_mins = 0;
    from_hrs = giveInt(raw_from, 1);
    if ((raw_from - from_hrs) != 0) {
      from_mins = 30; }
    if (local_ds == true) { from_hrs = from_hrs + 1; }
    to_mins = 0;
    to_hrs = giveInt(raw_to, 1);
    if ((raw_to - to_hrs) != 0) {
      to_mins = 30; }
    if (remote_ds == true) { to_hrs = to_hrs + 1; }

	TickTock(from_hrs, from_mins, to_hrs, to_mins, remote_ds, new_event);
//    document.CForm.AreaTime.value = TickTock(from_hrs, from_mins, to_hrs, to_mins, remote_ds, new_event);  
}

  function TickTock(from_hrs, from_mins, to_hrs, to_mins, remote_ds, new_event)
  {

//    today = new Date();

    modzonemins = to_mins - from_mins;
    modzonehrs = to_hrs - from_hrs;

//    hrs = today.getHours();
//    mins = today.getMinutes();

	var f = eval("document.forms['CForm']");
	hrs = f.hour.value;
	mins = f.min.value;

	// Error checking:
	if ((hrs < 1) || (hrs > 12) || isNaN(parseInt(hrs))) {
		f.hour.value = 12;
		hrs = 12;
	}

	if ((mins < 0) || (mins > 59) || isNaN(parseInt(mins))) {
		f.min.value = 0;
		mins = 0;
	}

	ampm = f.ampm.options[f.ampm.options.selectedIndex].value;
	hrs = parseInt(hrs) + ((ampm == 0) ? 0 : 12);
	if ((hrs == 24) && (ampm == 1)) hrs = 12;
	if ((hrs == 12) && (ampm == 0)) hrs = 0;
	hrs *= 1;
	mins *= 1;

//	alert("h: " + hrs + ", m: " + mins);
 
    mins += modzonemins;
    if (mins > 60) {
      mins = 60 - mins; 
      hrs++; }
    if (mins < 0) {
      mins += 60; 
      hrs--; }

    hrs = hrs + modzonehrs;

    if (hrs > 23) {
      hrs -= 24; }
    if (hrs < 0) {
      hrs += 24; }

    strTimeDisp = '';
    if (hrs < 10) {
      strTimeDisp += '0'; }
    strTimeDisp += hrs + ':';
    if (mins < 10) {
      strTimeDisp += '0'; }
    strTimeDisp += mins;

    strTimeDisp += ' (GMT ';
    if (to_hrs >= 0) {
      strTimeDisp += '+'; }
    strTimeDisp += to_hrs + ':';
    if (to_mins < 10) {
      strTimeDisp += '0'; }
    strTimeDisp += to_mins + ')';

	hrs2 = (hrs > 12) ? (hrs - 12) : hrs;
	if (hrs2 == 0) hrs2 = 12;
	
	f.hour2.value = hrs2;
	f.min2.value = (mins < 10) ? ("0" + parseInt(mins)) : mins;
	f.ampm2.value = (hrs >= 12) ? "PM" : "AM";

/*
    if (new_event == true)
    {
      msecs = today.getSeconds() * 1000;
      msecs = 62000 - msecs;
      window.setTimeout("document.CForm.AreaTime.value = TickTock(from_hrs, from_mins, to_hrs, to_mins, remote_ds, true);", msecs);
    }
*/
    return strTimeDisp;
  }

  function giveInt(x, divby) {
    newx = x / divby;
    tempx = Math.round(newx);
    if (x - divby * tempx < 0 && x >= 0 || x - divby * tempx > 0 && x <= 0) {
      tempx--; }
    return tempx;
  }