/**
 * Use this ScriptDoc file to manage the documentation for the corresponding namespace in your JavaScript library.
 *
 * @author zelant
 */

var komunikat = new Array();

function loading(){
	$(".flash").text("Wysyłanie danych ...");
}

function after(){		
	if (komunikat[0]) {
		$(".flash").text(komunikat[0]);
		if (komunikat[2]) {
			// błąd
		}

	} else $(".flash").text('Wystąpił błąd');
	
	if(komunikat[1] || komunikat[2]) {
		$('.star').unbind();
		$('.star').addClass('star_readonly');
		if(komunikat[1]) $(".average").html('&nbsp;&nbsp;<b>'+komunikat[1]+'</b>');
	}
	
}
		
$(function(){
 $('.auto-submit-star').rating({
  callback: function(value, link){
   $.ajax({
		type: "GET",
		url: "index.php?url=vechicles/rate/"+id+"/"+value,
		dataType: "script",
		cache: true,
		async: false,
		beforeSend: loading,
		complete: after
	});
  }
 });
});	

