// This file is (c) 2005-2011 qlock.com. Unauthorized copying is prohibited. var mouseEnabled=true;var autoUpdate=true;var currIndex=-1;var IE=document.all ? true : false;var mapW=640;var mapH=320;var dayOfWeek=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");var mouseX=0;var mouseY=0;function getDSTDay(year, num, dow, mth){mth--;if(dow==0){adow=1;dt=new Date();}else{dow-=3;dt=new Date(year,mth,1);fdow=(dt.getUTCDay()+5)% 7;adow=(dow-fdow)+1;if(adow <=0)adow+=7;}if(num==5){dt=new Date(year,mth,(3*7)+adow);t=dt.getTime();for(i=3;i<6;i++){dt=new Date(t);if(dt.getMonth()!=mth)break;t+=1000*60*60*24*7;}num=i;}dt.setUTCFullYear(year,mth,((num-1)*7)+adow);dt.setUTCHours(0,0,1);return dt;}function fixDigit(str){var s=new String(str);if(s.length < 2)return "0"+s;else return s;}function getTime(gmtOffset){var date=new Date();offset=gmtOffset*60*60*1000;diff=date.getTime()-startDate.getTime();date.setTime(diff+baseTime+offset);return date;}function formatTime(date){var time;var hour=date.getUTCHours();var min=fixDigit(date.getUTCMinutes());var sec=fixDigit(date.getUTCSeconds());var del=sec&1 ? ":" : ":";if(hour > 12)time=(hour-12)+del+min+" pm";else if(hour==12)time=12+del+min+" pm";else if(hour==0)time=12+del+min+" am";else time=hour+del+min+" am";return dayOfWeek[date.getUTCDay()]+" "+time;}function findChild(elem, className){if(elem.className==className)return elem;var i;for(i=0;i < elem.childNodes.length;i++){var e=findChild(elem.childNodes[i], className);if(e)return e;}return null;}function setCity(name){obj=document.getElementById('qlock1');city=findChild(obj,"city");city.getElementsByTagName("P")[0].innerHTML=name;}function setTime(time,off,dst){obj=document.getElementById('qlock1');l=findChild(obj,"time");l.getElementsByTagName("P")[0].innerHTML=time;if(off==0)gmt="GMT";else if(off > 0)gmt="GMT+"+off;else gmt="GMT "+off;l=findChild(obj,"gmt");l.getElementsByTagName("P")[0].innerHTML=gmt;l=findChild(obj,"dst");l.getElementsByTagName("P")[0].innerHTML=dst?"DST":"";}function moveClock(x,y){obj=document.getElementById('qlock1');obj.style.left=x+"px";obj.style.top=y+"px";}var isOnMap=false;function MouseMove(e){if(!mouseEnabled)return;obj=document.getElementById('map');mapX=findPosX(obj);mapY=findPosY(obj);mapW=obj.offsetWidth;mapH=obj.offsetHeight;if(IE){x=event.x-mapX;y=event.y-mapY;}else{x=e.pageX-mapX;y=e.pageY-mapY;}mouseX=x;mouseY=y;if((x < 0)||(y < 0)||(x >=mapW)||(y >=mapH)){if(isOnMap){document.getElementById('qlock1').style.display="none";document.getElementById('marker').style.display="none";isOnMap=false;}}else{showCity(findClosest(x,y));isOnMap=true;}}function findClosest(x, y){var minD=1000000000;var minIndex=-1;for(i=1;i=0){dstSet=dstList[cityList[index][3]];year=time.getFullYear();var start=getDSTDay(year,dstSet[0],dstSet[1],dstSet[2]);var end=getDSTDay(year,dstSet[3],dstSet[4],dstSet[5]);if(dstSet[2] > dstSet[5]){if(time >=start || time < end)dstON=true;}else if(dstSet[2] < dstSet[5]){if(time >=start && time < end)dstON=true;}else if(dstSet[2]==dstSet[5]){dstON=true;}}else{}if(dstON){time=new Date(time.getTime()+(1000*60*60));}setTime(formatTime(time),cityList[index][2],dstON);}function getLocStr(lng,lat){var o="";if(lng >=0)o+=lng.toFixed(2)+" N";else o+=-lng.toFixed(2)+" S";o+=", ";if(lat >=0)o+=lat.toFixed(2)+" E";else o+=-lat.toFixed(2)+" W";return o;}function showCity(index){var map=document.getElementById('map');var clock=document.getElementById('qlock1');var marker=document.getElementById('marker');var linksjump=document.getElementById('linksjump');if(map){mapX=findPosX(map);mapY=findPosY(map);}currIndex=index;var vis;if(index >=0){setCity(cityList[index][0]);updateTime(index);clock.style.display="block";if(marker){marker.style.display="block";var x=(((cityList[index][5]+180)/360)*mapW);var y=(((-cityList[index][4]+90)/180)*mapH);x+=mapX;y+=mapY;marker.style.left=(x-3)+"px";marker.style.top=(y-3)+"px";var w=clock.offsetWidth+3;var h=clock.offsetHeight+3;x-=w;y-=h;if(x < mapX)x+=w;if(y < mapY)y+=h;moveClock(x,y);document.getElementById('location').innerHTML="Location: "+getLocStr(cityList[index][4],cityList[index][5]);}}else{}}function showAll(){var out="";for(i=0;i";}document.getElementById("map").innerHTML=out;}function update(){if(currIndex >=0)updateTime(currIndex);setTimeout(update,1000);}var findIndex=-1;var hilightStart;var lastKey;var myTimeout=0;function complete(){switch(lastKey){case 13: case 33: case 34: case 35: case 35: case 36: case 37: case 39: case 45: case 46: return;}var cname=" ";findIndex=-1;if(lastKey !=8){var input=document.getElementById("find");var str=input.value.toLowerCase();if(str.length){var i;for(i=0;i=0)cname=countryList[ci];else cname="";if(autoUpdate)showCity(i);findIndex=i;if(typeof completeDone !="undefined")completeDone();break;}}}}var country=document.getElementById("country");if(country)country.getElementsByTagName("P")[0].innerHTML=cname;if(typeof findChange !="undefined")findChange();}function doFind(ctl){document.getElementById("find").select();document.getElementById("find").focus();if(findIndex >=0)showCity(findIndex);return false;}function keyup(){if(!myTimeout)myTimeout=setTimeout(complete,10);}function keydown(event){if(myTimeout){clearTimeout(myTimeout);myTimeout=0;}lastKey=event.keyCode;if(event.keyCode==8)document.getElementById("find").value.substr(0,hilightStart)}function resizeHandler(){if(currIndex >=0)showCity(currIndex);}function doFocus(){document.getElementById("find").select();}function findCityByName(city){var str=city.toLowerCase();if(str.length){var i;for(i=0;i