// JavaScript Document - clock 22222 - YYYYMMDDHHMMSS

// JavaScript Document ---------- Clock jammmmmmmmmm.

function updateClock2 ( )
{
  var currentTime = new Date();
  
  var currentY = currentTime.getFullYear();
  var currentM = currentTime.getMonth()+1;
	if (currentM < 10)
	{
		currentM = "0" + currentM
	}

  var currentD = currentTime.getDate();
	if (currentD < 10)
	{
		currentD = "0" + currentD
	}
	
  var currentHours = currentTime.getHours ( );
	if (currentHours < 10)
	{
		currentHours = "0" + currentHours
	}  
  
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  var current_ms = currentTime.getMilliseconds()

  // 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 currentTimeString = currentY+""+currentM+""+currentD+""+currentHours + currentMinutes + currentSeconds;//+""+current_ms;// + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock2").firstChild.nodeValue = currentTimeString;
}

function init2() 
{
	updateClock ();
  	setInterval('updateClock()', 1000 ); 	
	updateClock2();
	setInterval('updateClock2()', 1000 );	
	cd();
}
window.onload = init2;

