function ratings_toggle(){
	// todo: optimize this script and markup
	var parent = $(this).parents(".b-rating-main");
	$("ul", parent).hide(); // hide all blocks
	$(".s-" + this.className.split("-")[2], parent).show(); // show needed block
	$(".title", $(this).parent()).hide(); // hide all control "title" spans
	$("a", $(this).parent()).show(); // show all control links
	$(this).hide(); // hide clicked link
	$(this).next().show(); // show "title" span instead of clicked link
	return false;
}

$(function(){
	$(".b-rating-main [class^='s-trigger']").click(ratings_toggle);

	
});

/* Yandex sitesearch search form script */
(function(Lego){ if (!Lego) Lego = window.Lego = {}; Lego.clean = function(a) { var p = a.previousSibling; if (p) { a.onblur = function() { if (!a.value) { p.style.top = ""; } }; p.style.top = "-9999px"; } }; Lego.cleanIfNotEmpty = function(ids) { var e = []; for (var i = 0; i < ids.length; i++) { e[i] = document.getElementById(ids[i]); }; var f = function() { for (var i = 0; i < e.length; i++) { if (e[i].value) { Lego.clean(e[i]); } } }; setInterval(f, 100); }; })(window.Lego);


function comm_add()
{
	$('#comment_id').val('0');
	$('#comm_add_title').html('Добавление комментария');
	$('#comm_text').val('');
	$('#comm_submit').val('Добавить');
}

function comm_edit(id)
{
	if($('#comm_text_'+id).length > 0)
	{
		$('#comment_id').val(id);
		$('#comm_add_title').html('Редактирование комментария');
		$('#comm_text').val($('#comm_text_'+id).html());
		$('#comm_submit').val('Сохранить');
		$('#canca').hide();
		$('#subf').val('');
		$('#ans').html('');
	}
}
