

function format(value) {
   if (value < 10) {
      return "0" + value
   } else {
      return value
   }
}

function doTime() {
  months = new Array(12);
  months[0]  = "01";
  months[1]  = "02";
  months[2]  = "03";
  months[3]  = "04";
  months[4]  = "05";
  months[5]  = "06";
  months[6]  = "07";
  months[7]  = "08";
  months[8]  = "09";
  months[9]  = "10";
  months[10] = "11";
  months[11] = "12";

  days = new Array(7);

   	days[0] = "Sun";
  	days[1] = "Mon";
  	days[2] = "Tue";
  	days[3] = "Wed";
  	days[4] = "Thu";
  	days[5] = "Fri";
  	days[6] = "Sat";


  strLocalTime = "Your Time: ";
  strUTCTime = "UTC Time: ";

  local = new Date();
  tzOffset = local.getTimezoneOffset()/60;

//  browserVersion = navigator.appVersion;
//  browserVersion = browserVersion.substring(0, browserVersion.indexOf(" "));


//  if (browserVersion >= 3) {
	  //if the browser if netscape, add 1 hour to the offset (Bug in 4.05... any time it adjusts for Daylight Savings
	  //time or any country's adjustments, it adjusts *twice*... unfortunely, there is really no work around that
	  //works, since the timezones are stacked on top of each other, and only some in each group adjust their time.)
//	if((navigator.appName == "Netscape") && (browserVersion.indexOf("4.05") != -1)){
//	  tzOffset += 1;
//	}

//	  if (tzOffset < 0) {
//		tzOffset *= -1;
//	  }

	  localMonth = local.getMonth();
	  localDay = local.getDay();
	  localDate = local.getDate()
	  localYear = local.getYear();
	  localHour = local.getHours();
	  localMin = local.getMinutes();
	  localSec = local.getSeconds();

	  UTCDate = new Date(localYear, localMonth, localDate, localHour + (tzOffset/1), localMin + ((tzOffset%1)*60), localSec);


	  // does not care if it is true date or years since 1900.
	  if (localYear < 1900) {
		localYear = 1900 + localYear;
	  }
          // for some strange reason UTC date came out in netscape as 0-1800, so when you add 1900 to it it is only 100.  This is the
          // reason for the second check and addition of 1900
          UTCYear = UTCDate.getYear();
          if (UTCYear < 1900) {
                UTCYear = UTCYear+1900;
                if (UTCYear < 1900) {
                   UTCYear = UTCYear+1900;
     	           }

          }


	  //Your Time:  Mon, 08 Jun 1998 11:37:01
	  //strLocalTime = days[localDay] + ", " + format(localDate) + " " + months[localMonth] + " " + format(localYear) + " " + localHour + ":" + format(localMin) + ":" + format(localSec);
	  strLocalTime = months[localMonth] + "/" + format(localDate) + "/" + format(localYear) + " " + localHour + ":" + format(localMin) + ":" + format(localSec);
	  strUTCTime = days[UTCDate.getDay()] + ", " + format(UTCDate.getDate()) + " " + months[UTCDate.getMonth()] + " " + format(UTCYear) + " " + UTCDate.getHours() + ":" + format(UTCDate.getMinutes()) + ":" + format(UTCDate.getSeconds()) + " UTC";

	  //for netscape
	  if(navigator.appName == "Netscape"){
	  	strUTCTime = days[UTCDate.getDay() + 2] + ", " + format(UTCDate.getDate()) + " " + months[UTCDate.getMonth()] + " " + format(UTCYear) + " " + UTCDate.getHours() + ":" + format(UTCDate.getMinutes()) + ":" + format(UTCDate.getSeconds()) + " UTC";
	  	if(UTCDate.getDay() == 5){
	  		strUTCTime = days[0] + ", " + format(UTCDate.getDate()) + " " + months[UTCDate.getMonth()] + " " + format(UTCYear) + " " + UTCDate.getHours() + ":" + format(UTCDate.getMinutes()) + ":" + format(UTCDate.getSeconds()) + " UTC";
	  	}
	  	if(UTCDate.getDay() == 6){
	  		strUTCTime = days[1] + ", " + format(UTCDate.getDate()) + " " + months[UTCDate.getMonth()] + " " + format(UTCYear) + " " + UTCDate.getHours() + ":" + format(UTCDate.getMinutes()) + ":" + format(UTCDate.getSeconds()) + " UTC";
	  	}
	  }

  	  document.ship_form.timebox1.value = strLocalTime;



  	  setTimeout("doTime()", 1000)
}


function getCurrentTimeStamp() {
  local = new Date();
  tzOffset = local.getTimezoneOffset()/60;
  current = local.getYear() + "" + local.getMonth() + "" + local.getDay() + "" + local.getHours() + "" + local.getMinutes() + "" + local.getSeconds();

  return current;
}
