function calc(op)
{
    var sGet = '';
    var width = $('#width').val();
    if (op == 'add') sGet += '?width=' + width;
    var height = $('#height').val();
    if (op == 'add') sGet += '&height=' + height;
    var color = $('input:checked[name="color"]').val();
    if (op == 'add') sGet += '&color=' + color;
    var cam = $('input:checked[name="steklo"]').val();
    if (op == 'add') sGet += '&cam=' + cam;
    var podok = $('#podok').val();
    if (op == 'add') sGet += '&podok=' + podok;
    var vodootliv = $('#vodootliv').val();
    if (op == 'add') sGet += '&vodootliv=' + vodootliv;
    var mikroprov = $('input:checked[name="mikroprov"]').val();
    if (op == 'add') sGet += '&mikroprov=' + mikroprov;
    var grebenka = $('input:checked[name="grebenka"]').val();
    if (op == 'add') sGet += '&grebenka=' + grebenka;
    var childlock = $('input:checked[name="childlock"]').val();
    if (op == 'add') sGet += '&childlock=' + childlock;
    var dostavka = $('input:checked[name="dostavka"]').val();
    if (op == 'add') sGet += '&dostavka=' + dostavka;
    var ustanovka = $('input:checked[name="ustanovka"]').val();
    if (op == 'add') sGet += '&ustanovka=' + ustanovka;
    var otkos_type = $('input:checked[name="otkos_type"]').val();
    if (op == 'add') sGet += '&otkos_type=' + otkos_type;
    var setka = $('input:checked[name="setka"]').val();
    if (op == 'add') sGet += '&setka=' + setka;
    var garbage = $('input:checked[name="garbage"]').val();
    if (op == 'add') sGet += '&garbage=' + garbage;
    var quant = $('#quant').val();
    if (op == 'add') sGet += '&quant=' + quant;

	if (otkos_type == 'gp') {
		$('#otkos_gp').show();
		$('#otkos_sp').hide();
		var otkos = $('#otkos_gp').val();
		if (op == 'add') sGet += '&otkos=' + otkos;
	} else if (otkos_type == 'sp') {
		$('#otkos_sp').show();
		$('#otkos_gp').hide();
		var otkos = $('#otkos_sp').val();
		if (op == 'add') sGet += '&otkos=' + otkos;
	} else {
		$('#otkos_sp').hide();
		$('#otkos_gp').hide();
		var otkos = 0;
	}

    if (setkadims[height][width]) {
        $('#setka_container').show();
    } else {
        $('#setka_container').hide();
    }
    var price = 0;
    price += dims[height][width][color][cam];
    if (podok == 1) price += podoks[podok]*(width/1000);
    if (vodootliv == 1) price += vodootlivs[vodootliv]*(width/1000);
	if (mikroprov == 1) price += mikroprovs;
	if (grebenka == 1) price += grebenkas;
	if (childlock == 1) price += childlocks;
	if (dostavka == 1) price += dostavkas;
	if (garbage != 0) price += garbages[garbage];
    if (ustanovka == 1) {
		$('input[name="otkos_type"]').removeAttr('disabled');
		$('input[name="garbage"]').removeAttr('disabled');
        var pl = width*height/1000000;
        for (c = 0; c <= ust.length; c++) {
            if (ust[c] && pl<c) {
                price = price + ust[c];
                break;
            }
        }
		if (otkos) {
			if (otkos_type == 'gp') {
				price += otkosgps[otkos];
			} else if (otkos_type == 'sp') {
				price += otkossps[otkos];
			}
		}
    } else {
        $('input[name="otkos_type"]').attr('disabled', true);
		$('input[name="otkos_type"]').eq(0).attr('checked', true);
		$('input[name="garbage"]').attr('disabled', true);
		$('input[name="garbage"]').eq(0).attr('checked', true);
    }
    if (setka != 0) price += setkadims[height][width];
    price = price * quant;
    price = price - price*0.35;
    price = Math.round(price);
    if (op == 'add') {
        sGet += '&price=' + price;
        var type = document.getElementById('type').value;
        sGet += '&type=' + type;
        loadbasket(sGet);
    } else {
        document.getElementById('price').innerHTML = price;
    }
}
function loadbasket(sGet)
{
    $('#basket').load('/basket.php' + sGet);
}
$(document).ready(function () {
    loadbasket('');
  //  $('#basket').aqFloater({attach: 'ne', duration: 100, opacity: 1});
});

