function fncOfferCountry(elem) {

    var strSelectedCountry;

    strSelectedCountry = elem.options[elem.selectedIndex].value;

    document.getElementById('afterCountry').innerHTML = '';

    if (
        strSelectedCountry != ''
    ) {

        document.getElementById('afterCountry').innerHTML = '<img src="/img/ajax-loader.gif" width="16" height="16" border="0" alt="">';

        JsHttpRequest.query(

            '/?s=country_selected',

            {
                'strSelectedCountry': strSelectedCountry
            },

            function(result, errors) {

                var htmlSelect;

                htmlSelect = '';
                if (
                    'ua' == result['strReturnedCountry']
                ) {
                    htmlSelect += 'Выберите регион:<br>';
                } // if
                htmlSelect += '<select';
                if (
                    'ua' == result['strReturnedCountry']
                ) {
                    htmlSelect += ' name="region"';
                    htmlSelect += ' onchange="fncOfferUaRegion(this);"';
                } // if
                else {
                    htmlSelect += ' name="idSettlmnt"';
                } // else
                htmlSelect += ' id="idSettlmntId">';
                if (
                    result['strReturnedCountry'] != 'ua'
                ) {
                    htmlSelect += '<option value="0">-- в списке нет нужного мне --</option>';
                } // if
                for ( var s in result['arrForSelect'] ) {
                    htmlSelect += '<option value="' + result['arrForSelect'][s]['id'] + '"';
                    if (
                        (
                            result['strReturnedCountry'] != 'ua'
                        &&
                            1 == result['arrForSelect'][s]['bool_is_center']
                        )
                    ||
                        (
                            'ua' == result['strReturnedCountry']
                        &&
                            10 == result['arrForSelect'][s]['id']
                        )
                    ) {
                        htmlSelect += ' selected';
                    } // if
                    htmlSelect += '>' + result['arrForSelect'][s]['name'] + '</option>';
                } // for
                if (
                    result['strReturnedCountry'] != 'ua'
                ) {
                    htmlSelect += '<option value="0">-- в списке нет нужного мне --</option>';
                } // if
                htmlSelect += '</select>';

                if (
                    result['strReturnedCountry'] != 'ua'
                ) {
                    htmlSelect += '<input type="hidden" name="region" value="cntr_' + result['strReturnedCountry'] + '">';
                    htmlSelect += '<p><input id="idSettlmntSbm" type="submit" value="Дальше" class="btm_gray"></p>';
                } // if

                htmlSelect += '<span id="afterUaReg"></span>';

                document.getElementById('afterCountry').innerHTML = '<br>' + htmlSelect;

                if (
                    'ua' == result['strReturnedCountry']
                ) {
                    fncOfferUaRegion( document.getElementById('idSettlmntId') );
                } // if

            },

            true

        );

    } // if

} // function
