function checkRegisterPassword()
{
	var form = document.logon;
	var returnValue = false;
	if (form.txtOldPassword.value == "")
	{
		alert("Please enter your old password");
		form.txtOldPassword.focus();
	}
	else if (form.txtNewPassword.value == "")
	{
		alert("Please enter your new password");
		form.txtNewPassword.focus();
	}
	else if (form.txtConfirmPassword.value == "")
	{
		alert("Please confirm your new password");
		form.txtConfirmPassword.focus();
	}
	else if (form.txtNewPassword.value != form.txtConfirmPassword.value)
	{
		alert("The passwords are not the same");
		form.txtNewPassword.focus();
		form.txtNewPassword.select();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}

function checkFormRegister() {
	var form = document.register;
	var returnValue = false;
	if (form.txtEmail1.value == "")
	{
		alert("Please enter your email address");
		form.txtEmail1.focus();
	}
	else if (form.txtEmail2.value == "")
	{
		alert("Please confirm your email address");
		form.txtEmail2.focus();
	}
	else if (form.txtPostcode.value == "")
	{
		alert("Please enter your Postcode");
		form.txtPostcode.focus();
	}
	else if (form.txtFirstName.value == "")
	{
		alert("Please enter your first name");
		form.txtFirstName.focus();
	}
	else if (form.txtLastName.value == "")
	{
		alert("Please enter your last name");
		form.txtLastName.focus();
	}
	else if (form.txtEmail1.value != form.txtEmail2.value)
	{
		alert("Your emails are not the same");
		form.txtEmail1.focus();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}

function checkFormLogon()
{
	var form = document.logon;
	var returnValue = false;
	if (form.txtEmail.value == "")
	{
		alert("Please enter your email address");
		form.txtEmail.focus();
	}
	else if (form.txtPassword.value == "")
	{
		alert("Please enter your password");
		form.txtPassword.focus();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}

function checkFormPassword()
{
	var form = document.forgot;
	var returnValue = false;
	if (form.txtEmail.value == "")
	{
		alert("Please enter your email address");
		form.txtEmail.focus();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}

function checkFormContact()
{
	var form = document.message;
	var returnValue = false;
	if (form.txtEmail.value == "")
	{
	alert("Please enter an email address")
	form.txtEmail.focus();
	}
	else if (form.txtMessage.value == "")
	{
	alert("Please enter a message")
	form.txtMessage.focus();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}

function goBack()
{
history.go(-1);
}

function goCancelAddQuestionnaire() {
	window.location.href="questionnaire.php";
	}

function checkAddQuestionnaire() {
	var form = document.questionnaire;
	var returnValue = false;
	if (form.txtTitle.value == "")
	{
	alert("Please enter a title for the questionnaire")
	form.txtTitle.focus();
	}
	else if (form.txtDescription.value == "")
	{
	alert("Please enter a description for the questionnaire")
	form.txtDescription.focus();
	}
	else if (form.txtNoSections.value == "")
	{
	alert("Please enter the number of sections")
	form.txtNoSections.focus();
	}
	else if (form.txtCloseDate.value == "")
	{
	alert("Please enter the closing date for questionnaire")
	form.txtCloseDate.focus();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}

function swapImage(obj)
{
	document.map.src=obj;
}

function changeColor(pl, col)	
{
	document.getElementById(pl).style.color = col;
	document.getElementById(pl).style.color = col;
}

function checkFormDogShow()
{
	var form = document.dogshow;
	var returnValue = false;
	if (form.txtBreed.value == "")
	{
		alert("Please enter the breed of the dog");
		form.txtBreed.focus();
	}
	else if (form.txtAddress.value == "")
	{
		alert("Please enter your address and contact number");
		form.txtAddress.focus();
	}
	else if (form.txtDogName.value == "")
	{
		alert("Please enter the name of the dog");
		form.txtDogName.focus();
	}
	else if (form.txtDogAge.value == "")
	{
		alert("Please enter the age of your dog");
		form.txtDogAge.focus();
	}
	else if (form.txtAddress.value == "")
	{
		alert("Please enter your address and contact number");
		form.txtAddress.focus();
	}
	else
	{
		returnValue = true;
	}
	return returnValue;
}
