var xmlHttp1;

function fetchWeatherFeed(ct) {

    if (ct.length==0) { 
        document.getElementById("cityWeather").innerHTML="";
        return;
    }

    xmlHttp1=GetXmlHttpObject1();
    if (xmlHttp1==null) {
        alert("Your browser does not support AJAX");
        return;
    } 

    var url="/feeds/weather.asp";
    url=url+"?city="+escape(ct);
    url=url+"&sid="+Math.random();

    xmlHttp1.onreadystatechange=stateChanged1;
    xmlHttp1.open("GET",url,true);
    xmlHttp1.send(null);
} 

function stateChanged1() { 
    if (xmlHttp1.readyState==4) {
        document.getElementById("weatherLoader").style.display = 'none';
        document.getElementById("cityWeather").style.display = 'block';
        document.getElementById("cityWeather").innerHTML = xmlHttp1.responseText;
    }
}

function GetXmlHttpObject1() {
    var xmlHttp1=null;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp1=new XMLHttpRequest();
    } catch (e) {
        // Internet Explorer
        try {
            xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp1;
}
