function get_size( sid ) {
    var size = 0;
    if ( sid != '' ) {
        var val = $('#wc_size_'+sid).val();
        if ( !isNaN(val) ) {
            size = parseInt( val );
        }
    }
    return size;
}

function get_color() {
    var st = $('#wc_color option:selected').val();
    if ( !st ) {
        st = 1;
    }
    return +st;
}

function get_st_type( stid ) {
    if ( !stid ) {
        stid = '';
    }
    var st_type = $('input:radio[name=wc_icowind'+stid+']:checked').attr('wi:value');
    return st_type;
}

function is_msk( stid ) {
    if ( !stid ) {
        stid = '';
    }
    var st_type = parseInt( $('input:radio[name=wc_icowind'+stid+']:checked').attr('wi:value') );
    if ( st_type ) {
        st_type = 1;
    }
    return st_type;
}

function get_type() {
    var st = $('#wc_type option:selected').val();
    if ( !st ) {
        st = 0;
    }
    return +st;
}

function get_profile() {
    var profile = $('#wc_profile option:selected').val();
    if ( !profile ) {
        profile = 0;
    }
    return +profile;
}

function check_must_have( vals ) {
    var is = 1;

    if ( !get_type() ) {
        $('#msg-line').text('Не выбран тип стеклопакета!');
        is = 0;
    }
    else {
        if ( !get_profile() ) {
            $('#msg-line').text('Не выбран тип профиля!');
            is = 0;
        }
        else {
            var i = 0;
            for ( i = 1; i <= vals; i++ ) {
                if ( is ) {
                    if ( !get_size(i) ) {
                        $('#msg-line').text('Не задан обязательный размер!');
                        is = 0;
                    }
                }
            }
        }
    }

    return is;
}

function count_st_cost( stid ) {
    var price = st_price[ 'st_'+get_st_type(stid) ][ 'type_'+get_type() ][ 'profile_'+get_profile() ];
    return price;
}

function count_base_cost( st ) {
    var price = base_price[ 'type_'+get_type() ][ 'profile_'+get_profile() ];
    if ( st ) {
        price = 0;
    }
    return price;
}

function get_pd() {
    var v = $('#wc_pod option:selected').val();
    if ( !v ) {
        v = 0;
    }
    return +v;
}

function get_otl() {
    var v = $('#wc_otl option:selected').val();
    if ( !v ) {
        v = 0;
    }
    return +v;
}

function get_otk() {
    var v = $('#wc_otk option:selected').val();
    if ( !v ) {
        v = 0;
    }
    return +v;
}

function get_msk() {
    var v = $('#wc_mosk option:selected').val();
    if ( !v ) {
        v = 0;
    }
    return +v;
}

function get_etage() {
    var v = $('#wc_etage option:selected').val();
    if ( !v ) {
        v = 0;
    }
    return +v;
}

function get_montage() {
    var v = $('#wc_montage option:selected').val();
    if ( !v || ( v == '3') ) {
        v = 0;
    }
    else {
        v = 1;
    }
    return v;
}


