function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}

function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getUTCHours ( );
  var currentMinutes = currentTime.getUTCMinutes ( );
  var currentSeconds = currentTime.getUTCSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  //var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  //currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  //currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  //var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
  var nycHours = currentHours - 4;
  if(nycHours < 0) {
  	nycHours = nycHours + 24;
  }
	  
  var nycTimeString = nycHours + ":" + currentMinutes + ":" + currentSeconds;
  
  var russiaHours = nycHours + 8;
  if(russiaHours>=24) {
  	russiaHours = russiaHours - 24;
  }
  
  russiaTimeString = russiaHours + ":" + currentMinutes + ":" + currentSeconds;
  

  // Update the time display
  document.getElementById("usaClock").firstChild.nodeValue = nycTimeString;
  document.getElementById("russiaClock").firstChild.nodeValue = russiaTimeString;
}
