// JavaScript Document
var tempXML;
var weathericonXML;
var timeXML;
loadtempXML();
function loadtempXML() {
	
	if (window.XMLHttpRequest)
	  {
	  xhttp=new XMLHttpRequest()
	  }
	else
	  {
	  xhttp=new ActiveXObject("Microsoft.XMLHTTP")
	  }
	xhttp.open("GET","xml/temperature.xml",false);
	
	xhttp.send("");
	xmlDoc=xhttp.responseXML;
	
	
	tempXML=xmlDoc.getElementsByTagName("current_conditions")[0].getElementsByTagName("temp_f")[0].attributes.getNamedItem("data").value;
	weathericonXML=xmlDoc.getElementsByTagName("current_conditions")[0].getElementsByTagName("icon")[0].attributes.getNamedItem("data").value;
	timeXML=xmlDoc.getElementsByTagName("forecast_information")[0].getElementsByTagName("current_date_time")[0].attributes.getNamedItem("data").value;
	
	
	
}
function onWeather() {
	var d = new Date();
	var curr_hour = d.getHours();
	var curr_min = d.getMinutes();
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	var curr_date = d.getDate();
	var curr_day = d.getDay();
	var ampm = "AM";
	
	curr_month = curr_month + 1;
	
	if(curr_min == 1){curr_min="01";}
	if(curr_min == 2){curr_min="02";}
	if(curr_min == 3){curr_min="03";}
	if(curr_min == 4){curr_min="04";}
	if(curr_min == 5){curr_min="05";}
	if(curr_min == 6){curr_min="06";}
	if(curr_min == 7){curr_min="07";}
	if(curr_min == 8){curr_min="08";}
	if(curr_min == 9){curr_min="09";}
	
	if(curr_hour == 13){curr_hour=1; ampm="PM"}
	if(curr_hour == 14){curr_hour=2; ampm="PM"}
	if(curr_hour == 15){curr_hour=3; ampm="PM"}
	if(curr_hour == 16){curr_hour=4; ampm="PM"}
	if(curr_hour == 17){curr_hour=5; ampm="PM"}
	if(curr_hour == 18){curr_hour=6; ampm="PM"}
	if(curr_hour == 19){curr_hour=7; ampm="PM"}
	if(curr_hour == 20){curr_hour=8; ampm="PM"}
	if(curr_hour == 21){curr_hour=9; ampm="PM"}
	if(curr_hour == 22){curr_hour=10; ampm="PM"}
	if(curr_hour == 23){curr_hour=11; ampm="PM"}
	if(curr_hour == 24){curr_hour=12; ampm="PM"}
	
	if(curr_month == 1){curr_month="January";}
	if(curr_month == 2){curr_month="February";}
	if(curr_month == 3){curr_month="March";}
	if(curr_month == 4){curr_month="April";}
	if(curr_month == 5){curr_month="May";}
	if(curr_month == 6){curr_month="June";}
	if(curr_month == 7){curr_month="July";}
	if(curr_month == 8){curr_month="August";}
	if(curr_month == 9){curr_month="September";}
	if(curr_month == 10){curr_month="October";}
	if(curr_month == 11){curr_month="November";}
	if(curr_month == 12){curr_month="December";}
	
	if(curr_day == 1){curr_day="Monday";}
	if(curr_day == 2){curr_day="Tuesday";}
	if(curr_day == 3){curr_day="Wednesday";}
	if(curr_day == 4){curr_day="Thursday";}
	if(curr_day == 5){curr_day="Friday";}
	if(curr_day == 6){curr_day="Saturday";}
	if(curr_day == 7){curr_day="Sunday";}
	
	

	var div = document.getElementById("target1");
	var html = "<span align='center' style='font: arial; color:#135f95; font-size: 1.0em; line-height:10px; padding-left:10px; padding-top:10px;'>" + curr_month + " " + curr_date + " " +curr_hour + ":" + curr_min + ampm +"</span>";// JavaScript Document
  
  	document.getElementById("target1").innerHTML = html;
	//div.innerHTML = html;
	
}

