﻿            function checkTime(t)
            {
            if (t<10)
              {
              t="0" + t;
              }
            return t;
            }

            function checkTwentyFour(tf)
            {
            if (tf >= 24)
            {
              tf = tf - 24;
            }

            if (tf < 00)
            {
             tf = tf + 24;
            }

            return tf;
            }


            function displayTime(timeDiff,timeZone)
            {
            var d = new Date();
            var txt;
            txt = checkTime(checkTwentyFour(d.getUTCHours()+timeDiff));
            txt = txt + ":";
            txt = txt + checkTime(d.getUTCMinutes());
            txt = txt + ":";
            txt = txt + checkTime(d.getUTCSeconds());
            txt = txt + " " + timeZone + "     ";
            return txt;
            }

            function displayTime_a(timeDiff,timeZone)
            {
            var d = new Date();
            var mins;
            mins=checkTime(d.getUTCMinutes()+30);
            if (mins >=60)
                {
                    timeDiff=timeDiff+1;
                    mins = mins -60;
                }
            var txt;
            txt = checkTime(checkTwentyFour(d.getUTCHours()+timeDiff));
            txt = txt + ":";
            txt = txt + mins;
            txt = txt + ":";
            txt = txt + checkTime(d.getUTCSeconds());
            txt = txt + " " + timeZone + "     ";
            return txt;
            }

            function clock()
            {
             var txtDump;
             txtDump = displayTime(-5,"Local");
             txtDump = txtDump + displayTime(0,"GMT");
			 txtDump = txtDump + displayTime(-10,"Hawaii");
			 txtDump = txtDump + displayTime(-8,"Pacific");
             txtDump = txtDump + displayTime(1,"Frankfurt");
             txtDump = txtDump + displayTime(3,"Baghdad");
             txtDump = txtDump + displayTime_a(4,"Afghanistan");
             txtDump = txtDump + displayTime(9,"Seoul / Tokyo");
             var divTimeZones= document.getElementById("time_zones");
             divTimeZones.innerText = txtDump;
             timersID = setTimeout('clock()',1000);
            }

