// JavaScript Document


<!-- Paste this code into an external JavaScript file named: timeFormat.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Sandeep Gangadharan :: http://www.sivamdesign.com/scripts/ */

function formatTime() {
	var d = new Date();
// Create a new image in the DOM
//var i = document.createElement('img');
//var j = document.getElementById('goldchart');
//var k = document.createElement('nextimg');
var currentMinute;

// Assign our source to the new image. We are going to append a nonsense query string, based on the current timestamp, to our image URI, in order to keep it from getting cached

currentMinute = d.getHours() * 100 + d.getMinutes();
	
  now = new Date();
  hour = now.getHours();
  min = now.getMinutes();
  sec = now.getSeconds();
  
  d  = now.getDate();
  day = (d < 10) ? '0' + d : d;
  m = now.getMonth() + 1;
  month = (m < 10) ? '0' + m : m;
  yy = now.getYear();
  year = (yy < 1000) ? yy + 1900 : yy;
  

 /* if (document.clock.sivamtime[0].checked) {
    if (min <= 9) {
      min = "0" + min;
    }
    if (sec <= 9) {
      sec = "0" + sec;
    }
    if (hour > 12) {
      hour = hour - 12;
      add = " p.m.";
    } else {
      hour = hour;
      add = " a.m.";
    }
    if (hour == 12) {
      add = " p.m.";
    }
    if (hour == 00) {
      hour = "12";
    }

    document.clock.sivam.value = ((hour<=9) ? "0" + hour : hour) + ":" + min + ":" + sec + add;
  }
*/

//  if (document.clock.sivamtime[1].checked) {
    if (min <= 9) {
      min = "0" + min; }
    if (sec <= 9) {
      sec = "0" + sec; }
    if (hour < 10) {
      hour = "0" + hour; }
	// $('#timedisp').load(year + "/" + month + "/" + day + '    ' + hour + ':' + min + ':' + sec);
  document.clock.display.value = " " +  year + "/" + month + "/" + day + ', ' + hour + ':' + min + ':' + sec;
//  }

  t = setTimeout("formatTime()", 1000);
}

//window.onload=formatTime;

var t = setTimeout("formatTime()", 1000);
