function getWeatherInfo() {
    if (weatherInfoTimeId !== null) {
        clearTimeout(weatherInfoTimeId);
        weatherRemove();
    }
    var weather = $("#weather").attr("class");

    if (weather.indexOf("road_on") !== -1) {
        var option = {
            url: 'main/getWeatherInfo.do',
            param: {
                LEVEL: level
                , MIN_X: $("#min_x").val()
                , MIN_Y: $("#min_y").val()
                , MAX_X: $("#max_x").val()
                , MAX_Y: $("#max_y").val()
            },
            callback: getWeatherInfoCallback
        };
        callService(option);
        weatherInfoTimeId = setTimeout('getWeatherInfo()', 1000 * 60);
    } else {
        if (weatherInfoWindow !== null) weatherInfoWindow.close();
        weatherRemove();
    }
}

function getWeatherInfoCallback(json) {
    var list = json.data.list;
    if (typeof list === 'undefined') return;
    if (list.length > 0) {
        list.forEach(function (el) {
			if(null === el.ADDR){
				return;
			}
	
            weatherInfoArr.push(new weatherObj(el.ADDR, el.LAT, el.LNG, el.T1H, el.SKY, el.PTY, el.HDONG_CODE, el.PM10_VALUE, el.PM25_VALUE));
            weatherInfoObj[el.HDONG_CODE] = {
                'ADDR': el.ADDR,
                'BASEDATE': el.BASEDATE,
                'BASETIME': el.BASETIME,
                'T1H': el.T1H,
                'SKY': el.SKY,
                'PTY': el.PTY,
                'LAT': el.LAT,
                'LNG': el.LNG
            };
        });
    }
}

function weatherRemove() {
    weatherInfoArr.forEach(function (el) {
        el.weatherOverlay.setMap(null);
    });
    weatherInfoArr = [];
}

