 function parsepostresult(odpowiedz){
 	$('working').innerHTML = ''; 
 	
 	var ourobject = odpowiedz.responseText.parseJSON();
 	if(ourobject.returnedValue){
 		$('comment_form_result').innerHTML = ourobject.message;
 		$('comment_form').style.display="none";
 	}else{
 		//wystapily bledy
 		$('button_post').disabled=false;
 		$('comment_form_result').innerHTML = ourobject.message;
 	}
 	
 }

function postcomment(){
	working();
    var url = '/comment/addcomment';
    var params = 'product_id='+$F('product_id')+'&user_id='+$F('user_id')+'&order_history_id='+$F('order_history_id')+'&comment='+$F('comment')+'&comment_note='+$F('comment_note');
    var myAjax = new Ajax.Request
                 (
                     url,
                     {
                         method: 'post', 
                         onSuccess: parsepostresult,
                         postBody: params
                     }
                 );
	$('button_post').disabled=true;
}


function working(){
	$('working').innerHTML = '<img src="/images/wait.gif" alt="Loading..." border="0">';
}
