//Copyright 2000 Roy Digital Design//
//Modified and Translated for WORLDNAVI.NET for A. KUSABA//
//Please contact http://Gheos.com . if you intend to re-use this script.//

if(navigator.appName=='Netscape'){
function clickMess(e){
if(document.all&&event.button==2){
alert('Gheos World Time ｩ Roy Digital Design\n\nhttp://Gheos.com');
return false;
}
else if(navigator.appName=='Netscape'){if(document.getElementById&&e.which==3)alert('Gheos World Time ｩ Roy Digital Design\n\nhttp://Gheos.com');
else if(document.layers&&e.which==3)return false;}
}
if(document.layers)document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickMess;

}else{

menuItems=new Array();
menuItemNum=0;

function addMenuItem(text,url,img){
  if(img) menuItems[menuItemNum]=new Array(text, url, img);
  else if(text) menuItems[menuItemNum]=new Array(text, url);
  else menuItems[menuItemNum]=new Array();
  menuItemNum++;
}

menuWidth=126;
menuHeight=304;
menuDelay=50; //delay
menuSpeed=8; //speed
menuOffset=2; //offset

addMenuItem("トップ","http://www.worldnavi.net/");
addMenuItem();
addMenuItem("アジア","http://www.worldnavi.net/country-index.html#asia");
addMenuItem("西欧・北欧","http://www.worldnavi.net/country-index.html#WE");
addMenuItem("中東欧・NIS","http://www.worldnavi.net/country-index.html#WR");
addMenuItem("北米","http://www.worldnavi.net/country-index.html#WN");
addMenuItem("中南米","http://www.worldnavi.net/country-index.html#WS");
addMenuItem("中東","http://www.worldnavi.net/country-index.html#WR");
addMenuItem("アフリカ","http://www.worldnavi.net/country-index.html#WF");
addMenuItem("大洋州","http://www.worldnavi.net/country-index.html");
addMenuItem();
addMenuItem("カテゴリ別","http://www.worldnavi.net/category-index.html");
addMenuItem("役立ちリンク","http://www.worldnavi.net/useful-links.html");
addMenuItem();
addMenuItem("Gheos.com","http://Gheos.com/");

if(window.navigator.appName == "Microsoft Internet Explorer" && window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE") + 5, window.navigator.appVersion.indexOf("MSIE") + 8) >= 5.5)isIe = 1;
else isIe=0;

if(isIe){
menuContent='<TABLE ID="rightMenu" WIDTH="0" HEIGHT="0" CELLSPACING="0" cellpadding="0" STYLE="font:menu;color:menutext;"><TR HEIGHT="1"><TD STYLE="background:threedlightshadow" COLSPAN="4"></TD><TD STYLE="background:threeddarkshadow"></TD></TR><TR HEIGHT="1"><TD STYLE="background:threedlightshadow"></TD><TD STYLE="background:threedhighlight" COLSPAN="2"></TD><TD STYLE="background:threedshadow"></TD><TD STYLE="background:threeddarkshadow"></TD></TR><TR HEIGHT="10"><TD STYLE="background:threedlightshadow"></TD><TD STYLE="background:threedhighlight"></TD><TD STYLE="background:threedface"><TABLE CELLSPACING="0" cellpadding="0" nowrap STYLE="font:menu;color:menutext;cursor:default;">';
  for(m=0;m<menuItems.length;m++){
   if(menuItems[m][0]&&menuItems[m][2])
    menuContent+='<TR HEIGHT="17" onMouseOver="this.style.background=\'highlight\';this.style.color=\'highlighttext\';" onMouseOut="this.style.background=\'threedface\';this.style.color=\'menutext\';" onClick="parent.window.location.href=\''+menuItems[m][1]+'\'"><TD STYLE="background:threedface" WIDTH="1" nowrap></TD><TD WIDTH="21" NOWRAP><IMG SRC="'+menuItems[m][2]+'"></TD><TD NOWRAP>'+menuItems[m][0]+'</TD><TD WIDTH="21" NOWRAP></TD><TD STYLE="background:threedface" WIDTH="1" NOWRAP></TD></TR>';
   else if(menuItems[m][0])
    menuContent+='<TR HEIGHT="17" onMouseOver="this.style.background=\'highlight\';this.style.color=\'highlighttext\';" onMouseOut="this.style.background=\'threedface\';this.style.color=\'menutext\';" onClick="parent.window.location.href=\''+menuItems[m][1]+'\'"><TD STYLE="background:threedface" WIDTH="1" nowrap></TD><TD WIDTH="21" NOWRAP></TD><TD NOWRAP>'+menuItems[m][0]+'</TD><TD WIDTH="21" NOWRAP></TD><TD STYLE="background:threedface" WIDTH="1" NOWRAP></TD></TR>';
   else
    menuContent+='<TR><TD COLSPAN="5" HEIGHT="4"></TD></TR><TR><TD COLSPAN="5"><TABLE CELLSPACING="0"><TR><TD WIDTH="2" HEIGHT="1"></TD><TD WIDTH="0" HEIGHT="1" STYLE="background:threedshadow"></TD><TD WIDTH="2" HEIGHT="1"></TD></TR><TR><TD WIDTH="2" HEIGHT="1"></TD><TD WIDTH="100%" HEIGHT="1" STYLE="background:threedhighlight"></TD><TD WIDTH="2" HEIGHT="1"></TD></TR></TABLE></TD></TR><TR><TD COLSPAN="5" HEIGHT="3"></TD></TR>';
  }
  menuContent+='</TABLE></TD><TD STYLE="background:threedshadow"></TD><TD STYLE="background:threeddarkshadow"></TD></TR><TR HEIGHT="1"><TD STYLE="background:threedlightshadow"></TD><TD STYLE="background:threedhighlight"></TD><TD STYLE="background:threedface"></TD><TD STYLE="background:threedshadow"></TD><TD STYLE="background:threeddarkshadow"></TD></TR><TR HEIGHT="1"><TD STYLE="background:threedlightshadow"></TD><TD STYLE="background:threedshadow" COLSPAN="3"></TD><TD STYLE="background:threeddarkshadow"></TD></TR><TR HEIGHT="1"><TD STYLE="background:threeddarkshadow" COLSPAN="5"></TD></TR></TABLE>';

menuPopup=window.createPopup();
menuPopup.document.body.innerHTML=menuContent;
}

function showMenu(){
  menuXPos=event.clientX+menuOffset;
  menuYPos=event.clientY+menuOffset;

  menuXIncrement=menuWidth / menuSpeed;
  menuYIncrement=menuHeight / menuSpeed;

  menuTimer=setTimeout("openMenu(0,0)",menuDelay);

  return false;
}

function openMenu(height, width){
  iHeight = height;
  iWidth = width;

  menuPopup.show(menuXPos, menuYPos, iWidth, iHeight, document.body);

  if(iHeight < menuHeight)
   menuTimer = setTimeout("openMenu(iHeight + menuYIncrement, iWidth + menuXIncrement)", 1);
  else
   clearTimeout(menuTimer);
}

if(isIe) document.oncontextmenu=showMenu;
}

var GheosTop,GheosLeft,theoffset,ending,newleft,newtop;
if(GheosTop==null||GheosTop=='NUMBER')GheosTop=10;
if(GheosLeft==null)GheosLeft=screen.width/2-450;
var Gheosstyle='';
if(document.all)Gheosstyle=' filter:Alpha(opacity=70,finishopacity=60,style=1)';
var now=new Date();
var nowoff=now.getTimezoneOffset()/60;
var utc=(now.getHours()+nowoff);
var localutc=IfZero(now.getHours())-IfZero(utc);
if(localutc>0)localutc='+'+localutc;
var places=new Array('Amsterdam#+1ｧ446207､y','Anchorage#-9ｧ064160､y','Bangkok#+7ｧ684324､n','Beijing#+8ｧ723251､n','Boise#-7ｧ148240､y','Brasilia#-4ｧ317399､y','Buenos Aires#-4ｧ290450､y','Cairo#+2ｧ510283､y','Calgary#-7ｧ153212､y','Cape Town#+2ｧ481447､n','Casablanca#+1ｧ416271､n','Chicago#-6ｧ216244､y','Dakar#0ｧ393319､n','Dallas#-6ｧ196274､y','Harare#+2ｧ510402､n','Helsinki#+2ｧ496171､y','Hong Kong#+8ｧ719298､n','Honolulu#-10ｧ043315､y','Jakarta#+7ｧ699372､n','Kinshasa#+1ｧ474368､n','Longyearbyen#+1ｧ469042､y','Los Angeles#-8ｧ137265､y','Mexico#-6ｧ190310､y','Moscow#+3ｧ536192､y','Murmansk#+3ｧ515118､y','Nairobi#+3ｧ527361､n','N Djamena#+1ｧ474328､n','New Delhi#+5:30ｧ626286､n','New York#-5ｧ260240､y','Nuuk#-3ｧ304131､y','Perth#+8ｧ721440､y','Port Moresby#+10ｧ799379､n','Quito#-5ｧ241359､y','Reykjavik#0ｧ374150､n','Rome#1ｧ466245､y','Santo Domingo#-4ｧ262310､n','Stanley#-4ｧ286509､y','Sucre#-4ｧ273403､n','Sydney#+10ｧ806446､y','Tashkent#+5ｧ605246､y','Tehran#+3:30ｧ562265､y','Tokyo#+9ｧ780265､n','Ulaanbaatar#+8ｧ700224､n','Wellington#+12ｧ867467､y','Yakutsk#+9ｧ759165､y');

function linkIt(){
parent.location='http://www.worldnavi.net/collection/worldclock/';
}

function GetTime(){ 
now=new Date();
var theMonth=now.getMonth()+1;
var theDate=now.getDate();
var theDay=now.getDay();
document.bar.local.value=(check24(now.getHours())+':'+IfZero(now.getMinutes())+':'+IfZero(now.getSeconds()));
document.bar.utc.value=(check24(utc)+':'+IfZero(now.getMinutes())+':'+IfZero(now.getSeconds()));
if(!(document.layers)){
for(x=0;x<places.length;x++){
if(places[x].indexOf(':')!=-1){
theoffset=parseFloat(places[x].substring(places[x].indexOf('#')+1,places[x].indexOf(':')));
ending=':'+IfZero(now.getMinutes()+parseFloat(places[x].substring(places[x].indexOf(':')+1,places[x].indexOf('ｧ'))))+':'+IfZero(now.getSeconds());
}else {theoffset=parseFloat(places[x].substring(places[x].indexOf('#')+1,places[x].indexOf('ｧ')));
ending=':'+IfZero(now.getMinutes())+':'+IfZero(now.getSeconds());
}
var thetime=check24(((utc+theoffset)>24)?((utc+theoffset)-24):(utc+theoffset));
if(places[x].substring(places[x].indexOf('､')+1)=='y'&&places[x].substring(places[x].indexOf('ｧ')+4,places[x].indexOf('､'))<359){
	if(theMonth==3&&theDate-theDay>24)thetime++
	else if(theMonth==10&&theDate-theDay<25)thetime++
	else if(theMonth>3&&theMonth<10)thetime++;
}
if(places[x].substring(places[x].indexOf('､')+1)=='y'&&places[x].substring(places[x].indexOf('ｧ')+4,places[x].indexOf('､'))>358){
	if(theMonth==3&&theDate-theDay<25)thetime++
	else if(theMonth==10&&theDate-theDay>24)thetime++
	else if(theMonth>10||theMonth<3)thetime++;
}
document.clock[x].value=(check24(thetime)+ending);
	}
}
setTimeout('GetTime()',1000);
}
function IfZero(num){
if(num>59){num-=60;theoffset++;}
return((num<=9&&num>=0)?('0'+num):num);
}
function check24(hour){
if(hour<0)hour+=24;
return(hour>=24)?hour-24:hour;
}
var d=document;
d.write('<STYLE TYPE="text/css">');
d.write('INPUT{background-color:#FFFFFF; border:0; cursor:hand; height:11px; font-family:Arial; font-size:9px; color:#000000;'+Gheosstyle+'}');
d.write('#map{position:absolute; left:'+GheosLeft+'px; top:'+(8+GheosTop)+'px; visibility:visible};');
for(x=0;x<places.length;x++){
newleft=parseFloat(GheosLeft)+parseFloat(places[x].substring(places[x].indexOf('ｧ')+1,places[x].indexOf('ｧ')+4));
newtop=parseFloat(GheosTop)+parseFloat(places[x].substring(places[x].indexOf('ｧ')+4,places[x].indexOf('､')));
d.write('#t'+x+'{position:absolute; left:'+newleft+'px; top:'+newtop+'px; visibility:visible};');
}
d.write('#equator{position:absolute; left:'+GheosLeft+'px; top:'+(358+GheosTop)+'px; width:900px visibility:visible};');
d.write('#bottom{position:absolute; left:'+GheosLeft+'px; top:'+(538+GheosTop)+'px; visibility:visible};');
d.write('#local{position:absolute; left:'+GheosLeft+'px; top:'+(538+GheosTop)+'px; visibility:visible};');
d.write('</STYLE>');

d.write('<FORM NAME="clock" onSubmit="javascript:linkIt()">');
d.write('<DIV ID="map"><IMG SRC="./timezones.gif"></DIV>');
d.write('<DIV ID="equator"><FONT FACE="Arial" SIZE="1"><HR SIZE="1" WIDTH="900">&nbsp;Equator</FONT></DIV>');
for(x=0;x<places.length;x++){
d.write('<DIV ID="t'+x+'"><IMG SRC="./place.gif" WIDTH="4" HEIGHT="4"><A HREF="javascript:linkIt()" onMouseOver="window.status=\'The time in '+places[x].substring(0,places[x].indexOf('#'))+' is UTC '+places[x].substring(places[x].indexOf('#')+1,places[x].indexOf('ｧ'))+' hours.\';return true" onMouseOut="window.status=\'\';return true"><FONT SIZE="1" FACE="Arial" COLOR="#000000" STYLE="text-decoration:none"> '+places[x].substring(0,places[x].indexOf('#'))+'<BR><INPUT TYPE="text" SIZE="4" READONLY NAME="'+x+'" onBlur="javascript:linkIt()"></B></FONT></A></DIV>');
}
d.write('</FORM>');

d.write('<DIV ID="bottom"><FORM NAME="bar"><TABLE WIDTH="900" HEIGHT="20" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD ALIGN="left" BGCOLOR="#FFFFFF"> <A HREF="http://Gheos.com" onMouseOver="window.status=\'This map is courtesy of Gheos.com.\';return true" onMouseOut="window.status=\'\';return true"><FONT COLOR="#000000" SIZE="2" FACE="Arial" STYLE="text-decoration:none; A:link {color:#0000A0}"><B>World Time Zones&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(C) 2001 Roy Digital Design - <A HREF="http://Gheos.com" onMouseOver="window.status=\'This map is courtesy of Gheos.com.\';return true" onMouseOut="window.status=\'\';return true"><FONT COLOR="#0000FF" STYLE="A:link {color:#0000A0}">Gheos.com</FONT></A></B></FONT></TD><TD BGCOLOR="#FFFFFF" ALIGN="right" WIDTH="40%"><FONT COLOR="#000000" SIZE="1" FACE="Arial"><B>Local Time: <A HREF="javascript:linkIt()" onMouseOver="window.status=\'The local time on your pc is UTC '+localutc+' hours.\';return true" onMouseOut="window.status=\'\';return true"><INPUT TYPE="text" SIZE="4" NAME="local" onBlur="javascript:linkIt()"></A>&nbsp;&nbsp;&nbsp;Universal Time (UTC): <A HREF="javascript:linkIt()" onMouseOver="window.status=\'Universal Time (UTC) = Greenwich Mean Time (GMT).\';return true" onMouseOut="window.status=\'\';return true"><INPUT TYPE="text" SIZE="4" NAME="utc" onBlur="javascript:linkIt()"></B></FONT></A>&nbsp;&nbsp;</TD></TR></TABLE></FORM></DIV>');

setTimeout('GetTime()',1000);