// JavaScript Document

var xmlWeather

function getWeather(zip)
{ 
	xmlWeather=GetXmlHttpObject()
	if (xmlWeather==null)
	 {
		 alert ("Browser does not support HTTP Request")
		 return
	 }
	var url="includes/weather.php"
	url=url+"?zip="+zip
	document.getElementById("currentweather").innerHTML= '<p>Loading Weather ...</p>';
	xmlWeather.onreadystatechange=WeatherStateChanged
	xmlWeather.open("GET",url,true)
	xmlWeather.send(null)
}

function WeatherStateChanged() 
{ 
	if (xmlWeather.readyState==4 || xmlWeather.readyState=="complete") { 
	 	document.getElementById("currentweather").innerHTML=xmlWeather.responseText 
	 }
}

function GetXmlHttpObject()
{
	var xmlRequest=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlRequest=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
	 try
	  {
	  xmlRequest=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlRequest=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlRequest;
}
