fchecked = 0;
podd = 0;
sdec = new Array();
addsw = 0;
function recalc(){	
	addf = 0;
	if (fchecked){
		addf = fru*weight;		
	}
	addsw = 0;
	for (key in sdec)
	  addsw += sdec[key];	
	  
	//alert(weight+"*"+osn_price+"торт + "+addf+"фрукты +("+addsw+") мусор");
	total = weight*osn_price+addf+addsw;
	if (podd)
		podstr = " (залог: "+podd+" руб.)";
	else
		podstr = "";
	document.getElementById("calcsum").innerHTML = "<b>Цена: "+total+" руб. "+podstr+"</b>";
}
function setosn(){
	sel_osn = document.calcform.osnovy.value;	
	osn_price = osn[sel_osn];
	recalc();
}
function setweight(){
	weight = document.calcform.weight.value;
	recalc();
}
function checkfru(e){	
	if (e.checked){
		fchecked ++;
	} else {
		fchecked --;
	}	
	recalc();
}

function recdec (e){	
	price = eval("pr"+e.name);
	count = e.value-1;
	nm = e.name;
	name = nm.substr(nm.indexOf("'")+1,nm.lastIndexOf("'")-nm.indexOf("'")-1);
	sdec[name] = count*price;	
	recalc();
}

function figrec (e){	
	price = eval("pr"+e.name);
	count = e.value-1;
	nm = e.name;
	name = nm.substr(nm.indexOf("'")+1,nm.lastIndexOf("'")-nm.indexOf("'")-1);
	sdec[name] = count*price;	
	recalc();
}
function setpod (e){	
	if (e.checked)
		podd = podstavka;
	else 
		podd = 0;
	recalc();
}