function update_price(){
    $.ajax({ url: $("form[name='MainForm']").attr('action'),
        data: $("form[name='MainForm']").serialize() + '&btnupdateprice.x=0&btnupdateprice.y=0',
        type: 'POST',
        cache: false,

        success: function (response) {
            var errors = $(response).find("#listOfErrorsSpan").html();
            var result = $(response).find(".colors_productprice:eq(0)").html();
            //alert(result);
            if (result == null) return;
            $(".colors_productprice:eq(0)").replaceWith('<font class="colors_productprice">' + result + '</font>');
            $('#listOfErrorsSpan').replaceWith('<span id="listOfErrorsSpan">' + errors + '</span>');
        }
    });
}



$(function () {
    $("select[name^='SELECT___'],input[name^='SELECT___'][type='radio']").each(function () { $(this).change(function () { update_price(); }); });
    $("a[href^='javascript:change_option']").each(function () {
        $(this).click(function () {
            var result_href = $(this).attr('href').match(/\'(.*?)\'/)[1];
            var result_val = $(this).attr('href').match(/\,(.*?)\)/)[1];
            change_option(result_href, result_val);
            update_price();
            return false;
        });
    });
});



