// CREDITS:
// Dynamic world time ticker for your titlebar
// By Urs Dudli and Peter Gehrig
// Copyright (c) 2001 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com
// info@24fun.com
// 5/8/2001

// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// http://www.24fun.com on the webpage
// where this script will be featured

// CONFIGURATION:
// Go to http://www.24fun.com, open category 'date' and download the script

var hours
var shifthours
var minutes
var seconds
var localhours
var pause=2000
var thisplace
var i_worldtime=0
var timer

var worldtime = new Array()

worldtime[0]="Azores,-1"
worldtime[1]="Baghdad,4"
worldtime[2]="Berlin,2"
worldtime[3]="Buenos Aires,-3"
worldtime[4]="Chicago,-5"
worldtime[5]="Denver,-6"
worldtime[6]="Hong Kong,8"
worldtime[7]="Honolulu,-10"
worldtime[8]="Johannesburg,2"
worldtime[9]="Kairo,3"
worldtime[10]="Lima,-5"
worldtime[11]="London,1"
worldtime[12]="Los Angeles,-7"
worldtime[13]="Mexico City,-5"
worldtime[14]="Moscow,4"
worldtime[15]="New York,-4"
worldtime[16]="Paris,2"
worldtime[17]="Perth,8"
worldtime[18]="Sao Paulo,-3"
worldtime[19]="Sydney,10"
worldtime[20]="Tokyo,9"

function showtime() {
//if (document.all) {
if (document.getElementById){
        thisplace=worldtime[i_worldtime].split(",")
        thistime= new Date()
        hours=thistime.getUTCHours()
        hours=eval(hours)
        shifthours=eval(thisplace[1])
        localhours=eval(shifthours+hours)
        if (localhours <0) {localhours=24+localhours}
        if (localhours >=24) {localhours=localhours-24}

        minutes=thistime.getUTCMinutes()
        seconds=thistime.getUTCSeconds()

        if (thisplace[0]=='Delhi') {
                minutes=eval(minutes+30)
                if (minutes>=60) {
                        minutes=eval(minutes-60)
                        localhours=eval(localhours+1)
                }
        }
        if (eval(minutes) < 10) {minutes="0"+minutes}
        if (eval(seconds) < 10) {seconds="0"+seconds}
        if (eval(localhours) < 10) {localhours="0"+localhours}
        thistime = localhours+":"+minutes+":"+seconds
        document.title=" ------ "+thistime+" --- >>> "+thisplace[0]+" <<< ---------------------------------"
        i_worldtime++
        if (i_worldtime>=worldtime.length) {
                i_worldtime=0
        }

        timer =setTimeout("showtime()",pause)
        }
}

//if (document.all) {
//        window.onload=showtime
//}