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

function init(){
	/*
	if ($('foodcat')!=null){
		['foodcat'].each(function(e){ Event.observe(e,
		'change', ajaxTasteRateByCat.bindAsEventListener()); });
	}
	*/
	if($('foodcat') != null)
		$('foodcat').observe('change', ajaxTasteRateByCat);
	//Event.observe($('comment-form'), 'submit', processCommentForm, false);
}
<!--
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr);
}
//-->

function ajaxTasteRateByCat(){
    var ajaxurl = '/ratewinefoodcategory';
	var formparameters = Form.serialize($("winetaste-foodcat-form"));
	var myAjax = new Ajax.Request(
        ajaxurl,
        { method: 'post', 
          parameters: formparameters, 
          onSuccess: function(req) { 
          	//alert(req.responseText);
			
			}, 
		
          onFailure: function() { growl('Error'); }
        });
}

// This method must always be declared to support the call in mod_comment.php
// It handles page specific display logic after a comment has been added.
function refreshComments(){
    ajaxPagingWineComments('/wine/' + $('wineid').value + '/pagingcomments?refresh');
}

/* Paging wine comments */
function ajaxPagingWineComments(ajaxurl){
    var myAjax = new Ajax.Request(
	ajaxurl,
	{ 	method: 'get', 
	onSuccess: handleWineComments, 
	onFailure: function() {alert('Refresh the Page, something happend to the server');} 
	});
}
	
function handleWineComments(req) {
	if ($('wine-comments-results')!=null){
    	$('wine-comments-results').update(req.responseText);
	}
	if ($('mod_comment')!=null){
		$('mod_comment').show(); 
	}
	if ($('ajaxloader')!=null){
		$('ajaxloader').remove(); // remove the ajax-loader
	}
}
