/*var req;

function weather_loadXMLDoc(url) {
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = weather_processReqChange;
        req.open("GET", url, true);
        req.send(null);
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = weather_processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}

function weather_processReqChange() {
    //document.my_forecast.innerHtml = stat(req.readyState);

    var _div;

    _div = document.getElementById('my_forecast');

    _div.innerHTML = weather_stat(req.readyState);

    ab = window.setTimeout("req.abort();", 100000);

    if (req.readyState == 4) {
        clearTimeout(ab);

/*        document.form1.statusnum.value = req.status;
        document.form1.status.value = req.statusText;
*
        // only if "OK"
        if (req.status == 200) {
            _div.innerHTML=req.responseText;
            //alert(req.responseText);
        } else {
            alert("Не удалось получить данные:\n" + req.statusText);
        }
    }
}

function weather_stat(n)
{
  var msg;
  msg = "<br><br><br><br><center><h4>Загрузка прогноза, подождите пожалуйста...</h4><img src=/images/ajax-loader.gif></center><br><br><br><br>&nbsp;";
  switch (n) {
    case 0:
      return "не инициализирован";
    break;

    case 1:
      return msg;
    break;

    case 2:
      return msg;
    break;

    case 3:
      return msg;
    break;

    case 4:
      return "готово";
    break;

    default:
      return "неизвестное состояние";
  }
}

function weather_requestdata(params)
{
  weather_loadXMLDoc('/forecast.php?HTTPrequest=1'+params);
}

function OnCountryCheange(elem) {
    weather_requestdata('&country=' + elem.value);
}

function OnRegionCheange(elem) {
    var country;
    country = document.forms.get_weather.country.value;
    weather_requestdata('&country=' + country + '&region=' +elem.value);
}

function OnStationCheange(elem) {
    var country;
    var region;
    country = document.forms.get_weather.country.value;
    if (document.forms.get_weather.region) {
        region = document.forms.get_weather.region.value;
        if (region != 'undefined') {
            region = '&region=' + region;
        } else {
            region = '';
        }
    } else {
        region = '';
    }
    weather_requestdata('&country=' + country + region + '&station=' +elem.value);
}



*/




function set_wait() {
  var msg;
  msg = "<br><br><br><br><center><h4>Загрузка прогноза, подождите пожалуйста...</h4><img src=/images/ajax-loader.gif></center><br><br><br><br>&nbsp;";
  $("#my_forecast").html(msg);
}

function OnCountryCheange(elem) {
    set_wait();
    $.get("/forecast.php", {HTTPrequest: '1', country: elem.value}, function(data){
		$("#my_forecast").html(data);
    });

}

function OnRegionCheange(elem) {
    var country;
    country = document.forms.get_weather.country.value;
    set_wait();
    $.get("/forecast.php", {HTTPrequest: '1', country: country, region: elem.value}, function(data){
		$("#my_forecast").html(data);
    });

}

function OnStationCheange(elem) {
    var country;
    var region;
    country = document.forms.get_weather.country.value;
    if (document.forms.get_weather.region) {
        region = document.forms.get_weather.region.value;
        if (region != 'undefined') {
            region = region;
        } else {
            region = '';
        }
    } else {
        region = '';
    }

    set_wait();
    $.get("/forecast.php", {HTTPrequest: '1', country: country, region: region, station: elem.value}, function(data){
		$("#my_forecast").html(data);
    });

}