Event.observe(window, 'load', init, false);

function init(){
	if ($('portion')!=null){
		['portion'].each(function(e){ Event.observe(e,
		'change', updatePortions.bindAsEventListener()); });
	}
}

<!--
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr);
}

function refreshComments(){
    ajaxPagingFoodComments('/food/' + $('dishid').value + '/pagingcomments?refresh');
}

/* Paging food comments */
function ajaxPagingFoodComments(ajaxurl){
    var myAjax = new Ajax.Request(
	ajaxurl,
	{ 	method: 'get',
	onSuccess: handleFoodComments,
	onFailure: function() {alert('Refresh the Page, something happend to the server');}
	});
}

function handleFoodComments(req) {
	if ($('food-comments-results')!=null){
		$('food-comments-results').update(req.responseText);
	}
	if ($('mod_comment')!=null){
		$('mod_comment').show(); 
	}
	if ($('ajaxloader')!=null){
		$('ajaxloader').remove(); // remove the ajax-loader
	}
}

/* Start Portion calculation logic */
function updatePortions() {
	var portionmutiple = $('portion').value/$('baseportion').value;
	// Fetch all volume label values
 	var elems = $('mod_food').getElementsByClassName('ingredient-volume'); 
	// Calculate all new volume values
	for (var index = 0; index < elems.length; ++index) {   
		var item = elems[index];  
		item.update($('base'+item.id).value*portionmutiple);
	} 
	
}
/* End Portion calculation logic */