/*
	Copyright © Eleanor CMS
	URL: http://eleanor-cms.ru, http://eleanor-cms.com
	E-mail: support@eleanor-cms.ru
	Developing: Alexander Sunvas*
	Interface: Rumin Sergey
	=====
	*Pseudonym
*/

function Rating(module,control,id,marks,event,addon)
{	$(control).click(function(){		var mark=prompt("Введите свою оценку. Доступные варианты: "+marks.join(",")),
			th=this;
		if(!mark || $.inArray(parseInt(mark),marks)==-1)
			return false;
		CORE.Ajax(
				$.extend({						module:module,						event:event,
						rating:{
							id:id,
							mark:mark
						}					},addon),
				function(res)
				{					$(th).replaceWith($('<span>').attr("title",res["title"]).html(res["average"]).attr("style",$(th).attr("style")));				}
		);
		return false;	})}
