scoredArray = new Array();
scoredNum = 0;


function scoreBelief(direction, id, currentScore) {
	doScore = true;
	for (n=0; n<scoredArray.length; n++) {
		if (id == scoredArray[n]) {
			doScore = false;
		}
	}
	if (doScore) {
		if (direction == "upn") {
			otherDirection = "downn";
			blankimg = "blankn";
		} else if (direction == "uph") {
			otherDirection = "downh";
			blankimg = "blankh";
		} else if (direction == "downn") {
			otherDirection = "upn";
			blankimg = "blankn";
		} else if (direction == "downh") {
			otherDirection = "uph";
			blankimg = "blankh";
		}
		document.images[direction + "_" + id].src = "rate.php?id=" + id + "&direction=" + direction;
		document.images[otherDirection + "_" + id].src = "images/score/" + blankimg + ".gif";
		
		scoredArray[scoredNum] = id;
		scoredNum ++;
	} else {
		alert("You have already rated this belief.");
	}	
}


function clearText() {
	if (document.forms['search_form'].query.value == "enter text") {
		document.forms['search_form'].query.value = "";
	}	
}

function checkValue(elementValue, errorMsg) {
	if (elementValue == "") {
		alert(errorMsg);
		return false;	
	} else {
		return true;
	}
}

function anon() {
	alert("This belief was submitted anonymously.");
}