﻿var tbStreet;
var tbCity;

function GetAdresByZipcode(zipcode, tbStreetId, tbCityId) {
    tbStreet = $get(tbStreetId);
    tbCity = $get(tbCityId);
    App_Code.Ajax.GetAdresByZipcode(zipcode, SucceededCallback);
}

function SucceededCallback(result, eventArgs) {
    if(result.length == 2) {
        if(tbStreet.value.length == 0) {
            tbStreet.value = result[0];
        }
        if(tbCity.value.length == 0) {
            tbCity.value = result[1];
        }
    }
}

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
