function State() {
    this.name = "";
    this.id = "";
}

function Country() {
    this.states = new Array();
    this.name = "";
    this.id = "";
}

function SellerCountryChange(countryBoxID, stateBoxID, stateTextID) {
    var selectedCountry = _countries[ $('#' + countryBoxID).val() ];
    var stateBox = document.getElementById(stateBoxID);

    emptySelectBox(stateBox);

    for (var sKey in selectedCountry.states) {
        var state = selectedCountry.states[sKey];
        stateBox.options[stateBox.options.length] = new Option(state.name, state.id);
    }

    if (stateBox.options.length > 0) {
        $('#' + stateBoxID).show();
        $('#' + stateTextID).hide();        
    } else {
        $('#' + stateBoxID).hide();
        $('#' + stateTextID).show();        
    }
}

function emptySelectBox(box) {
    while (box.options.length > 0) {
        box.options[0] = null;
    }
}
