function vote(id, val, el) {
	JsHttpRequest.query(
		'vote.php',
		{ 'id': id, 'val': val },
		function(result, errors) {
			var td;
			if(errors != '') {
				alert(errors);
				return;
			}

			td = document.getElementById('v' + id);
			td.childNodes[2].innerHTML = result.rate;
		},
		false
	);
}

function v(el, i) {
	el.style.backgroundColor='#d0d0d0';

	el.firstChild.title = 'Нравится!';
	el.firstChild.onclick = function() { vote(i, 1, el); }

	el.lastChild.title = 'Не смешно!';
	el.lastChild.onclick = function() { vote(i, -1, el); }
}

function x(el) {
	el.style.backgroundColor='#fff';
}



		function sel(i) {
			var prev_aid, el;

			if(i == 0) return false;

			prev_aid = parseInt(document.f.aid.value);

			if(prev_aid > 0) {
				el = document.getElementById('s' + prev_aid);
				el.style.backgroundColor = '#fff';
			}

			el = document.getElementById('s' + i);
			el.style.backgroundColor = '#000';

			document.f.aid.value = i;

			document.f.subm.disabled = false;

			return false;
		}
