function rateup(id)
{
	new Ajax.Request('/comments/rate.php',{parameters: 'id='+id+'&dir=up', onComplete: function(req) { updaterank(id,req.responseText); }});
}
function ratedown(id)
{
	new Ajax.Request('/comments/rate.php',{parameters: 'id='+id+'&dir=down', onComplete: function(req) { updaterank(id,req.responseText); }});
}
function report(id)
{
	if (registration.user.loggedin)
	{
		if (confirm('You can only only report three comments per day.  Report this comment?'))  new Ajax.Request('/comments/report.php', {parameters: 'id='+id, onComplete: function(req) { updatereport(id, req.responseText); }});
	}
	else  registration.sp('<p>You must <a href="javascript:registration.login()">login</a> or <a href="javascript:registration.register()">register</a> to report comments.  Registration is free.</p>');
}
function ignore(uid)
{
	new Ajax.Request('/comments/ignore.php',{parameters: 'uid='+uid, onComplete: function(req) { window.location.reload(true); }});
}
function unignore(uid)
{
	new Ajax.Request('/comments/unignore.php',{parameters: 'uid='+uid, onComplete: function(req) { window.location.reload(true); }});
}
function updaterank(id,hdr)
{
	$('cscore'+id).innerHTML=hdr;
}
function updatereport(id, hdr)
{
	$('crater' + id).innerHTML = hdr;
}
function ctoggle(id)
{
	if ($('cbody'+id).className=="bad")
	{
		$('cbody'+id).className="";
		$('ctoggler'+id).innerHTML="Hide Comment";
	}
	else
	{
		$('cbody'+id).className="bad";
		$('ctoggler'+id).innerHTML="View Comment";
	}
}
