function initArray()
  {
        for (i=0; i<initArray.arguments.length;i++)
        {
                this[i]=initArray.arguments[i];
        }
  }
  function WorldClock()
  {
        now  = new Date();
        ofst = now.getTimezoneOffset()/60;
        secs = IfZero(now.getSeconds());
        mins = IfZero(now.getMinutes());
        gmt  = (now.getHours() + ofst);
        now.setHours(now.getHours() + ofst + 12);
        hr   = IfHour24(((gmt + 12) > 24) ? ((gmt + 12) - 24) : (gmt + 12));
        if (hr < 0) hr+=24;
        if (hr > 23) hr-=24;
        ampm = (hr > 11)?"PM":"AM";
        statusampm = ampm.toLowerCase();
        hr2 = hr;//+1;
        if (hr2 == 0) hr2=12;
        (hr2 < 13)?hr2:hr2 %= 12;
        //Day light saving =================
        if (now.getMonth()+1 < 9)
        {
           hr2 = hr2 + 1;
        }
        else
        {
                //Day light saving start on the last sunday in september
                if (now.getMonth()+1 == 9)
                {
                        var thismonth = new Date();
                        thismonth.setDate(31-thismonth.getDay()); // last Sunday
                        if (thismonth.getDay() === now.getDay())
                        {
                                if (hr >= 2 && ampm == "AM")
                                {
                                        hr2 = hr2 + 1;
                                }
                        }
                        else
                        {
                                if (thismonth.getDay() > now.getDay())
                                {
                                        hr2 = hr2 + 1;
                                }
                        }
                }
        }
        //End of day light saving =================
        if (hr2<10) hr2="0"+hr2
        //Date and time variables
        var ArrayDays = new initArray("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
        var ArrayMonths = new initArray("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
        var dayname = ArrayDays[now.getDay()];
        var day         = now.getDate();
        var month       = ArrayMonths[now.getMonth()];
        var year        = now.getFullYear() % 1000;
        if (year < 10)
                year = "0" + year;
        var today = dayname + " " + day + "/" + month + "/" + year;
        var finaltime=hr2+':'+mins+':'+secs+ " " + statusampm ;
        document.theClock.theTime.value = today + " " + finaltime;
        setTimeout('WorldClock()',1000);
  }
  function IfZero(num)
  {
        return ((num <= 9) ? ("0" + num) : num);
  }
  function IfHour24(hour)
  {
        return (hour >= 24) ? hour - 24 : hour;
  }
  function submitform()
  {
    document.theClock.submit();
  }
  window.onload=WorldClock