function calculatePrice(calculatorTextBoxId, pricePerGm, foodCostId, siteId, gattung){
	var currencySymbol = '€';
	var currencyCode = '&euro;';

	switch (siteId){
		case 3: currencySymbol = ' £'; currencyCode = '&pound;'; break;
		case 8: currencySymbol = 'zl'; currencyCode = 'z&#x0142;'; break;
		default: currencySymbol = '€'; currencyCode = '&euro;'; break;
	}

	var calculatorTextBox = document.getElementById(calculatorTextBoxId);
	var value = calculatorTextBox.value;
	if(value == null || value.length == 0||isNaN(value)){
		alert("enter only numeric value");
		calculatorTextBox.value = '';
	} else {
		if(pricePerGm != null){
			//change second message
				document.getElementById('calc_second_msg').innerHTML = getLocResource("foodcostcalc.portionCostFor."+gattung, value);
			//Button change
				document.getElementById('btn_calc').style.display = 'none';
				document.getElementById('btn_newcalc').style.display = 'block';

			//change foot note
				document.getElementById('calc_footnote').innerHTML = getLocResource("foodcostcalc.packageSizeNote", null);
			//calc number
			var foodCostValue = value * pricePerGm;

			calculatorTextBox.value = addCommas(foodCostValue.toFixed(2))+' '+currencySymbol;
			//document.getElementById(foodCostId).innerHTML = addCommas(foodCostValue.toFixed(2))+' '+currencyCode ;
		}
	}
}
function addCommas(nStr){
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x[1];
	return x1 + ',' + x2;
}
function submitenter(myfield,e,siteId, gattung, pricePerGm) {
	var keycode;

	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13){
	   calculatePrice('calculatorTextBox', pricePerGm,'foodCost', siteId, gattung);
	   return false;
	} else
	   return true;
}
function resetFoodCalc(calculatorTextBoxId, gattung){
	//change second message
	document.getElementById('calc_second_msg').innerHTML = getLocResource("foodcostcalc.portionCostQuestionFor."+gattung, null);
	//Button change
	document.getElementById('btn_newcalc').style.display = 'none';
	document.getElementById('btn_calc').style.display = 'block';

	//change foot note
	document.getElementById('calc_footnote').innerHTML = getLocResource("foodcostcalc.portionsizeNote", null);
	//calc number
	document.getElementById(calculatorTextBoxId).value = '';
}
