
_wm=parent._wm;var oTz;opSelect=0x1;opSouth=0x10;MODE_TIME=0;MODE_CITY=1;MODE_COUNTRY=2;MODE_INIT=3;var nIndex=0;var nMode=0;function TTime(ci,cn,di,fl,sm,sd,sh,em,ed,eh)
{this.city=ci;this.country=cn;this.diff=di;this.flag=fl;this.idx=nIndex++;}
var aBatchCity=[];var aBatchCountry=[];opSouth=0x10;opDLS=0x20;opAnalog=0x40;opCity=0x100;opCountry=0x200;opDate=0x400;opWeek=0x800;opTime=0x1000;opIndicator=0x2000;opEu=0x4000;opAm=0x8000;opPicked=0x10000;opDayLight=0x20000;dlEgypt=1;dlNamibia=2;dlIsrael=4;dlPalestine=6;dlIran=8;dlTasmania=9;dlNewZealand=10;dlTonga=11;dlCuba=12;dlBrazil=13;dlChile=14;dlFalklands=15;dlParaguay=16;var aBatch=[new TTime("Apia","Samoa",-11,0),new TTime("Hawaii","United States",-10,1),new TTime("Honolulu","United States",-10,0),new TTime("Alaska","United States",-9,opAm,4,6,2,10,26,2),new TTime("Anchorage","United States",-9,opAm,4,6,2,10,26,2),new TTime("Pacific Time","United States",-8,1|opAm,4,6,2,10,26,2),new TTime("Los Angeles","United States",-8,opAm,4,6,2,10,26,2),new TTime("Seattle","United States",-8,opAm,4,6,2,10,26,2),new TTime("San Francisco","United States",-8,opAm,4,6,2,10,26,2),new TTime("Vancouver","Canada",-8,opAm,4,6,2,10,26,2),new TTime("Mountain Time","United States",-7,1|opAm,4,6,2,10,26,2),new TTime("Phoenix","United States",-7,0),new TTime("Denver","United States",-7,opAm,4,6,2,10,26,2),new TTime("Edmonton","Canada",-7,opAm,4,6,2,10,26,2),new TTime("Aklavik","Canada",-7,opAm,4,6,2,10,26,2),new TTime("Central Time","United States",-6,1|opAm,4,6,2,10,26,2),new TTime("Montgomery","United States",-6,opAm,4,6,2,10,26,2),new TTime("Chicago","United States",-6,opAm,4,6,2,10,26,2),new TTime("New Orleans","United States",-6,opAm,4,6,2,10,26,2),new TTime("St. Paul","United States",-6,opAm,4,6,2,10,26,2),new TTime("Minneapolis","United States",-6,opAm,4,6,2,10,26,2),new TTime("Houston","United States",-6,opAm,4,6,2,10,26,2),new TTime("Winnipeg","Canada",-6,opAm,4,6,2,10,26,2),new TTime("Mexico City","Mexico",-6,opAm,4,6,2,10,26,2),new TTime("Managua","Nicaragua",-6,0),new TTime("Tegucigalpa","Honduras",-6,0),new TTime("San Salvador","El Salvador",-6,0),new TTime("Saskatchewan","Canada",-6,0),new TTime("Guatemala","Guatemala",-6,0),new TTime("Indiana (EST)","United States",-5,1),new TTime("Indianapolis","United States",-5,opAm,4,6,2,10,26,2),new TTime("Bogota","Colombia",-5,0),new TTime("Kingston","Jamaica",-5,0),new TTime("Lima","Peru",-5,0),new TTime("Eastern Time","United States",-5,1|opAm,4,6,3,10,26,1),new TTime("Washington DC","United States",-5,opAm,4,6,2,10,26,2),new TTime("Boston","United States",-5,opAm,4,6,2,10,26,2),new TTime("New York","United States",-5,opAm,4,6,2,10,26,2),new TTime("Philadelphia","United States",-5,opAm,4,6,2,10,26,2),new TTime("Detroit","United States",-5,opAm,4,6,2,10,26,2),new TTime("Atlanta","United States",-5,opAm,4,6,2,10,26,2),new TTime("Montreal","Canada",-5,opAm,4,6,2,10,26,2),new TTime("Ottawa","Canada",-5,opAm,4,6,2,10,26,2),new TTime("Toronto","Canada",-5,opAm,4,6,2,10,26,2),new TTime("Nassau","Bahamas",-5,opAm,4,6,2,10,26,2),new TTime("Havana","Cuba",-5,opDayLight,4,1,0,10,26,1,dlCuba),new TTime("Georgetown","United Kingdom",-5,0),new TTime("Atlantic Time","Canada",-4,opAm,4,6,3,10,26,1),new TTime("Halifax","Canada",-4,opAm,4,6,2,10,26,2),new TTime("Asuncion","Paraguay",-4,opSouth|opDayLight,4,6,0,9,7,0,dlParaguay),new TTime("San Juan","Puerto Rico",-4,0),new TTime("Caracas","Venezuela",-4,0),new TTime("La Paz","Bolivia",-4,0),new TTime("Santiago","Chile",-4,opSouth|opDayLight,3,9,0,10,12,0,dlChile),new TTime("Santo Domingo","Dominican Republic",-4,0),new TTime("Newfoundland","Canada",-3.5,opAm,4,6,0,10,26,0),new TTime("Montevideo","Uruguay",-3,0),new TTime("Buenos Aries","Argentina",-3,0),new TTime("Rio de Janeiro","Brazil",-3,1|opSouth|opDayLight,2,16,0,10,12,0,dlBrazil),new TTime("Sao Paulo","Brazil",-3,opSouth|opDayLight,2,16,0,10,12,0,dlBrazil),new TTime("Brasilia","Brazil",-3,opSouth|opDayLight,2,16,0,10,12,0,dlBrazil),new TTime("Azores","Portugal",-1,opEu,3,30,0,10,26,1),new TTime("Praia","Cape Verde Is.",-1,0),new TTime("Greenwich","United Kingdom",0,1|opEu,3,30,1,10,26,2),new TTime("Casablanca","Morocco",0,0),new TTime("Monrovia","Liberia",0,0),new TTime("Reykjavik","Iceland",0,0),new TTime("Dublin","Ireland",0,opEu,3,30,1,10,26,2),new TTime("Edinburgh","United Kingdom",0,opEu,3,30,1,10,26,2),new TTime("London","United Kingdom",0,opEu,3,30,1,10,26,2),new TTime("Lisbon","Portugal",0,opEu,3,30,1,10,26,2),new TTime("Lagos","Nigeria",1,0),new TTime("Algiers","Algeria",1,0),new TTime("Berlin","Germany",1,1|opEu,3,30,2,10,26,3),new TTime("Frankfurt","Germany",1,opEu,3,30,2,10,26,3),new TTime("Rome","Italy",1,opEu,3,30,2,10,26,3),new TTime("Brussels","Belgium",1,opEu,3,30,2,10,26,3),new TTime("Amsterdam","Netherlands",1,opEu,3,30,2,10,26,3),new TTime("Geneva","Switzerland",1,opEu,3,30,2,10,26,3),new TTime("Zurich","Switzerland",1,opEu,3,30,2,10,26,3),new TTime("Bern","Switzerland",1,opEu,3,30,2,10,26,3),new TTime("Oslo","Norway",1,opEu,3,30,2,10,26,3),new TTime("Copenhagen","Denmark",1,opEu,3,30,2,10,26,3),new TTime("Vienna","Austria",1,opEu,3,30,2,10,26,3),new TTime("Stockholm","Sweden",1,opEu,3,30,2,10,26,3),new TTime("Warsaw","Poland",1,opEu,3,30,2,10,26,3),new TTime("Paris","France",1,opEu,3,30,2,10,26,3),new TTime("Madrid","Spain",1,opEu,3,30,2,10,26,3),new TTime("Barcelona","Spain",1,opEu,3,30,2,10,26,3),new TTime("Prague","Czech Republic",1,opEu,3,30,2,10,26,3),new TTime("Zagreb","Croatia",1,opEu,3,30,2,10,26,3),new TTime("Budapest","Hungary",1,opEu,3,30,2,10,26,3),new TTime("Belgrade","Serbia",1,opEu,3,30,2,10,26,3),new TTime("Cape Town","South Africa",2,0),new TTime("Pretoria","South Africa",2,0),new TTime("Johannesburg","South Africa",2,0),new TTime("Sofia","Bulgaria",2,opEu,3,30,3,10,26,4),new TTime("Athens","Greece",2,opEu,3,30,3,10,26,4),new TTime("Tallinn","Estonia",2,opEu,3,30,3,10,26,4),new TTime("Helsinki","Finland",2,opEu,3,30,3,10,26,4),new TTime("Bucharest","Romania",2,opEu,3,30,3,10,26,4),new TTime("Minsk","Belarus",2,opEu,3,30,2,10,26,3),new TTime("Istanbul","Turkey",2,opEu,3,30,3,10,26,4),new TTime("Kyiv","Ukraine",2,opEu,3,30,3,10,26,4),new TTime("Odesa","Ukraine",2,opEu,3,30,3,10,26,4),new TTime("Cairo","Egypt",2,opDayLight,4,25,0,9,26,0,dlEgypt),new TTime("Harare","Zimbabwe",2,0),new TTime("Ankara","Turkey",2,opEu,3,30,3,10,26,4),new TTime("Jerusalem","Israel",2,0,3,28,1,10,3,1),new TTime("Beirut","Lebanon",2,opEu,3,30,0,10,26,1),new TTime("Amman","Jordan",2,0,3,27,0,9,25,1),new TTime("Khartoum","Sudan",3,0),new TTime("Baghdad","Iraq",3,0,4,1,3,10,1,4),new TTime("Nairobi","Kenya",3,0),new TTime("Addis Ababa","Ethiopia",3,0),new TTime("Aden","Yemen",3,0),new TTime("Riyadh","Saudi Arabia",3,0),new TTime("Antananarivo","Madagascar",3,0),new TTime("Kuwait City","Kuwait",3,0),new TTime("Moscow","Russia",3,1|opEu,3,30,2,10,26,3),new TTime("Kazan","Russia",3,opEu,3,30,2,10,26,3),new TTime("Volgograd","Russia",3,opEu,3,30,2,10,26,3),new TTime("Tehran","Iran",3.5,0),new TTime("Abu Dhabi","United Arab Emirates",4,0),new TTime("Muscat","Oman",4,0),new TTime("Tbilisi","Georgia",4,0),new TTime("Samara","Russia",4,opEu,3,30,2,10,26,3),new TTime("Kabul","Afghanistan",4.5,1),new TTime("Islamabad","Pakistan",5,0),new TTime("Lahore","Pakistan",5,0),new TTime("Karachi","Pakistan",5,0),new TTime("Tashkent","Uzbekistan",5,0),new TTime("Sverdlovsk","Russia",5,opEu,3,30,2,10,26,3),new TTime("Bombay","India",5.5,0),new TTime("Calcutta","India",5.5,0),new TTime("Madras","India",5.5,0),new TTime("New Delhi","India",5.5,1),new TTime("Colombo","Sri Lanka",6,0),new TTime("Kathmandu","Nepal",5.75,0),new TTime("Alma Ata","Kazakhstan",6,opEu,3,20,2,10,26,3),new TTime("Dhaka","Bangladesh",6,0),new TTime("Rangoon","Burma",6.5,0),new TTime("Bangkok","Thailand",7,1),new TTime("Jakarta","Indonesia",7,0),new TTime("Hanoi","Vietnam",7,0),new TTime("Kuala Lumpur","Malaysia",8,0),new TTime("Beijing","China",8,1),new TTime("Hong Kong","China",8,0),new TTime("Shanghai","China",8,1),new TTime("Urumqi","China",8,0),new TTime("Manila","Philippines",8,0),new TTime("Perth","Australia",8,0),new TTime("Singapore","Singapore",8,0),new TTime("Taipei","Taiwan",8,0),new TTime("Tokyo","Japan",9,1),new TTime("Osaka","Japan",9,0),new TTime("Sapporo","Japan",9,0),new TTime("Pusan","Korea",9,0),new TTime("Seoul","Korea",9,0),new TTime("Pyongyang","North Korea",9,0),new TTime("Yakutsk","Russia",9,opEu,3,30,2,10,26,3),new TTime("Adelaide","Australia",9.5,opSouth|opEu,3,30,3,10,26,2),new TTime("Darwin","Australia",9.5,0),new TTime("Brisbane","Australia",10,0),new TTime("Melbourne","Australia",10,opSouth|opEu,3,30,3,10,26,2),new TTime("Canberra","Australia",10,opSouth|opEu,3,30,3,10,26,2),new TTime("Sydney","Australia",10,opSouth|opEu,3,30,3,10,26,2),new TTime("Tasmania","Australia",10,opSouth|opDayLight,3,30,3,10,26,2,dlTasmania),new TTime("Guam","United States",10,0),new TTime("Port Moresby","Papua New Guinea",10,0),new TTime("Vladivostok","Russia",10,opEu,3,30,2,10,26,3),new TTime("Hobart","Australia",10,opSouth,3,30,3,10,5,2),new TTime("Magadan","Russia",11,opEu,3,30,2,10,26,3),new TTime("New Caledonia","France",11,0),new TTime("Suva","Fiji",12,0),new TTime("Kamchatka","Russia",12,opEu,3,30,2,10,26,3),new TTime("Anadyr","Russia",12,opEu,3,30,2,10,26,3),new TTime("Majuro","Marshall Islands",12,0),new TTime("Wellington","New Zealand",12,opSouth|opDayLight,3,16,3,10,5,2,dlNewZealand),new TTime("Auckland","New Zealand",12,opSouth|opDayLight,3,16,3,10,5,2,dlNewZealand),new TTime("Chatham Island","New Zealand",12.75,opSouth|opDayLight,3,16,4,10,5,3,dlNewZealand),new TTime("Kiritimati","Kiribati",14,0)];function saveFavorite()
{var bRestore=false;var saveMode=nMode;if(nMode!=MODE_TIME){sortAll(MODE_TIME);bRestore=true;}
setClock(true);var nm="worldclock";clock.buffer.value=parent._extra[1];_wm.fnSave(clock.buffer,"file_"+nm,true,"my_"+nm);if(bRestore){sortAll(saveMode);setClock(true);}}
function loadFavorite()
{return _wm.fnLoadArray(clock.buffer,"worldclock");}
function setList(lst,nMo){var aFav=0;if(nMo==MODE_INIT)
aFav=loadFavorite();var bSelect=false;var count=0;oTz.tmz.options.length=lst.length;for(var i=0;i<lst.length;i++){oTz.tmz.options[i].text=(nMo==MODE_COUNTRY?lst[i].country+", "+lst[i].city:lst[i].city+", "+lst[i].country);if(aFav){lst[i].flag&=~opSelect;if(i==aFav[count]){lst[i].flag|=opSelect;bSelect=true;}}
else{if(lst[i].flag&opSelect)
bSelect=true;}
if(bSelect){oTz.tmz.options[i].selected=true;count++;}
else
oTz.tmz.options[i].selected=false;bSelect=false;}
oTz.count.value=count;}
function setClock(bSave)
{var lst=getList();var sSelected="";var nSelected=0;for(var i=0;i<lst.length;i++){if(lst[i].flag&opSelect){sSelected+=lst[i].idx+";";nSelected++;}}
if(!nSelected)
alert("Please select more than 1 item.");else if(nSelected>30)
alert("Please select less than 30 items.");else{parent._extra[1]=sSelected;if(!bSave)
parent.runDict('World Clocks','map_worldtime',0,0,1);}
return false;}
function resetAll(lst)
{var oTz=document.clock;for(var i=0;i<oTz.tmz.length;i++){aBatch[i].flag&=~opSelect;if(aBatchCity.length)
aBatchCity[i].flag&=~opSelect;if(aBatchCountry.length)
aBatchCountry[i].flag&=~opSelect;oTz.tmz.options[i].selected=false;}
oTz.count.value=0;}
function strcmpi(a,b){var loA=a.toLowerCase();var loB=b.toLowerCase();if(loA>loB)return 1;else if(loA==loB)return 0;else return-1;}
function compareCity(a,b){return strcmpi(a.city,b.city);}
function compareCountry(a,b){return strcmpi(a.country,b.country);}
function sortInAlpha(nMode){if(nMode==MODE_COUNTRY){if(!aBatchCountry.length){for(var i=0;i<aBatch.length;i++){aBatchCountry[i]=aBatch[i];}
aBatchCountry.sort(compareCountry);}
setList(aBatchCountry,nMode);}
else if(nMode==MODE_CITY){if(!aBatchCity.length){for(var i=0;i<aBatch.length;i++){aBatchCity[i]=aBatch[i];}
aBatchCity.sort(compareCity);}
setList(aBatchCity,nMode);}}
function sortAll(md)
{if(nMode!=md){nMode=md;if(nMode==MODE_TIME)
setList(aBatch);else
sortInAlpha(nMode);}}
function getList()
{if(nMode==MODE_TIME)
return aBatch;else if(nMode==MODE_CITY)
return aBatchCity;else(nMode==MODE_COUNTRY)
return aBatchCountry;}
function countIt(oSel)
{var lst=getList();var count=0;for(var i=0;i<oSel.length;i++){if(oSel[i].selected){count++;lst[i].flag|=opSelect;}
else
lst[i].flag&=~opSelect;}
oTz.count.value=count;}
