function onSixer(qid) {
	$('#rating-' + qid).fadeTo("slow", 0.33);
	$.getJSON('/vote?qid=' + qid + '&verdict=sixer', function(o) {
		$('#rating-' + qid).text(''+o);
		$('#rating-' + qid).fadeTo("slow", 1.0);
	});
}

function onWicket(qid) {
	$('#rating-' + qid).fadeTo("slow", 0.33);
	$.getJSON('/vote?qid=' + qid + '&verdict=wicket', function(o) {
		$('#rating-' + qid).text(''+o);
		$('#rating-' + qid).fadeTo("slow", 1.0);
	});
}

function onCommentSixer(cid) {
	$('#comment-rating-' + cid).fadeTo("slow", 0.33);
	$.getJSON('/vote?cid=' + cid + '&verdict=sixer', function(o) {
		$('#comment-rating-' + cid).text(''+o);
		$('#comment-rating-' + cid).fadeTo("slow", 1.0);
	});
}

function onCommentWicket(cid) {
	$('#comment-rating-' + cid).fadeTo("slow", 0.33);
	$.getJSON('/vote?cid=' + cid + '&verdict=wicket', function(o) {
		$('#comment-rating-' + cid).text(''+o);
		$('#comment-rating-' + cid).fadeTo("slow", 1.0);
	});
}

function onListSixer(lid) {
	$('#list-rating-positives-' + lid).fadeTo("slow", 0.33);
	$('#list-rating-negatives-' + lid).fadeTo("slow", 0.33);
	$.getJSON('/vote?lid=' + lid + '&verdict=sixer', function(o) {
        $('#list-rating-positives-' + lid).text(''+o['votes'][1]);
		$('#list-rating-positives-' + lid).fadeTo("slow", 1.0);
        $('#list-rating-negatives-' + lid).text(''+o['votes'][2]);
		$('#list-rating-negatives-' + lid).fadeTo("slow", 1.0);
	});
}

function onListWicket(lid) {
	$('#list-rating-positives-' + lid).fadeTo("slow", 0.33);
	$('#list-rating-negatives-' + lid).fadeTo("slow", 0.33);
	$.getJSON('/vote?lid=' + lid + '&verdict=wicket', function(o) {
        $('#list-rating-positives-' + lid).text(''+o['votes'][1]);
		$('#list-rating-positives-' + lid).fadeTo("slow", 1.0);
        $('#list-rating-negatives-' + lid).text(''+o['votes'][2]);
		$('#list-rating-negatives-' + lid).fadeTo("slow", 1.0);
	});
}

function onListItemSixer(liid) {
	$('#item-rating-positives-' + liid).fadeTo("slow", 0.33);
	$('#item-rating-negatives-' + liid).fadeTo("slow", 0.33);
	$.getJSON('/vote?liid=' + liid + '&verdict=sixer', function(o) {
        $('#item-rating-positives-' + liid).text(''+o['votes'][1]);
		$('#item-rating-positives-' + liid).fadeTo("slow", 1.0);
        $('#item-rating-negatives-' + liid).text(''+o['votes'][2]);
		$('#item-rating-negatives-' + liid).fadeTo("slow", 1.0);
	});
}

function onListItemWicket(liid) {
	$('#item-rating-positives-' + liid).fadeTo("slow", 0.33);
	$('#item-rating-negatives-' + liid).fadeTo("slow", 0.33);
	$.getJSON('/vote?liid=' + liid + '&verdict=wicket', function(o) {
        $('#item-rating-positives-' + liid).text(''+o['votes'][1]);
		$('#item-rating-positives-' + liid).fadeTo("slow", 1.0);
        $('#item-rating-negatives-' + liid).text(''+o['votes'][2]);
		$('#item-rating-negatives-' + liid).fadeTo("slow", 1.0);
	});
}

function handleDefaultText(id, defText)	{
	$(id).focus(function()	{
		$(id).toggleClass('focused');
		if ($(id).val() == defText)	{
			$(id).val('');
			$(id).toggleClass('defaultText');
		}
	});
	$(id).blur(function()	{
		$(id).toggleClass('focused');
		if ($(id).val() == '')	{
			$(id).val(defText);
			$(id).toggleClass('defaultText');
		}
	});
}

