function getMetar(){
    var icao  = document.getElementById('icao').value;
    var metar = file('http://www.spikesoft.ch/wordpress/wp-content/phpweather/blog.php?icao='+icao);
    document.getElementById('result').innerHTML = metar;
}


function file(file) {
if(window.XMLHttpRequest) // FIREFOX
    xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
    xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else {
    alert("Your navigator does not support XMLHTTPRequest. Please consider using FireFox");
    return(false);
}
xhr_object.open("GET", file, false);
xhr_object.send(null);
if(xhr_object.readyState == 4)
    return(xhr_object.responseText);
else
    return(false);
}

/*Only for debugging*/
function writeConsole(content)
{
    top.consoleRef=window.open('','myconsole',
                                  'width=350,height=250'
                                 +',menubar=0'
                                 +',toolbar=1'
                                 +',status=0'
                                 +',scrollbars=1'
                                 +',resizable=1');
    top.consoleRef.document.writeln(
                                  '<html><head><title>Console</title></head>'
                                 +'<body bgcolor=white onLoad="self.focus()">'
                                 +content
                                 +'</body></html>');
    top.consoleRef.document.close();
}
