var tzinfo=new Array(
"10000|-12:00) "+GetElmCont("tz_1","International Date Line West")+"|GMT12",
"11000|-11:00) "+GetElmCont("tz_2","Midway Island, Samoa")+"|GMT11",
"12000|-10:00) "+GetElmCont("tz_3","Hawaii")+"|GMT10",
"13000|-09:00) "+GetElmCont("tz_4","Alaska")+"|GMT9",
"14000|-08:00) "+GetElmCont("tz_5","Pacific Time (US & Canada)")+"|GMT8",
"14001|-08:00) "+GetElmCont("tz_6","Tijuana")+"|GMT8",
"15000|-07:00) "+GetElmCont("tz_7","Arizona")+"|GMT7",
"15001|-07:00) "+GetElmCont("tz_8","Chihuahua, La Paz, Mazatlan")+"|GMT7",
"15002|-07:00) "+GetElmCont("tz_9","Mountain Time (US & Canada)")+"|GMT7",
"16000|-06:00) "+GetElmCont("tz_10","Central America")+"|GMT6",
"16001|-06:00) "+GetElmCont("tz_11","Central Time (US & Canada)")+"|GMT6",
"16002|-06:00) "+GetElmCont("tz_12","Guadalajara, Mexico City, Monterrey")+"|GMT6",
"16003|-06:00) "+GetElmCont("tz_13","Saskatchewan")+"|GMT6",
"17000|-05:00) "+GetElmCont("tz_14","Bogota, Lima, Quito")+"|GMT5",
"17001|-05:00) "+GetElmCont("tz_15","Eastern Time (US & Canada)")+"|GMT5",
"17002|-05:00) "+GetElmCont("tz_16","Indiana (East)")+"|GMT5",
"18000|-04:00) "+GetElmCont("tz_17","Atlantic Time (Canada)")+"|GMT4",
"18001|-04:00) "+GetElmCont("tz_18","Caracas, La Paz")+"|GMT4",
"18002|-04:00) "+GetElmCont("tz_19","Santiago")+"|GMT4",
"18500|-03:30) "+GetElmCont("tz_20","Newfoundland")+"|GMT3:30",
"19000|-03:00) "+GetElmCont("tz_21","Brasilia")+"|GMT3",
"19001|-03:00) "+GetElmCont("tz_22","Buenos Aires, Georgetown")+"|GMT3",
"19002|-03:00) "+GetElmCont("tz_23","Greenland")+"|GMT3",
"20000|-02:00) "+GetElmCont("tz_24","Mid-Atlantic")+"|GMT2",
"21000|-01:00) "+GetElmCont("tz_25","Azores")+"|GMT1",
"21001|-01:00) "+GetElmCont("tz_26","Cape Verde Is.")+"|GMT1",
"22000|+00:00) "+GetElmCont("tz_27","Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London")+"|GMT-0",
"22001|+00:00) "+GetElmCont("tz_28","Casablanca, Monrovia")+"|GMT-0",
"23000|+01:00) "+GetElmCont("tz_29","Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna")+"|GMT-1",
"23001|+01:00) "+GetElmCont("tz_30","Belgrade, Bratislava, Budapest, Ljubljana, Prague")+"|GMT-1",
"23002|+01:00) "+GetElmCont("tz_31","Brussels, Copenhagen, Madrid, Paris")+"|GMT-1",
"23003|+01:00) "+GetElmCont("tz_32","Sarajevo, Skopje, Warsaw, Zagreb")+"|GMT-1",
"23004|+01:00) "+GetElmCont("tz_33","West Central Africa")+"|GMT-1",
"24000|+02:00) "+GetElmCont("tz_34","Athens, Beirut, Istanbul, Minsk")+"|GMT-2",
"24001|+02:00) "+GetElmCont("tz_35","Bucharest")+"|GMT-2",
"24002|+02:00) "+GetElmCont("tz_36","Cairo")+"|GMT-2",
"24003|+02:00) "+GetElmCont("tz_37","Harare, Pretoria")+"|GMT-2",
"24004|+02:00) "+GetElmCont("tz_38","Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius")+"|GMT-2",
"24005|+02:00) "+GetElmCont("tz_39","Jerusalem (2007 only)")+"|GMT-2",
"25000|+03:00) "+GetElmCont("tz_40","Baghdad")+"|GMT-3",
"25001|+03:00) "+GetElmCont("tz_41","Kuwait, Riyadh")+"|GMT-3",
"25003|+03:00) "+GetElmCont("tz_43","Nairobi")+"|GMT-3",
"25500|+03:30) "+GetElmCont("tz_44","Tehran")+"|GMT-3:30",
"25002|+04:00) "+GetElmCont("tz_42","Moscow, St. Petersburg, Volgograd")+"|GMT-4",
"26000|+04:00) "+GetElmCont("tz_45","Abu Dhabi, Muscat")+"|GMT-4",
"26001|+04:00) "+GetElmCont("tz_46","Baku")+"|GMT-4",
"26002|+04:00) "+GetElmCont("tz_47","Tbilisi")+"|GMT-4",
"26003|+04:00) "+GetElmCont("tz_48","Yerevan")+"|GMT-4",
"26500|+04:30) "+GetElmCont("tz_49","Kabul")+"|GMT-4:30",
"27001|+05:00) "+GetElmCont("tz_51","Islamabad, Karachi, Tashkent")+"|GMT-5",
"27500|+05:30) "+GetElmCont("tz_52","Chennai, Kolkata, Mumbai, New Delhi")+"|GMT-5:30",
"27700|+05:45) "+GetElmCont("tz_53","Kathmandu")+"|GMT-5:45",
"27000|+06:00) "+GetElmCont("tz_50","Ekaterinburg")+"|GMT-6",
"28001|+06:00) "+GetElmCont("tz_55","Astana, Dhaka")+"|GMT-6",
"28002|+06:00) "+GetElmCont("tz_56","Sri Jayawardenepura")+"|GMT-6",
"28500|+06:30) "+GetElmCont("tz_57","Rangoon")+"|GMT-6:30",
"28000|+07:00) "+GetElmCont("tz_54","Almaty, Novosibirsk")+"|GMT-7",
"29000|+07:00) "+GetElmCont("tz_58","Bangkok, Hanoi, Jakarta")+"|GMT-7",
"30004|+08:00) "+GetElmCont("tz_64","Taipei")+"|GMT-8",
"29001|+08:00) "+GetElmCont("tz_59","Krasnoyarsk")+"|GMT-8",
"30000|+08:00) "+GetElmCont("tz_60","Beijing, Chongqing, Hong Kong, Urumqi")+"|GMT-8",
"30002|+08:00) "+GetElmCont("tz_62","Kuala Lumpur, Singapore")+"|GMT-8",
"30003|+08:00) "+GetElmCont("tz_63","Perth, Western Australia")+"|GMT-8",
"30005|+08:00) "+GetElmCont("tz_65","Ulaan Bataar")+"|GMT-8",
"31000|+09:00) "+GetElmCont("tz_66","Osaka, Sapporo, Tokyo")+"|GMT-9",
"31001|+09:00) "+GetElmCont("tz_67","Seoul")+"|GMT-9",
"30001|+09:00) "+GetElmCont("tz_61","Irkutsk")+"|GMT-9",
"31500|+09:30) "+GetElmCont("tz_69","Adelaide")+"|GMT-9:30",
"31501|+09:30) "+GetElmCont("tz_70","Darwin")+"|GMT-9:30",
"31002|+10:00) "+GetElmCont("tz_68","Yakutsk")+"|GMT-10",
"32000|+10:00) "+GetElmCont("tz_71","Brisbane")+"|GMT-10",
"32001|+10:00) "+GetElmCont("tz_72","Canberra, Melbourne, Sydney")+"|GMT-10",
"32002|+10:00) "+GetElmCont("tz_73","Guam, Port Moresby")+"|GMT-10",
"32003|+10:00) "+GetElmCont("tz_74","Hobart")+"|GMT-10",
"32004|+11:00) "+GetElmCont("tz_75","Vladivostok")+"|GMT-11",
"33000|+12:00) "+GetElmCont("tz_76","Magadan, Solomon Is., New Caledonia")+"|GMT-12",
"34000|+12:00) "+GetElmCont("tz_77","Auckland, Wellington")+"|GMT-12",
"34001|+12:00) "+GetElmCont("tz_78","Fiji, Kamchatka, Marshall Is.")+"|GMT-12",
"35000|+13:00) "+GetElmCont("tz_79","Nuku'alofa")+"|GMT-13",
"1|"+GetElmCont("tz_80","* Configure time zone offset manually...")+"|"
)
function getTimeZoneOffsetHour(ms) { // get time zone offset (unit: hour)
return -1 * new Date(ms).getTimezoneOffset() / 60;
}
function hasSwitch(ms1, ms2) {
return getTimeZoneOffsetHour(ms1) !== getTimeZoneOffsetHour(ms2);
}
var p = 1000; // desired precision in ms, we want the actual second
function findSwitch(a, b) { // finds the UTC offset change in time span a..b by using binary search
var m;
if (b-a <= p) return { from: new Date(a), to: new Date(b) }; // => return object
m = a + Math.floor((b-a)/(2*p))*p; // get the middle date, rounded to precision
return hasSwitch(m, b) ? findSwitch(m, b) : findSwitch(a, m); // next iteration
}
function getDaylightSaving(fullYear) { // get daylight saving start date and end date of user's PC
var Jun21 = Date.UTC(fullYear, 5, 21, 0);  // June 21st, 12am
var Dec21 = Date.UTC(fullYear, 11, 21, 0); // December 21st, 12am
if(!hasSwitch(Jun21,Dec21)) return null; // Daylight Savings is not observed in user's timezone.
lastDec21 = Date.UTC(fullYear-1, 11, 21, 0); // December 21st 12am (year before)
daylight_saving_switch1 = findSwitch(lastDec21, Jun21); // find the 1st DST transition
daylight_saving_switch2 = findSwitch(Jun21, Dec21); // find the 2nd DST transition
if(getTimeZoneOffsetHour(Jun21) > getTimeZoneOffsetHour(Dec21)) { // northern hemisphere
return {start: daylight_saving_switch1.from, end: daylight_saving_switch2.to};
}
else { // southern hemisphere
return {start: daylight_saving_switch2.from, end: daylight_saving_switch1.to};
}
}
function getRealTimeZoneOffset() { // get the timezone offset without daylight saving
var now = new Date();
var Jun21 = Date.UTC(now.getFullYear(), 5, 21, 0);  // June 21st, 12am
var Dec21 = Date.UTC(now.getFullYear(), 11, 21, 0); // December 21st, 12am
return Math.min(getTimeZoneOffsetHour(Jun21), getTimeZoneOffsetHour(Dec21));
}