function verify_rate_form()
{
	var how_well_checked = document.rate.how_well[0].checked || document.rate.how_well[1].checked || document.rate.how_well[2].checked || document.rate.how_well[3].checked || document.rate.how_well[4].checked;
	var agreeability_checked = document.rate.agreeability[0].checked || document.rate.agreeability[1].checked || document.rate.agreeability[2].checked || document.rate.agreeability[3].checked || document.rate.agreeability[4].checked;
	var affordability_checked = document.rate.affordability[0].checked || document.rate.affordability[1].checked || document.rate.affordability[2].checked || document.rate.affordability[3].checked || document.rate.affordability[4].checked;
	if(!how_well_checked || !agreeability_checked || !affordability_checked)
	{
		alert('Please enter the required fields, and check for accuracy before submitting.');
		return false;
	}
	else
		return true;
}

var reviews_counts = new Array();

function reviews_load(cid, good, bad) {
	reviews_counts[cid] = new Array(good, bad);
}

function reviews_save(cid, is_good) {
	var url = '/reviews_save.php?cid=' + cid + '&good=' + (is_good ? 1 : 0);

	if (window.XMLHttpRequest) {
		var req = new XMLHttpRequest();
		req.open("GET", url, true);
		req.send(null);
	} else if (window.ActiveXObject) {
		var req = new ActiveXObject("Microsoft.XMLHTTP");
		req.open("GET", url, true);
		req.send();
	}
}

function reviews_click(cid, is_good) {
	if (reviews_counts[cid] == undefined) {
		reviews_counts[cid] = new Array(0, 0);
	}

	reviews_counts[cid][is_good ? 0 : 1]++;
	reviews_save(cid, is_good);
	reviews_refresh(cid);
}

function reviews_refresh(cid) {
	document.getElementById('reviews_counts_' + cid).innerHTML = reviews_counts[cid][0] + ' of ' + (reviews_counts[cid][0] + reviews_counts[cid][1]) + ' visitors found the following comment helpful.';
	document.getElementById('reviews_panel_' + cid).innerHTML = '<b>Saved</b>. We appreciate your feedback.';
}

function reviews_confirm_inappropriate(cid) {
	window.open('http://www.acne.org/reviews_report.php?action=ask&cid=' + cid,
				'reviews_confirm_inappropriate_window',
				'menubar=no,location=no,directories=no,scrollbars=no,resizable=no,status=no,toolbar=no,outerHeight=290,outerWidth=450,width=450 height=290');
}