/* Whan I use IRC, I've always problems to know what's time in different city-country. So, I've been write this short prog in JavaScript. Local daylight saving time/summer time is unwarranted! I tested with Nestcape Navigator Gold 3.01 - Win95, Nestcape Communicator 4.01 - Win95, Nestcape Navigator 3.0 - Win3.x and MS Internet 3.02 - Win95 after update JScript VBScript V 2.0. I hope it'll help to any users! Feel free to modify or copy this Script for non-commercial use, but please leave this comment in the code and logo. If you find any bugs write, please, to: Adress: Jaroslav Stika Home:Zdiarska 1/5, 040 01 Kosice, Slovakia, phone: +421/095/742274 Work:bono Ltd, Hlavna 27,040 01 Kosice, Slovakia, phone: +421/095/760429 e-Mail: stika@bono.r-net.sk, home: http://www.bono.sk/jscripts/. Written: 22. April 1997 version 2 */ //variables var Separator=";" var Fields=6; var days=new Array() //create array for days days[0]="Sun"; days[1]="Mon"; days[2]="Tue"; days[3]="Wed"; days[4]="Thu"; days[5]="Fri"; days[6]="Sat"; var months=new Array() //create array for months months[0]="Jan"; months[1]="Feb"; months[2]="Mar"; months[3]="Apr"; months[4]="May"; months[5]="Jun"; months[6]="Jul"; months[7]="Aug"; months[8]="Sep"; months[9]="Oct"; months[10]="Nov"; months[11]="Dec"; var wts=new Array() //create array for cities, states, offsets, hours, minutes wts[1]="Abidjan;Cote d'Ivoire - CI;+;0;;" wts[2]="Abu Dhabi *;United Arab Emirates - AE;+;4;;" wts[3]="Adana;Turkey - TR;+;2;;" wts[4]="Addis Ababa *; Ethiopia - ET;+;3;;" wts[5]="Adelaide *;South Australia - Australia - AU;+;10;30;" wts[6]="Aden; South Yemen - YE;+;3;;" wts[7]="Aklavik;Yukon - Canada - CA;-;9;;" wts[8]="Aleutian;Aleutian Islands;-;10;;" wts[9]="Alexandria;Egypt - EG;+;2;;" wts[10]="Algiers *;Algeria - DZ;+;1;;" wts[11]="Amsterdam;Netherlands - NL;+;1;;" wts[12]="Anadyr; Russia - RU;+;13;;" wts[13]="Anchorage;Alaska - USA - US;-;9;;" wts[14]="Ankara;Turkey - TR;+;2;;" wts[15]="Antananarivo; Madagascar - MG;+;3;;" wts[16]="Antwerp;Belgium - BE;+;0;;" wts[17]="Asuncion *;Paraguay - PY;-;3;;" wts[18]="Athens;Greece - GR;+;2;;" wts[19]="Atlanta;Georgia - USA - US;-;5;;" wts[20]="Auckland *;New Zealand - NZ;-;13;;" wts[21]="Aveiro;Portugal - PT;+;0;;" wts[22]="Baghdad;Iraq - IQ;+;3;;" wts[23]="Bamako *;Mali - ML;+;0;;" wts[24]="Bandar Seri Begawan;Brunei - BN;+;8;;" wts[25]="Bangkok *;Thailand - TH;+;7;;" wts[26]="Bangui;Central African Republic - CF;+;1;;" wts[27]="Banjul *;Gambia - GM;+;1;;" wts[28]="Barcelona;Spain - ES;+;1;;" wts[29]="Barranquilla;Colombia - CO;-;5;;" wts[30]="Beijing *;China - CN;+;8;;" wts[31]="Beirut;Lebanon - LB;+;2;;" wts[32]="Belgrade;Serbia - YU;+;1;;" wts[33]="Belize City;Belize - BZ;-;5;;" wts[34]="Berlin;Germany - DE;+;1;;" wts[35]="Blantyre;Malawi - MW;+;2;;" wts[36]="Bogota *;Colombia - CO;-;5;;" wts[37]="Bologna;Italy - IT;+;2;;" wts[38]="Bombay - Mumbai *;India - IN;+;5;30;" wts[39]="Brasilia;Brazil - BR;-;3;;" wts[40]="Bratislava;Slovak Republic - SK;+;1;;" wts[41]="Brazzaville *;Congo - CG;+;1;;" wts[42]="Bridgetown *;Barbados - BB;-;4;;" wts[43]="Brisbane *;Queensland - Australia - AU;+;10;;" wts[44]="Brussels;Belgium - BE;+;1;;" wts[45]="Bucharest;Romania - RO;+;2;;" wts[46]="Budapest;Hungary - HU;+;1;;" wts[47]="Buenos Aires *;Argentina - AR;-;3;;" wts[48]="Bujumbura *;Burundi - BI;+;2;;" wts[49]="Cairo;Egypt - EG;+;2;;" wts[50]="Calcutta;India - IN;+;6;;" wts[51]="Calgary;Alberta - Canada - CA;-;7;;" wts[52]="Cali;Colombia - CO;+;0;;" wts[53]="Cape Town *;South Africa - ZA;+;2;;" wts[54]="Caracas *;Venezuela - VE;-;4;;" wts[55]="Cebu *;Philippines - PH;+;8;;" wts[56]="Chicago;Illinois - USA - US;-;6;;" wts[57]="Christchurch;New Zealand - NZ;+;12;;" wts[58]="Colombo *;Sri Lanka - LK;+;5;;" wts[59]="Conakry *;Guinea - GN;+;0;;" wts[60]="Copenhagen;Denmark - DK;+;1;;" wts[61]="Cotonou;Benin - BJ;+;0;;" wts[62]="Dakar *;Senegal - SN;+;0;;" wts[63]="Dallas;Texas - USA - US;-;6;;" wts[64]="Darwin;Northern Territory - Australia - AU;+;10;30;" wts[65]="Delhi;India - IN;+;5;30;" wts[66]="Detroit;Michigan - USA - US;-;5;;" wts[67]="Dhaka *;Bangladesh - BD;+;6;;" wts[68]="Djibouti *;Djibouti - DJ;+;3;;" wts[69]="Dover;Delaware - USA - US;-;5;;" wts[70]="Dubai;United Arab Emirates - AE;+;3;;" wts[71]="Dublin;Ireland - IE;+;0;;" wts[72]="Dusseldorf;Germany - DE;+;1;;" wts[73]="Edmonton;Alberta - USA - US;-;7;;" wts[74]="Fairbanks;Alaska - USA - US;-;9;;" wts[75]="Florence;Italy - IT;+;1;;" wts[76]="Fort de France *;Martinique - MQ;-;4;;" wts[77]="Frankfurt;Germany - DE;+;1;;" wts[78]="Freetown *;Sierra Leone - SL;+;0;;" wts[79]="Gaborone *;Botswana - BW;+;2;;" wts[80]="Geneva;Switzerland - CH;+;1;;" wts[81]="Gibraltar;Spain - ES;+;1;;" wts[82]="Glasgow;England - GB;+;0;;" wts[83]="GMT;GMT - ;+;0;;" wts[84]="Guatemala City;Guatemala - GT;-;6;;" wts[85]="Guayaquil;Ecuador - EC;-;5;;" wts[86]="Hamilton;Bermuda - GM;-;4;;" wts[87]="Harare *;Zimbabwe - ZW;+;2;;" wts[88]="Havana;Cuba - CU;-;5;;" wts[89]="Helsinki;Finland - FI;+;2;;" wts[90]="Hobart;Tasmania - Australia - AU;+;10;;" wts[91]="Hong Kong *;Hong Kong - HK;+;8;;" wts[92]="Honolulu *;Hawaii - US;-;10;;" wts[93]="Indianapolis *;Indiana - USA - US;-;5;;" wts[94]="Ipswich;Queensland - Australia - AU;+;10;;" wts[95]="Islamabad *;Pakistan - PK;+;5;;" wts[96]="Istanbul;Turkey - TR;+;2;;" wts[97]="Jakarta *;Indonesia - ID;+;7;;" wts[98]="Jerusalem;Israel - IL;+;2;;" wts[99]="Johannesburg;South Africa - ZA;+;2;;" wts[100]="Kabul *;Afghanistan - AF;+;4;30;" wts[101]="Kaduna;Nigeria - NG;+;0;;" wts[102]="Kahira;Egypt - EG;+;2;;" wts[103]="Kamchatka;Russia - RU;+;11;;" wts[104]="Kano;Nigeria - NG;+;1;;" wts[105]="Karachi;Pakistan - PK;+;5;;" wts[106]="Kathmandu *;Nepal - NP;+;5;45;" wts[107]="Kiev;Ukraine - UA;+;2;;" wts[108]="Kigali *;Rwanda - RW;+;2;;" wts[109]="Kingston *;Jamaica - JM;-;5;;" wts[110]="Kinshasa *;Zaire - ZR;+;1;;" wts[111]="Kobe;Japan - JP;+;9;;" wts[112]="KoŠice;Slovak Republic - SK;+;1;;" wts[113]="Kuala Lumpur *;Malaysia - MY;+;8;;" wts[114]="Kuwait City;Kuwait - KW;+;3;;" wts[115]="Kyoto;Japan - JP;+;9;;" wts[116]="La Paz;Bolivia - BO;-;5;;" wts[117]="Lagos *;Nigeria - NG;+;1;;" wts[118]="Libreville *;Gabon - GA;+;1;;" wts[119]="Lima *;Peru - PE;-;5;;" wts[120]="Limon;Costa Rica - CR;-;5;;" wts[121]="Lisbon;Portugal - PT;+;1;;" wts[122]="Lome *;Togo - TO;+;0;;" wts[123]="London;England - UK - GB;+;0;;" wts[124]="Los Angeles;California - USA - US;-;8;;" wts[125]="Lubumbashi;Zaire - ZR;+;1;;" wts[126]="Luxembourg;Luxembourg - LU;+;1;;" wts[127]="Madrid;Spain - ES;+;1;;" wts[128]="Manama *;Bahrain - BH;+;3;;" wts[129]="Manila;Philippines - PH;+;8;;" wts[130]="Maracaibo;Venezuela - VE;-;5;;" wts[131]="Maseru *;Lesotho - LS;+;2;;" wts[132]="Mayaguez;Puerto Rico - PR;-;4;;" wts[133]="Mbabane *;Swaziland - SZ;+;2;;" wts[134]="Medan;Indonesia - ID;+;8;;" wts[135]="Medellin;Colombia - CO;-;5;;" wts[136]="Melbourne *;Victoria - Australia - AU;+;10;;" wts[137]="Mexico City;Mexico - MX;-;6;;" wts[138]="Milan;Italy - IT;+;1;;" wts[139]="Mogadishu *;Somalia - SO;+;3;;" wts[140]="Mombasa;Kenya - KE;+;3;;" wts[141]="Monrovia *;Liberia - LR;+;0;;" wts[142]="Monte Carlo;Monaco - MC;+;1;;" wts[143]="Montevideo;Uruguay - UY;-;3;;" wts[144]="Montreal;Quebec - Canada - CA;-;5;;" wts[145]="Morgantown;West Virginia - USA - US;-;5;;" wts[146]="Moscow;Russia - RU;+;3;;" wts[147]="Mumbai - Bombay;India - IN;+;5;30;" wts[148]="Munich;Germany - DE;+;1;;" wts[149]="Murmansk;Rusia - RU;+;2;;" wts[150]="Muscat;Oman - OM;+;3;;" wts[151]="N'Djamena *;Chad - TD;+;1;;" wts[152]="Nagasaki;Japan - JP;+;9;;" wts[153]="Nagoya *;Japan - JP;+;9;;" wts[154]="Nairobi *;Kenia - KE;+;3;;" wts[155]="Naples;Italy - IT;+;1;;" wts[156]="Nassau *;Bahamas - BS;-;5;;" wts[157]="New Hebrides;New Hebrides - US;+;11;;" wts[158]="New York City;New York - USA - US;-;5;;" wts[159]="Newfoundland;Newfoundland - Canada - CA;-;3;;" wts[160]="Niamey *;Niger - NE;+;1;;" wts[161]="Nice;France - FR;+;1;;" wts[162]="Nicosia;Cyprus - CY;+;2;;" wts[163]="Nome;Alaska - USA - US;-;9;;" wts[164]="Nottingham;England - UK - GB;+;0;;" wts[165]="Nouakchott *;Mauritania - MR;+;0;;" wts[166]="Nuk;Greenland - GL;-;3;30;" wts[167]="Odessa;Ukraine - UA;+;3;;" wts[168]="Oran;Algeria - DZ;+;0;;" wts[169]="Osaka *;Japan - JP;+;9;;" wts[170]="Oslo;Norway - NO;+;1;;" wts[171]="Ottawa;Ontario - Canada - CA;-;5;;" wts[172]="Ouagadougou *;Burkina Faso - BF;+;0;;" wts[173]="Oulu;Finland - FI;+;2;;" wts[174]="Oxford;England - UK - GB;+;0;;" wts[175]="Palma;Mallorca - ES;+;1;;" wts[176]="Panjim;Goa - India - IN;+;5;30;" wts[177]="Paramaribo *;Suriname - SR;-;3;;" wts[178]="Paris;France - FR;+;1;;" wts[179]="Peking;China - CN;+;8;;" wts[180]="Perth *;Western Australia - Australia - AU;+;8;;" wts[181]="Phoenix *;Arizona - USA - US;-;7;;" wts[182]="Ponce;Puerto Rico - PR;-;4;;" wts[183]="Port Louis *;Mauritius - MU;+;4;;" wts[184]="Port Moresby *;Papua New Guinea - PG;+;10;;" wts[185]="Port of Spain;Trinidad and Tobago - TT;-;4;;" wts[186]="Prague;Czech Republic - CZ;+;1;;" wts[187]="Praia *;Cape Verde - CV;-;1;;" wts[188]="Puntarenas;Costa Rica - CR;-;5;;" wts[189]="Quebec;Quebec - Canada - CA;-;5;;" wts[190]="Quito *;Ecuador - EC;-;5;;" wts[191]="Rangoon *;Barma - ;+;6;30;" wts[192]="Reykjavik *;Iceland - IS;+;0;;" wts[193]="Riga;Latvia - LW;+;2;;" wts[194]="Rio de Janeiro;Brazil - BR;-;3;;" wts[195]="Riyadh *;Saudi Arabia - SA;+;3;;" wts[196]="Rome;Italy - IT;+;1;;" wts[197]="Saigon *;Vietnam - VN;+;7;;" wts[198]="Saint Petersburg - Leningrad;Russia - RU;+;3;;" wts[199]="Salt Lake City;Utah - USA - US;-;7;;" wts[200]="Salzburg;Austria - AU;+;1;;" wts[201]="San Francisco;California - USA - US;-;8;;" wts[202]="San Jose *;Costa Rica - CR;-;6;;" wts[203]="San Juan *;Puerto Rico - PR;-;4;;" wts[204]="Santa Cruz de Tenerife;Canarias Islands - ES;+;0;;" wts[205]="Santiago *;Chile - CL;-;3;;" wts[206]="Santo Domingo *;Dominican Republic - DO;-;4;;" wts[207]="Sao Paulo;Brazil - BR;-;3;;" wts[208]="Sapporo;Japan - JP;+;9;;" wts[209]="Sarajevo;Bosnia - BA;+;1;;" wts[210]="Seattle;Washington - USA - US;-;8;;" wts[211]="Seoul;South Korea - KR;+;9;;" wts[212]="Shanghai;China - CN;+;8;;" wts[213]="Singapore *;Singapore - SG;+;8;;" wts[214]="Sofia;Bulgaria - BG;+;2;;" wts[215]="Stockholm;Sweden - SE;+;1;;" wts[216]="Stuttgart;Germany - DE;+;1;;" wts[217]="Surabaya;Indonesia - ID;+;7;;" wts[218]="Suva *;Fiji Islands - FJ;+;12;;" wts[219]="Sydney *;New South Wales - Australia - AU;+;10;;" wts[220]="Taipei *;Thaiwan - TH;+;8;;" wts[221]="Tallinn;Estonia - EE;+;2;;" wts[222]="Tampere;Finland - FI;+;2;;" wts[223]="Tashkent *;Uzbekistan - UZ;+;5;;" wts[224]="Tegucigalpa;Honduras - HN;-;6;;" wts[225]="Tehran;Iran - IR;+;3;30;" wts[226]="Tel Aviv;Israel - IL;+;2;;" wts[227]="Tokyo *;Japan - JP;+;9;;" wts[228]="Toronto;Ontario - Canada - CA;-;5;;" wts[229]="Tripoli *;Libya - LY;+;2;;" wts[230]="Tunis;Tunisia - TN;+;1;;" wts[231]="Turin;Italy - IT;+;1;;" wts[232]="Ulan Bator;Mongolia - MN;+;8;;" wts[233]="Valletta;Malta - MT;+;1;;" wts[234]="Vancouver;British Columbia - Canada - CA;-;8;;" wts[235]="Vatican;Vatican City - VA;+;1;;" wts[236]="Venice;Italy - IT;+;1;;" wts[237]="Victoria Falls;Zimbabwe - ZW;+;2;;" wts[238]="Vienna;Austria - AT;+;1;;" wts[239]="Vientiane *;Laos - LA;+;7;;" wts[240]="Vladimir;Russia - RU;+;3;;" wts[241]="Vladivostok;Russia - RU;+;10;;" wts[242]="Warsaw;Poland - PL;+;1;;" wts[243]="Washington DC;Washington - USA - US;-;5;;" wts[244]="Wellington *;New Zealand - NZ;+;13;;" wts[245]="Winnipeg;Manitoba - Canada - CA;-;6;;" wts[246]="Yalta;Ukraine - UA;+;3;;" wts[247]="Zagreb;Croatia - HR;+;1;;" wts[248]="Zaragoza;Spain - ES;+;1;;" wts[249]="Zurich;Switzerland - CH;+;1;;" //* means that the shown time has been adjusted due to local daylight saving. Local daylight // saving time/summer time is unwarranted! var ST=null; var constanta=3600000; var GMTClockID=null; var GMTClockRunning=false; var TSCClockID=null; var TSCClockRunning=false; var GMT=""; function SystemClock(){ //simple clock for current system time var time=new Date() var x=time var y=x.getDate(); (y<10) ? y="0"+y : y var z=x.getYear(); (z>70 && z<=99) ? z="19"+z : z="20"+z var hs=x.getHours(); (hs<10) ? hs="0"+hs : hs var ms=x.getMinutes();(ms<10) ? ms="0"+ms : ms var ss=x.getSeconds();(ss<10) ? ss="0"+ss : ss ST=days[x.getDay()]+", "+y+" "+months[x.getMonth()]+" "+z+" "+hs+":"+ms+":"+ss; document.clockForm.digits.value=ST+" "+"YST"; id=setTimeout("SystemClock()",1000) //displays system time } function GMTClock(){ //displays selected different time var a1=new Date() var a2=a2=a1.toLocaleString(); a2=Date.parse(a2); if(offset=="+"){var a3=new Date(a2-addhm);}else{var a3=new Date(a2+addhm);} var bx=""+a3; var sn=bx.length; var bden=bx.substring(0,3); var bdd=bx.substring(8,10); var bm=bx.substring(4,7); var br=bx.substring(sn-4,sn); var bc=bx.substring(11,19); GMT=bden+", "+bdd+" "+bm+" "+br+" "+bc; document.clockForm.digits1.value=GMT+" "+"GMT"; //displays selected time minus your time zone offset from OS stopGMTClock(); GMTClockID=setTimeout("GMTClock()",1000); GMTClockRunning=true; } function where1(si){ //read option selected if(si != 0){ offset=GetField(wts[si],3); //realy offset to GMT from array wts addh=GetField(wts[si],4); if(GetField(wts[si],5) != ""){ //if find minutes in array wts converts minutes to milisecs addm=(GetField(wts[si],5)/60);} else{addm=0;} addhm=(constanta*addh)+(constanta*addm); stopTSCClock(); document.clockForm.digits2.value=""; GMTClock(); } else{ stopGMTClock(); document.clockForm.digits1.value=""; stopTSCClock(); document.clockForm.digits2.value=""; } } function TSCClock(){ //displays selected different time var a11=new Date(GMT) var a22=a11.toGMTString(); //toLocaleString(); a22=Date.parse(a22); if(offset1=="+"){var a33=new Date(a22+addhm1)}else{var a33=new Date(a22-addhm1)} var bx1=""+a33; var sn1=bx1.length; var bden1=bx1.substring(0,3); var bdd1=bx1.substring(8,10); var bm1=bx1.substring(4,7); var br1=bx1.substring(sn1-4,sn1); var bc1=bx1.substring(11,19); document.clockForm.digits2.value=bden1+", "+bdd1+" "+bm1+" "+br1+" "+bc1+" TSC"; //displays selected time minus your time zone offset from OS stopTSCClock(); TSCClockID=setTimeout("TSCClock()",1000); TSCClockRunning=true; } function where2(si){ //read option selected if(si !=0 && GMT !=""){ offset1=GetField(wts[si],3); //realy offset to GMT from array wts addh1=GetField(wts[si],4); if(GetField(wts[si],5) != ""){ //if find minutes in array wts converts minutes to milisecs addm1=(GetField(wts[si],5)/60);} else{addm1=0;} addhm1=(constanta*addh1)+(constanta*addm1);TSCClock(); } else{ stopTSCClock(); document.clockForm.digits2.value=""; alert("Where are you from ???"); document.clockForm.c2.options[0].selected=true; document.clockForm.c1.focus(); } } function stopGMTClock(){ //stops GMT time if(GMTClockRunning) clearTimeout(GMTClockID); GMTClockRunning=false; } function stopTSCClock(){ //stops Any time if(TSCClockRunning) clearTimeout(TSCClockID); TSCClockRunning=false; } function GetField(Entry,number){ //read fields from array wts var Out=""; var FirstChar; var LastChar; FirstChar=0; LastChar=Entry.indexOf(Separator); if(number==1){ Out+=Entry.substring(FirstChar,LastChar); return Out; } if(number==Fields){ Out+=Entry.substring(Entry.lastIndexOf(Separator)+1,Entry.length); return Out; } for(var i=2;i<=number;i++){ FirstChar=LastChar+1; LastChar=Entry.indexOf(Separator, FirstChar); } Out+=Entry.substring(FirstChar,LastChar); return Out; } function writecities(str,n){ //writes options from array wts if(n=="c1"){document.writeln('');} document.writeln("