function setup() {
	normalColor = "999999";
	normalBGColor = "FFFFFF";
	normalColorText= "525252";
	highlightColor = "99CC66";
	highlightBGColor = "99CC66";
	returnTag = true;
}

function looper() {
	for (i = 0; i < fieldArray.length; i++) {
		if (document.f[fieldArray[i]].value == "") {
			if (fieldArray[i] == "CountyID" || fieldArray[i] == "ProductTypeID" || fieldArray[i] == "Rating") {
				document.getElementById(fieldArray[i]).style.color = '#' + highlightColor;
			} else {
				document.getElementById(fieldArray[i]).style.backgroundColor = '#' + highlightBGColor;
			}
			returnTag = false;
		} else {
			if (fieldArray[i] == "CountyID" || fieldArray[i] == "ProductTypeID" || fieldArray[i] == "Rating") {
				document.getElementById(fieldArray[i]).style.color = "#" + normalColorText;
			} else {
				document.getElementById(fieldArray[i]).style.backgroundColor = '#' + normalBGColor;
			}
		}
	}
}

function checkform_UserLogin() {
	return true;
}

function checkform_UserCreate(UserType) {
	setup();
	
	if (UserType == "friend") {
		// Food friend
		fieldArray = new Array("UserName","UserEmail","UserPassword","CountyID","UserPostcode");
		fieldArrayDisplay = new Array("Name","Email address","Password","County","Postcode");
	} else {
		// Food producer
		fieldArray = new Array("UserName","UserEmail","UserPassword","UserDisplayName","UserAddress","CountyID","UserPostcode");
		fieldArrayDisplay = new Array("Name","Email address","Password","A name to be listed as","Address","County","Postcode");
	}
	
	looper();

	return returnTag;
}

function checkform_RatingCreate() {
	setup();
	
	fieldArray = new Array("CommentName","Rating","CommentDesc");
	fieldArrayDisplay = new Array("Your name","Rating","Comment");
	
	looper();

	return returnTag;
}

function checkform_ProductCreate() {
	setup();
	
	fieldArray = new Array("Description");
	fieldArrayDisplay = new Array("Description");
	
	looper();
	
	// CATCH NEW ENTRIES
	if (document.f.ProductTypeName.value != "") {
		document.getElementById("ProductTypeID").style.color = normalColorText;
	} else {
		fieldArray = new Array("ProductTypeID");
		fieldArrayDisplay = new Array("ProductTypeID");
		
		looper();
	}

	return returnTag;
}