﻿var xmlDoc=null;
var xmlMacau=null;
var xmlCMacau=null;
if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlMacau=new ActiveXObject("Microsoft.XMLDOM");
xmlCMacau=new ActiveXObject("Microsoft.XMLDOM");

}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
xmlMacau=document.implementation.createDocument("","",null);
xmlCMacau=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}

if (xmlDoc!=null & xmlMacau!=null & xmlCMacau!=null)
{ 
xmlDoc.async=false;
xmlMacau.async=false;
xmlCMacau.async=false;
xmlDoc.load("../weather/weather.data.xml");
xmlMacau.load("../weather/macau.xml");
xmlCMacau.load("../weather/currentmacau.xml");
time=xmlDoc.getElementsByTagName("LastUpdateTime")[0];
time1=time.childNodes[0];
time2 = time1.nodeValue.substring(11,13);

if (time2 > 11)
{
<!----------Day 1 ----------->
date=xmlDoc.getElementsByTagName("LastUpdateTime")[0];
date1=date.childNodes[0];
year=date1.nodeValue.substring(0,4);
month=date1.nodeValue.substring(5,7);
day=date1.nodeValue.substring(8,10);

icon=xmlDoc.getElementsByTagName("LocalWeatherForecast")[0];
icon1=icon.getElementsByTagName("WeatherIcon")[0];
icon2=icon1.getElementsByTagName("URL")[0];
icon3=icon2.childNodes[0];
hk=icon3.nodeValue.substring(46);

degree=xmlDoc.getElementsByTagName("CurrentWeather")[0];
degree2=degree.getElementsByTagName("Reading")[0];
degree3=degree2.childNodes[0];
degree4=degree3.childNodes[0];
degree5=degree4.nodeValue;
	
micon=xmlCMacau.getElementsByTagName("Icon")[0];
micon1=micon.getElementsByTagName("IconName")[0];
micon2=micon1.childNodes[0];
macau=micon2.nodeValue;

mtempuu=xmlCMacau.getElementsByTagName("Temperature")[0];
mtempu=mtempuu.getElementsByTagName("Value")[0];
mtempu1=mtempu.childNodes[0];
mtempu2=mtempu1.nodeValue;


}


else

{
	
<!----------Day 1 ----------->
date=xmlDoc.getElementsByTagName("LastUpdateTime")[0];
date1=date.childNodes[0];
year=date1.nodeValue.substring(0,4);
month=date1.nodeValue.substring(5,7);
day=date1.nodeValue.substring(8,10);

icon=xmlDoc.getElementsByTagName("LocalWeatherForecast")[0];
icon1=icon.getElementsByTagName("WeatherIcon")[0];
icon2=icon1.getElementsByTagName("URL")[0];
icon3=icon2.childNodes[0];
hk=icon3.nodeValue.substring(46);

degree=xmlDoc.getElementsByTagName("CurrentWeather")[0];
degree2=degree.getElementsByTagName("Reading")[0];
degree3=degree2.childNodes[0];
degree4=degree3.childNodes[0];
degree5=degree4.nodeValue;
	
micon=xmlCMacau.getElementsByTagName("Icon")[0];
micon1=micon.getElementsByTagName("IconName")[0];
micon2=micon1.childNodes[0];
macau=micon2.nodeValue;

mtempuu=xmlCMacau.getElementsByTagName("Temperature")[0];
mtempu=mtempuu.getElementsByTagName("Value")[0];
mtempu1=mtempu.childNodes[0];
mtempu2=mtempu1.nodeValue;
}

document.write("<table width=\"200\" border=\"0\">")
document.write("<tr>")
document.write("<td width=\"7\" rowspan=\"5\"></td>")
document.write("<td colspan=\"2\" class=\"weatherContent\">","<b>", "<u>", "最新香港・マカオの天気", "</b>", "</u>", "</td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td colspan=\"2\" class=\"weatherContent\">", year,"-", month,"-", day, "</td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td width=\"92\" class=\"weatherContent\">香港</td>")
document.write("<td width=\"92\" class=\"weatherContent\">マカオ</td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td>","<center><img src=../weather/wicons/",hk, " height=\"30\" width=\"30\" align=\"middle\" ></center>", "</td>")
document.write("<td>","<center><img src=../weather/wicons/",macau, " height=\"30\" width=\"30\" align=\"middle\" ></center>", "</td>")
document.write("</tr>")
document.write("<tr>")
document.write("<td class=\"weatherContent\">", "<img src=../weather/wicons/theromo.gif align=\"bottom\" >", " ",degree5,"°C", "</td>")
document.write("<td class=\"weatherContent\">", "<img src=../weather/wicons/theromo.gif align=\"bottom\" >", " ",mtempu2,"°C", "</td>")
document.write("</tr>")
document.write("</table>")





}