function trim(value)
{
	//Takes any spaces at the front of the string (^)
	//or (’|') at the end of the string ($)
	//and replaces them with an empty string
	var strValue = value.replace(/^\s+|\s+$/,'');
	return strValue;
}

function checkNomineeVotes()
{
	var isChecked = false;
	var checkedValue = '';

	for (i=0; i<document.frmNominees.nomineeID.length; i++)
	{
		if (document.frmNominees.nomineeID[i].checked==true)
		{
			checkedValue = document.frmNominees.nomineeID[i].value;
			isChecked = true;
		}
	}

	if (isChecked)
	{
		if (checkedValue == "custom")
		{
			if ((trim(document.frmNominees.customName.value)=="Type your nominee here!")||(trim(document.frmNominees.customName.value)==""))
			{
				alert("Please enter your custom nominee.");
				isChecked = false;
			}
		}
	}
	else
	{
		alert("Please select a nominee.");
	}

	return isChecked;
}

function validateLogin()
{
	if (trim(document.formReg.username.value)=="")
	{
		alert("Please fill out your username.");
		return false;
	}
	if (trim(document.formReg.password.value)=="")
	{
		alert("You did not enter a password.");
		return false;
	}
	return true;
}
