var xmlHttp1;

function fetchWeatherFeed(ct) {

    if (ct.length==0) {
        document.getElementById("loadData").style.display = 'none';
        document.getElementById("weatherData").innerHTML = '';
        document.getElementById("weatherData").style.display = 'none';
        return;
    }

    xmlHttp1=GetXmlHttpObject1();
    if (xmlHttp1==null) {
        alert("Ο φυλλομετρητής σας δεν υποστηρίζει την τεχνολογία AJAX!");
        document.getElementById("loadData").style.display = 'block';
        document.getElementById("weatherData").style.display = 'none';
        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("loadData").style.display = 'none';
        document.getElementById("weatherData").style.display = 'block';
        document.getElementById("weatherData").innerHTML = xmlHttp1.responseText;
        //document.getElementById("weatherData").innerHTML = 'hello';
    }
}

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;
}
