function WeatherInfo_current() { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET","http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&type=accurate&mode=xml&units=metric",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; htmltext = "

" + " Current Weather

"; mainmenu.innerHTML = htmltext; } function WeatherInfo() { var htmltext = "

Weather Forecast

"; htmltext += "\n\n" xmlhttp=new XMLHttpRequest(); xmlhttp.open('GET','http://api.openweathermap.org/data/2.5/forecast/daily?q=' + city + '&type=accurate&mode=xml&units=metric&cnt=7',false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; try { var x=xmlDoc.getElementsByTagName("time"); htmltext += ""; var date = new Date(); var y = date.getDay(); for (var i=0;i"; y++;if (y > 6) {y = 0} ; } htmltext += ""; htmltext += ""; for (var i=0;i"; } htmltext += ""; htmltext += ""; for (var i=0;i"; } htmltext += ""; htmltext += ""; for (var i=0;i"; } htmltext += ""; htmltext += ""; for (var i=0;i"; } htmltext += ""; htmltext += ""; for (var i=0;i"; } htmltext += ""; } htmltext += ""; htmltext += ""; for (var i=0;i"; } htmltext += ""; htmltext += "


"; var x=xmlDoc.getElementsByTagName("location"); htmltext += ""; htmltext += "
"; htmltext += "Location"; htmltext += " : "; htmltext += x[0].getElementsByTagName("name")[0].childNodes[0].nodeValue; htmltext += "," + x[0].getElementsByTagName("country")[0].childNodes[0].nodeValue; htmltext += "
"; htmltext += "latitude"; htmltext += " : "; htmltext += x[0].getElementsByTagName("location")[0].getAttribute('latitude'); htmltext += "
"; htmltext += "longitude"; htmltext += " : "; htmltext += x[0].getElementsByTagName("location")[0].getAttribute('longitude'); htmltext += "
"; htmltext += "Sun rise"; htmltext += " : "; htmltext += Right(xmlDoc.getElementsByTagName("sun")[0].getAttribute('rise'),8); htmltext += "
"; htmltext += "Sun set"; htmltext += " : "; htmltext += Right(xmlDoc.getElementsByTagName("sun")[0].getAttribute('set'),8); htmltext += "
"; } catch(e) { htmltext = "

\n\n\n" + Lang[67] + "\n\n\n

"; alert(e); } mainmenu.innerHTML = htmltext; }