// Littlehampton Town Council
//
// Date: 11th March 2009. Author Mike Knight
//
var email = "";
var address = "";
var fullname = "";
var postcode = "";
var telephone = "";
var answerQuestion1 = "";
var answerQuestion2 = "";
var answerQuestion3 = "";
var answerQuestion4 = "";
var answerQuestion5 = "";
var answerQuestion6 = "";
var answerQuestion7 = "";
var answerQuestion8 = "";
var answerQuestion9 = "";
var answerQuestion10 = "";
var answerQuestion11 = "";
var bognorDay = "";
var arundelDay = "";
var littlehamptonDay = "";
var bognorMonth = "";
var arundelMonth = "";
var littlehamptonMonth = "";

function GotoFirstPage() {
	window.location = 'surveyPage1.htm';
}
function GotoPage1() {
	WritePage2Cookie();
	window.location = 'surveyPage1.htm';
}
function GotoPage2() {
	WritePage3Cookie();
	window.location = 'surveyPage2.htm';
}
function GotoPage3() {
	WritePage4Cookie();
	window.location = 'surveyPage3.htm';
}
function ValidatePage1() {
	var errorCount = 0;
	
	// Validate Question 1
	var foundError = "N";
	if (document.getElementById("q1_none").checked != 1) {
		if (document.getElementById("q1_bognor").checked != 1) {
			if (document.getElementById("q1_littlehampton").checked != 1) {
				if (document.getElementById("q1_arundel").checked != 1) {
					foundError = "Y";
					errorCount = errorCount + 1;
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question1Message").bgColor = "#FF0000";
		document.getElementById("Question1Message").innerHTML = "<strong>Please select the towns you have visited before</strong>";
	} else {
		if (document.getElementById("q1_none").checked == 1) {
			if (document.getElementById("q1_bognor").checked == 1 || document.getElementById("q1_littlehampton").checked == 1 || document.getElementById("q1_arundel").checked == 1) {
				foundError = "Y";
				errorCount = errorCount + 1;
			}
		}
		if (foundError == "Y") {
			document.getElementById("Question1Message").bgColor = "#FF0000";
			document.getElementById("Question1Message").innerHTML = "<strong>Please select None or one or more of the towns</strong>";
		} else {
			document.getElementById("Question1Message").bgColor = "";
			document.getElementById("Question1Message").innerHTML = "&nbsp;";
		}
	}
	// Make sure Day and Month are selected for Littlehampton
	if (foundError == "N") {
		if ((document.getElementById("q1_arundel").checked == 1 && (document.getElementById("ArundelDay").value == "Select" || document.getElementById("ArundelMonth").value == "Select")) || (document.getElementById("q1_bognor").checked == 1 && (document.getElementById("BognorDay").value == "Select" || document.getElementById("BognorMonth").value == "Select")) || (document.getElementById("q1_littlehampton").checked == 1 && (document.getElementById("LittlehamptonDay").value == "Select" || document.getElementById("LittlehamptonMonth").value == "Select"))) {
			foundError = "Y";
			errorCount = errorCount + 1;
			document.getElementById("Question1Message").bgColor = "#FF0000";
			document.getElementById("Question1Message").innerHTML = "<strong>Please enter the approximate time of your last visit</strong>";
		} else {
			document.getElementById("Question1Message").bgColor = "";
			document.getElementById("Question1Message").innerHTML = "&nbsp;";
		}
	}
	// Validate Question 2
	var foundError = "N";
	if (document.getElementById("q1_none").checked == 1) {
		if (document.getElementById("q2_na").checked != 1) {
			foundError = "Y";
			errorCount = errorCount + 1;
		}
	} else {
		if (document.getElementById("q2_never").checked != 1) {
			if (document.getElementById("q2_1to3times").checked != 1) {
				if (document.getElementById("q2_4plus").checked != 1) {
					foundError = "Y";
					errorCount = errorCount + 1;
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question2Message").bgColor = "#FF0000";
		document.getElementById("Question2Message").innerHTML = "<strong>Please tell us how often you've visited before</strong>";
	} else {
		document.getElementById("Question2Message").bgColor = "";
		document.getElementById("Question2Message").innerHTML = "&nbsp;";
	}

	// Validate Question 4
	var foundError = "N";
	if (document.getElementById("q1_none").checked == 1) {
		if (document.getElementById("q4_yes").checked != 1) {
			if (document.getElementById("q4_no").checked != 1) {
				foundError = "Y";
				errorCount = errorCount + 1;
			}
		}
	} else {
		if (document.getElementById("q4_na").checked != 1) {
			foundError = "Y";
			errorCount = errorCount + 1;
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question4Message").bgColor = "#FF0000";
		document.getElementById("Question4Message").innerHTML = "<strong>Please tell us if you would consider visiting Littlehampton</strong>";
	} else {
		document.getElementById("Question4Message").bgColor = "";
		document.getElementById("Question4Message").innerHTML = "&nbsp;";
	}

	// Checked for errors so time to see whether okay to move to the next page
	if (errorCount == 0) {
		WritePage1Cookie();
		window.location = 'surveyPage2.htm';
	}
}
function ValidatePage2() {
	var errorCount = 0;
	
	// Validate Question 5
	var foundError = "N";
	if (document.getElementById("q5_beach").checked != 1) {
		if (document.getElementById("q5_river").checked != 1) {
			if (document.getElementById("q5_green").checked != 1) {
				if (document.getElementById("q5_retail").checked != 1) {
					if (document.getElementById("q5_other").checked != 1) {
						foundError = "Y";
						errorCount = errorCount + 1;
					}
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question5Message").bgColor = "#FF0000";
		document.getElementById("Question5Message").innerHTML = "<strong>Please tell us what would attract you to Littlehampton</strong>";
	} else {
		document.getElementById("Question5Message").bgColor = "";
		document.getElementById("Question5Message").innerHTML = "&nbsp;";
	}
	
	// Validate Question 6
	var foundError = "N";
	if (document.getElementById("q6_option1").checked != 1) {
		if (document.getElementById("q6_option2").checked != 1) {
			if (document.getElementById("q6_option3").checked != 1) {
				if (document.getElementById("q6_option4").checked != 1) {
					foundError = "Y";
					errorCount = errorCount + 1;
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question6Message").bgColor = "#FF0000";
		document.getElementById("Question6Message").innerHTML = "<strong>Please tell us how long you would consider staying</strong>";
	} else {
		document.getElementById("Question6Message").bgColor = "";
		document.getElementById("Question6Message").innerHTML = "&nbsp;";
	}

	// Validate Question 7
	var foundError = "N";
	if (document.getElementById("q7_option1").checked != 1) {
		if (document.getElementById("q7_option2").checked != 1) {
			if (document.getElementById("q7_option3").checked != 1) {
				foundError = "Y";
				errorCount = errorCount + 1;
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question7Message").bgColor = "#FF0000";
		document.getElementById("Question7Message").innerHTML = "<strong>Please tell us where you will be holidaying this year</strong>";
	} else {
		document.getElementById("Question7Message").bgColor = "";
		document.getElementById("Question7Message").innerHTML = "&nbsp;";
	}

	// Validate Question 8
	var foundError = "N";
	if (document.getElementById("q8_option1").checked != 1) {
		if (document.getElementById("q8_option2").checked != 1) {
			if (document.getElementById("q8_option3").checked != 1) {
				if (document.getElementById("q8_option4").checked != 1) {
					if (document.getElementById("q8_option5").checked != 1) {
						if (document.getElementById("q8_option6").checked != 1) {
							foundError = "Y";
							errorCount = errorCount + 1;
						}
					}
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question8Message").bgColor = "#FF0000";
		document.getElementById("Question8Message").innerHTML = "<strong>Please tell us what you consider important when choosing a holiday</strong>";
	} else {
		document.getElementById("Question8Message").bgColor = "";
		document.getElementById("Question8Message").innerHTML = "&nbsp;";
	}

	// Checked for errors so time to see whether okay to move to the next page
	if (errorCount == 0) {
		// Update the cookie here
		WritePage2Cookie();
		window.location = 'surveyPage3.htm';
	}
}
function ValidatePage3() {
	var errorCount = 0;
	
	// Checked for errors so time to see whether okay to move to the next page
	if (errorCount == 0) {
		// Update the cookie here
		WritePage3Cookie();
		window.location = 'surveyPage4.htm';
	}
}
function ValidatePage4() {
	var errorCount = 0;
	var foundError = "N";
	
	if (document.getElementById("termsAndConditions").checked != 1) {
		foundError = "Y";
		errorCount = errorCount + 1;
	}
	if (foundError == "Y") {
		document.getElementById("Terms").innerHTML="<strong>&nbsp;Please tick the box to show you have understood the</strong>";
	} else {
		document.getElementById("Terms").innerHTML="&nbsp;I have read and understood the";
	}

	// Checked for errors so time to see whether okay to move to the next page
	if (errorCount == 0) {
		// Update the cookie here
		WritePage4Cookie();
		ReadCookie();
		document.getElementById("formEmail").value = email;
		document.getElementById("formAddress").value = address;
		document.getElementById("formPostcode").value = postcode;
		document.getElementById("formFullname").value = fullname;
		document.getElementById("formTelephone").value = telephone;
		document.getElementById("answerQuestion1").value = answerQuestion1;
		document.getElementById("answerQuestion2").value = answerQuestion2;
		document.getElementById("answerQuestion3").value = answerQuestion3;
		document.getElementById("answerQuestion4").value = answerQuestion4;
		document.getElementById("answerQuestion5").value = answerQuestion5;
		document.getElementById("answerQuestion6").value = answerQuestion6;
		document.getElementById("answerQuestion7").value = answerQuestion7;
		document.getElementById("answerQuestion8").value = answerQuestion8;
		document.getElementById("answerQuestion9").value = answerQuestion9;
		document.getElementById("answerQuestion10").value = answerQuestion10;
		document.getElementById("answerQuestion11").value = answerQuestion11;
		document.getElementById("arundelDay").value = arundelDay;
		document.getElementById("arundelMonth").value = arundelMonth;
		document.getElementById("bognorDay").value = bognorDay;
		document.getElementById("bognorMonth").value = bognorMonth;
		document.getElementById("littlehamptonDay").value = littlehamptonDay;
		document.getElementById("littlehamptonMonth").value = littlehamptonMonth;
		window.document.SurveyForm.submit();
	}
}
function WritePage1Cookie() {
	answerQuestion1 = "";
	answerQuestion2 = "";
	answerQuestion3 = "";
	answerQuestion4 = "";
	bognorDay = "";
	arundelDay = "";
	littlehamptonDay = "";
	bognorMonth = "";
	arundelMonth = "";
	littlehamptonMonth = "";

	// Set value for Question 1
	if (document.getElementById("q1_none").checked == 1) { answerQuestion1 = "None"; }
	if (document.getElementById("q1_bognor").checked == 1) {
		if (answerQuestion1 == "") {
			answerQuestion1 = "Bognor Regis";
		} else {
			answerQuestion1 = answerQuestion1 + "|" + "Bognor Regis";
		}
		bognorDay = document.getElementById("BognorDay").value;
		bognorMonth = document.getElementById("BognorMonth").value;
	}
	if (document.getElementById("q1_littlehampton").checked == 1) {
		if (answerQuestion1 == "") {
			answerQuestion1 = "Littlehampton";
		} else {
			answerQuestion1 = answerQuestion1 + "|" + "Littlehampton";
		}
		littlehamptonDay = document.getElementById("LittlehamptonDay").value;
		littlehamptonMonth = document.getElementById("LittlehamptonMonth").value;
	}
	if (document.getElementById("q1_arundel").checked == 1) {
		if (answerQuestion1 == "") {
			answerQuestion1 = "Arundel";
		} else {
			answerQuestion1 = answerQuestion1 + "|" + "Arundel";
		}
		arundelDay = document.getElementById("ArundelDay").value;
		arundelMonth = document.getElementById("ArundelMonth").value;
	}

	// Set value for Question 2
	if (document.getElementById("q2_never").checked == 1) { answerQuestion2 = "Never"; }
	if (document.getElementById("q2_1to3times").checked == 1) { answerQuestion2 = "1-3 times"; }
	if (document.getElementById("q2_4plus").checked == 1) { answerQuestion2 = "4+"; }
	if (document.getElementById("q2_na").checked == 1) { answerQuestion2 = "N/A"; }

	// Set value for Question 4
	if (document.getElementById("q4_yes").checked == 1) { answerQuestion4 = "Yes"; }
	if (document.getElementById("q4_no").checked == 1) { answerQuestion4 = "No"; }
	if (document.getElementById("q4_na").checked == 1) { answerQuestion4 = "N/A"; }
	
	// Time to feed the cookie monster
	document.cookie = "AnswerQuestion1=" + escape(answerQuestion1);
	document.cookie = "AnswerQuestion2=" + escape(answerQuestion2);
	document.cookie = "AnswerQuestion4=" + escape(answerQuestion4);
	document.cookie = "ArundelDay=" + escape(arundelDay);
	document.cookie = "ArundelMonth=" + escape(arundelMonth);
	document.cookie = "BognorDay=" + escape(bognorDay);
	document.cookie = "BognorMonth=" + escape(bognorMonth);
	document.cookie = "LittlehamptonDay=" + escape(littlehamptonDay);
	document.cookie = "LittlehamptonMonth=" + escape(littlehamptonMonth);
}
function WritePage2Cookie() {
	answerQuestion5 = "";
	answerQuestion6 = "";
	answerQuestion7 = "";
	answerQuestion8 = "";
	
	// Set value for Question 5
	if (document.getElementById("q5_beach").checked == 1) { answerQuestion5 = "Beach"; }
	if (document.getElementById("q5_river").checked == 1) {
		if (answerQuestion5 == "") {
			answerQuestion5 = "River";
		} else {
			answerQuestion5 = answerQuestion5 + "|" + "River";
		}
	}
	if (document.getElementById("q5_green").checked == 1) {
		if (answerQuestion5 == "") {
			answerQuestion5 = "Green Spaces";
		} else {
			answerQuestion5 = answerQuestion5 + "|" + "Green Spaces";
		}
	}
	if (document.getElementById("q5_retail").checked == 1) {
		if (answerQuestion5 == "") {
			answerQuestion5 = "Retail";
		} else {
			answerQuestion5 = answerQuestion5 + "|" + "Retail";
		}
	}
	if (document.getElementById("q5_other").checked == 1) {
		if (answerQuestion5 == "") {
			answerQuestion5 = "Other";
		} else {
			answerQuestion5 = answerQuestion5 + "|" + "Other";
		}
	}

	// Set value for Question 6
	if (document.getElementById("q6_option1").checked == 1) { answerQuestion6 = "Day Visit"; }
	if (document.getElementById("q6_option2").checked == 1) { answerQuestion6 = "Overnight"; }
	if (document.getElementById("q6_option3").checked == 1) { answerQuestion6 = "Weekend Break"; }
	if (document.getElementById("q6_option4").checked == 1) { answerQuestion6 = "Week (7 days)"; }

	// Set value for Question 7
	if (document.getElementById("q7_option1").checked == 1) { answerQuestion7 = "Not taking a holiday"; }
	if (document.getElementById("q7_option2").checked == 1) { answerQuestion7 = "UK Resort"; }
	if (document.getElementById("q7_option3").checked == 1) { answerQuestion7 = "Abroad"; }
	
	// Set value for Question 8
	if (document.getElementById("q8_option1").checked == 1) { answerQuestion8 = "Travel Distance"; }
	if (document.getElementById("q8_option2").checked == 1) {
		if (answerQuestion8 == "") {
			answerQuestion8 = "Location";
		} else {
			answerQuestion8 = answerQuestion8 + "|" + "Location";
		}
	}
	if (document.getElementById("q8_option3").checked == 1) {
		if (answerQuestion8 == "") {
			answerQuestion8 = "Attractions";
		} else {
			answerQuestion8 = answerQuestion8 + "|" + "Attractions";
		}
	}
	if (document.getElementById("q8_option4").checked == 1) {
		if (answerQuestion8 == "") {
			answerQuestion8 = "Weather";
		} else {
			answerQuestion8 = answerQuestion8 + "|" + "Weather";
		}
	}
	if (document.getElementById("q8_option5").checked == 1) {
		if (answerQuestion8 == "") {
			answerQuestion8 = "Quality of Accommodation";
		} else {
			answerQuestion8 = answerQuestion8 + "|" + "Quality of Accommodation";
		}
	}
	if (document.getElementById("q8_option6").checked == 1) {
		if (answerQuestion8 == "") {
			answerQuestion8 = "Value";
		} else {
			answerQuestion8 = answerQuestion8 + "|" + "Value";
		}
	}
	
	// Time to feed the cookie monster
	document.cookie = "AnswerQuestion5=" + escape(answerQuestion5);
	document.cookie = "AnswerQuestion6=" + escape(answerQuestion6);
	document.cookie = "AnswerQuestion7=" + escape(answerQuestion7);
	document.cookie = "AnswerQuestion8=" + escape(answerQuestion8);
}
function WritePage3Cookie() {
	answerQuestion9 = "";
	answerQuestion10 = "";
	answerQuestion11 = "";
	
	// Set value for Question 9
	if (document.getElementById("q9_option1").checked == 1) { answerQuestion9 = "Male"; }
	if (document.getElementById("q9_option2").checked == 1) { answerQuestion9 = "Female"; }

	// Set value for Question 10
	if (document.getElementById("q10_option1").checked == 1) { answerQuestion10 = "19-24"; }
	if (document.getElementById("q10_option2").checked == 1) { answerQuestion10 = "25-35"; }
	if (document.getElementById("q10_option3").checked == 1) { answerQuestion10 = "36-45"; }
	if (document.getElementById("q10_option4").checked == 1) { answerQuestion10 = "46-65"; }
	if (document.getElementById("q10_option5").checked == 1) { answerQuestion10 = "66+"; }

	// Set value for Question 11
	if (document.getElementById("q11_option1").checked == 1) { answerQuestion11 = "Single"; }
	if (document.getElementById("q11_option2").checked == 1) { answerQuestion11 = "Couple"; }
	if (document.getElementById("q11_option3").checked == 1) { answerQuestion11 = "Family (1-2 children)"; }
	if (document.getElementById("q11_option4").checked == 1) { answerQuestion11 = "Family (3+ children)"; }
	
	// Time to feed the cookie monster
	document.cookie = "AnswerQuestion9=" + escape(answerQuestion9);
	document.cookie = "AnswerQuestion10=" + escape(answerQuestion10);
	document.cookie = "AnswerQuestion11=" + escape(answerQuestion11);
}
function WritePage4Cookie() {
	email = "";
	address = "";
	postcode = "";
	fullname = "";
	telephone = "";
	
	email = document.getElementById("email").value;
	address = document.getElementById("address").value;
	postcode = document.getElementById("postcode").value;
	fullname = document.getElementById("fullname").value;
	telephone = document.getElementById("telephone").value;
	
	// Time to feed the cookie monster
	document.cookie = "Email=" + escape(email);
	document.cookie = "Address=" + escape(address);
	document.cookie = "Postcode=" + escape(postcode);
	document.cookie = "Fullname=" + escape(fullname);
	document.cookie = "Telephone=" + escape(telephone);
}
function ReadCookie() {
	email = "";
	address = "";
	postcode = "";
	fullname = "";
	telephone = "";
	answerQuestion1 = "";
	answerQuestion2 = "";
	answerQuestion3 = "";
	answerQuestion4 = "";
	answerQuestion5 = "";
	answerQuestion6 = "";
	answerQuestion7 = "";
	answerQuestion8 = "";
	answerQuestion9 = "";
	answerQuestion10 = "";
	answerQuestion11 = "";
	bognorDay = "";
	arundelDay = "";
	littlehamptonDay = "";
	bognorMonth = "";
	arundelMonth = "";
	littlehamptonMonth = "";

	cookieStart = document.cookie.indexOf("Email=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 6;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		email = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("Address=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 8;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		address = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("Postcode=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 9;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		postcode = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("Fullname=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 9;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		fullname = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("Telephone=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 10;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		telephone = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion1=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion1 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion2=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion2 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion3=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion3 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion4=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion4 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion5=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion5 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion6=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion6 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion7=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion7 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion8=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion8 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion9=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 16;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion9 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion10=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 17;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion10 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("AnswerQuestion11=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 17;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		answerQuestion11 = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("ArundelDay=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 11;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		arundelDay = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("ArundelMonth=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 13;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		arundelMonth = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("BognorDay=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 10;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		bognorDay = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("BognorMonth=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 12;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		bognorMonth = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("LittlehamptonDay=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 17;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		littlehamptonDay = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
	cookieStart = document.cookie.indexOf("LittlehamptonMonth=");
	if (cookieStart > -1) {
		cookieStart = cookieStart + 19;
		cookieEnd = document.cookie.indexOf(";", cookieStart);
		if (cookieEnd == -1) { cookieEnd = document.cookie.length; }
		littlehamptonMonth = unescape(document.cookie.substring(cookieStart,cookieEnd));
	}
}
function LoadPage1FromCookie() {
	ReadCookie();
	// Set value for Question 1
	if (answerQuestion1.indexOf("None", 0) != -1) { document.getElementById("q1_none").checked = 1; }
	if (answerQuestion1.indexOf("Bognor Regis", 0) != -1) {
		document.getElementById("q1_bognor").checked = 1;
		document.getElementById("BognorText").innerHTML = "Month and day of last visit:&nbsp;<select name=\"BognorMonth\" id=\"BognorMonth\"><option value=\"Select\">Select...</option><option value=\"January\">January</option><option value=\"February\">February</option><option value=\"March\">March</option><option value=\"April\">April</option><option value=\"May\">May</option><option value=\"June\">June</option><option value=\"July\">July</option><option value=\"August\">August</option><option value=\"September\">September</option><option value=\"October\">October</option><option value=\"November\">November</option><option value=\"December\">December</option></select><select name=\"BognorDay\" id=\"BognorDay\"><option value=\"Select\">Select...</option><option value=\"Monday\">Monday</option><option value=\"Tuesday\">Tuesday</option><option value=\"Wednesday\">Wednesday</option><option value=\"Thursday\">Thursday</option><option value=\"Friday\">Friday</option><option value=\"Saturday\">Saturday</option><option value=\"Sunday\">Sunday</option></select>";
		document.getElementById("BognorDay").value = bognorDay;
		document.getElementById("BognorMonth").value = bognorMonth;
	} else {
		document.getElementById("BognorText").innerHTML = "&nbsp;";
	}
	if (answerQuestion1.indexOf("Littlehampton", 0) != -1) {
		document.getElementById("q1_littlehampton").checked = 1;
		document.getElementById("LittlehamptonText").innerHTML = "Month and day of last visit:&nbsp;<select name=\"LittlehamptonMonth\" id=\"LittlehamptonMonth\"><option value=\"Select\">Select...</option><option value=\"January\">January</option><option value=\"February\">February</option><option value=\"March\">March</option><option value=\"April\">April</option><option value=\"May\">May</option><option value=\"June\">June</option><option value=\"July\">July</option><option value=\"August\">August</option><option value=\"September\">September</option><option value=\"October\">October</option><option value=\"November\">November</option><option value=\"December\">December</option></select><select name=\"LittlehamptonDay\" id=\"LittlehamptonDay\"><option value=\"Select\">Select...</option><option value=\"Monday\">Monday</option><option value=\"Tuesday\">Tuesday</option><option value=\"Wednesday\">Wednesday</option><option value=\"Thursday\">Thursday</option><option value=\"Friday\">Friday</option><option value=\"Saturday\">Saturday</option><option value=\"Sunday\">Sunday</option></select>";
		document.getElementById("LittlehamptonDay").value = littlehamptonDay;
		document.getElementById("LittlehamptonMonth").value = littlehamptonMonth;
	} else {
		document.getElementById("LittlehamptonText").innerHTML = "&nbsp;";
	}
	if (answerQuestion1.indexOf("Arundel", 0) != -1) {
		document.getElementById("q1_arundel").checked = 1;
		document.getElementById("ArundelText").innerHTML = "Month and day of last visit:&nbsp;<select name=\"ArundelMonth\" id=\"ArundelMonth\"><option value=\"Select\">Select...</option><option value=\"January\">January</option><option value=\"February\">February</option><option value=\"March\">March</option><option value=\"April\">April</option><option value=\"May\">May</option><option value=\"June\">June</option><option value=\"July\">July</option><option value=\"August\">August</option><option value=\"September\">September</option><option value=\"October\">October</option><option value=\"November\">November</option><option value=\"December\">December</option></select><select name=\"ArundelDay\" id=\"ArundelDay\"><option value=\"Select\">Select...</option><option value=\"Monday\">Monday</option><option value=\"Tuesday\">Tuesday</option><option value=\"Wednesday\">Wednesday</option><option value=\"Thursday\">Thursday</option><option value=\"Friday\">Friday</option><option value=\"Saturday\">Saturday</option><option value=\"Sunday\">Sunday</option></select>";
		document.getElementById("ArundelDay").value = arundelDay;
		document.getElementById("ArundelMonth").value = arundelMonth;
	} else {
		document.getElementById("ArundelText").innerHTML = "&nbsp;";
	}

	// Set value for Question 2
	if (answerQuestion2 == "Never") { document.getElementById("q2_never").checked = 1; }
	if (answerQuestion2 == "1-3 times") { document.getElementById("q2_1to3times").checked = 1; }
	if (answerQuestion2 == "4+") { document.getElementById("q2_4plus").checked = 1; }
	if (answerQuestion2 == "N/A") { document.getElementById("q2_na").checked = 1; }

	// Set value for Question 3
	if (answerQuestion3 == "Summer") { document.getElementById("q3_summer").checked = 1; }
	if (answerQuestion3 == "Weekend") { document.getElementById("q3_weekend").checked = 1; }
	if (answerQuestion3 == "Weekday") { document.getElementById("q3_weekday").checked = 1; }
	
	// Set value for Question 4
	if (answerQuestion4 == "Yes") { document.getElementById("q4_yes").checked = 1; }
	if (answerQuestion4 == "No") { document.getElementById("q4_no").checked = 1; }
	if (answerQuestion4 == "N/A") { document.getElementById("q4_na").checked = 1; }
}
function LoadPage2FromCookie() {
	ReadCookie();
	// Set value for Question 5
	if (answerQuestion5.indexOf("Beach", 0) != -1) { document.getElementById("q5_beach").checked = 1; }
	if (answerQuestion5.indexOf("River", 0) != -1) { document.getElementById("q5_river").checked = 1; }
	if (answerQuestion5.indexOf("Green Spaces", 0) != -1) { document.getElementById("q5_green").checked = 1; }
	if (answerQuestion5.indexOf("Retail", 0) != -1) { document.getElementById("q5_retail").checked = 1; }
	if (answerQuestion5.indexOf("Other", 0) != -1) { document.getElementById("q5_other").checked = 1; }

	// Set value for Question 6
	if (answerQuestion6 == "Day Visit") { document.getElementById("q6_option1").checked = 1; }
	if (answerQuestion6 == "Overnight") { document.getElementById("q6_option2").checked = 1; }
	if (answerQuestion6 == "Weekend Break") { document.getElementById("q6_option3").checked = 1; }
	if (answerQuestion6 == "Week (7 days)") { document.getElementById("q6_option4").checked = 1; }

	// Set value for Question 7
	if (answerQuestion7 == "Not taking a holiday") { document.getElementById("q7_option1").checked = 1; }
	if (answerQuestion7 == "UK Resort") { document.getElementById("q7_option2").checked = 1; }
	if (answerQuestion7 == "Abroad") { document.getElementById("q7_option3").checked = 1; }

	// Set value for Question 8
	if (answerQuestion8.indexOf("Travel Distance", 0) != -1) { document.getElementById("q8_option1").checked = 1; }
	if (answerQuestion8.indexOf("Location", 0) != -1) { document.getElementById("q8_option2").checked = 1; }
	if (answerQuestion8.indexOf("Attractions", 0) != -1) { document.getElementById("q8_option3").checked = 1; }
	if (answerQuestion8.indexOf("Weather", 0) != -1) { document.getElementById("q8_option4").checked = 1; }
	if (answerQuestion8.indexOf("Quality of Accommodation", 0) != -1) { document.getElementById("q8_option5").checked = 1; }
	if (answerQuestion8.indexOf("Value", 0) != -1) { document.getElementById("q8_option6").checked = 1; }
}
function LoadPage3FromCookie() {
	ReadCookie();
	// Set value for Question 9
	if (answerQuestion9 == "Male") { document.getElementById("q9_option1").checked = 1; }
	if (answerQuestion9 == "Female") { document.getElementById("q9_option2").checked = 1; }

	// Set value for Question 10
	if (answerQuestion10 == "19-24") { document.getElementById("q10_option1").checked = 1; }
	if (answerQuestion10 == "25-35") { document.getElementById("q10_option2").checked = 1; }
	if (answerQuestion10 == "36-45") { document.getElementById("q10_option3").checked = 1; }
	if (answerQuestion10 == "46-65") { document.getElementById("q10_option4").checked = 1; }
	if (answerQuestion10 == "66+") { document.getElementById("q10_option5").checked = 1; }

	// Set value for Question 11
	if (answerQuestion11 == "Single") { document.getElementById("q11_option1").checked = 1; }
	if (answerQuestion11 == "Couple") { document.getElementById("q11_option2").checked = 1; }
	if (answerQuestion11 == "Family (1-2 children)") { document.getElementById("q11_option3").checked = 1; }
	if (answerQuestion11 == "Family (3+ children)") { document.getElementById("q11_option4").checked = 1; }
}
function LoadPage4FromCookie() {
	ReadCookie();
	document.getElementById("email").value = email;
	document.getElementById("address").value = address;
	document.getElementById("postcode").value = postcode;
	document.getElementById("fullname").value = fullname;
	document.getElementById("telephone").value = telephone;
	document.getElementById("fullname").focus();
}
function LittlehamptonChange() {
	if (document.getElementById("q1_littlehampton").checked == 1) {
		document.getElementById("LittlehamptonText").innerHTML = "Month and day of last visit:&nbsp;<select name=\"LittlehamptonMonth\" id=\"LittlehamptonMonth\"><option value=\"Select\">Select...</option><option value=\"January\">January</option><option value=\"February\">February</option><option value=\"March\">March</option><option value=\"April\">April</option><option value=\"May\">May</option><option value=\"June\">June</option><option value=\"July\">July</option><option value=\"August\">August</option><option value=\"September\">September</option><option value=\"October\">October</option><option value=\"November\">November</option><option value=\"December\">December</option></select><select name=\"LittlehamptonDay\" id=\"LittlehamptonDay\"><option value=\"Select\">Select...</option><option value=\"Monday\">Monday</option><option value=\"Tuesday\">Tuesday</option><option value=\"Wednesday\">Wednesday</option><option value=\"Thursday\">Thursday</option><option value=\"Friday\">Friday</option><option value=\"Saturday\">Saturday</option><option value=\"Sunday\">Sunday</option></select>";
	} else {
		document.getElementById("LittlehamptonText").innerHTML = "&nbsp;";
	}
}
function BognorChange() {
	if (document.getElementById("q1_bognor").checked == 1) {
		document.getElementById("BognorText").innerHTML = "Month and day of last visit:&nbsp;<select name=\"BognorMonth\" id=\"BognorMonth\"><option value=\"Select\">Select...</option><option value=\"January\">January</option><option value=\"February\">February</option><option value=\"March\">March</option><option value=\"April\">April</option><option value=\"May\">May</option><option value=\"June\">June</option><option value=\"July\">July</option><option value=\"August\">August</option><option value=\"September\">September</option><option value=\"October\">October</option><option value=\"November\">November</option><option value=\"December\">December</option></select><select name=\"BognorDay\" id=\"BognorDay\"><option value=\"Select\">Select...</option><option value=\"Monday\">Monday</option><option value=\"Tuesday\">Tuesday</option><option value=\"Wednesday\">Wednesday</option><option value=\"Thursday\">Thursday</option><option value=\"Friday\">Friday</option><option value=\"Saturday\">Saturday</option><option value=\"Sunday\">Sunday</option></select>";
	} else {
		document.getElementById("BognorText").innerHTML = "&nbsp;";
	}
}
function ArundelChange() {
	if (document.getElementById("q1_arundel").checked == 1) {
		document.getElementById("ArundelText").innerHTML = "Month and day of last visit:&nbsp;<select name=\"ArundelMonth\" id=\"ArundelMonth\"><option value=\"Select\">Select...</option><option value=\"January\">January</option><option value=\"February\">February</option><option value=\"March\">March</option><option value=\"April\">April</option><option value=\"May\">May</option><option value=\"June\">June</option><option value=\"July\">July</option><option value=\"August\">August</option><option value=\"September\">September</option><option value=\"October\">October</option><option value=\"November\">November</option><option value=\"December\">December</option></select><select name=\"ArundelDay\" id=\"ArundelDay\"><option value=\"Select\">Select...</option><option value=\"Monday\">Monday</option><option value=\"Tuesday\">Tuesday</option><option value=\"Wednesday\">Wednesday</option><option value=\"Thursday\">Thursday</option><option value=\"Friday\">Friday</option><option value=\"Saturday\">Saturday</option><option value=\"Sunday\">Sunday</option></select>";
	} else {
		document.getElementById("ArundelText").innerHTML = "&nbsp;";
	}
}
function CheckPage() {
   if (location.search.indexOf("mysql=101") > 0) {
	   document.getElementById("RoadName").focus();
	   document.getElementById("RoadName").select();
   }
}
function ValidateQuestionnaire() {
	var errorCount = 0;
	var foundError = "N";

	// Check road
	if (document.getElementById("RoadName").value == "") {
		foundError = "Y"
		errorCount = errorCount + 1;
	}
	if (foundError == "Y") {
		document.getElementById("RoadNameError").bgColor = "#FF0000";
		document.getElementById("RoadNameError").innerHTML = "<strong>Please tell us your road name</strong>";
		document.getElementById("RoadName").focus();
	} else {
		document.getElementById("RoadNameError").bgColor = "";
		document.getElementById("RoadNameError").innerHTML = "&nbsp;";
	}
	// Check if any services used
	foundError = "N";
	if (document.getElementById("CurrentlyUse_1").checked == false) {
		if (document.getElementById("CurrentlyUse_2").checked == false) {
			foundError = "Y";
			errorCount = errorCount + 1;
		}
	}
	if (foundError == "Y") {
		document.getElementById("CurrentlyUseError").bgColor = "#FF0000";
		document.getElementById("CurrentlyUseError").innerHTML = "<strong>Please tell us if you use any of the bus services</strong>";
		document.getElementById("CurrentlyUse_1").focus();
	} else {
		document.getElementById("CurrentlyUseError").bgColor = "";
		document.getElementById("CurrentlyUseError").innerHTML = "&nbsp;";
	}
	// Check which services are used
	foundError = "N";
	if (document.getElementById("CurrentlyUse_1").checked == true) {
		if (document.getElementById("WhichService_7").checked == false) {
			if (document.getElementById("WhichService_12").checked == false) {
				if (document.getElementById("WhichService_700").checked == false) {
					foundError = "Y";
					errorCount = errorCount + 1;
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("WhichServiceError").bgColor = "#FF0000";
		document.getElementById("WhichServiceError").innerHTML = "<strong>Please tell us which services you use</strong>";
		document.getElementById("WhichService_7").focus();
	} else {
		document.getElementById("WhichServiceError").bgColor = "";
		document.getElementById("WhichServiceError").innerHTML = "&nbsp;";
	}
	// Check destination
	foundError = "N";
	if (document.getElementById("CurrentlyUse_1").checked == true) {
		if (document.getElementById("WhereGo").value == "") {
			foundError = "Y"
			errorCount = errorCount + 1;
		}
	}
	if (foundError == "Y") {
		document.getElementById("WhereGoError").bgColor = "#FF0000";
		document.getElementById("WhereGoError").innerHTML = "<strong>Please tell us where you go on the bus</strong>";
		document.getElementById("WhereGo").focus();
	} else {
		document.getElementById("WhereGoError").bgColor = "";
		document.getElementById("WhereGoError").innerHTML = "&nbsp;";
	}
	// Check why the bus is used
	foundError = "N";
	if (document.getElementById("CurrentlyUse_1").checked == true) {
		if (document.getElementById("Cost").checked == false) {
			if (document.getElementById("Parking").checked == false) {
				if (document.getElementById("Convenience").checked == false) {
					if (document.getElementById("Car").checked == false) {
						if (document.getElementById("Other").checked == false) {
							foundError = "Y"
							errorCount = errorCount + 1;
						}
					}
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("WhyUseError").bgColor = "#FF0000";
		document.getElementById("WhyUseError").innerHTML = "<strong>Please tell us why you use the bus</strong>";
		document.getElementById("Cost").focus();
	} else {
		document.getElementById("WhyUseError").bgColor = "";
		document.getElementById("WhyUseError").innerHTML = "&nbsp;";
	}
	// If Other selected, make sure reason is stated
	foundError = "N";
	if (document.getElementById("CurrentlyUse_1").checked == true) {
		if (document.getElementById("Other").checked == true) {
			if (document.getElementById("OtherStated").value == "") {
				foundError = "Y"
				errorCount = errorCount + 1;
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("WhyUseError").bgColor = "#FF0000";
		document.getElementById("WhyUseError").innerHTML = "<strong>Please tell us the other reason(s) you use the bus</strong>";
		document.getElementById("OtherStated").focus();
	} else {
		document.getElementById("WhyUseError").bgColor = "";
		document.getElementById("WhyUseError").innerHTML = "&nbsp;";
	}
	// Check if there is a service
	foundError = "N";
	if (document.getElementById("NoService_1").checked == false) {
		if (document.getElementById("NoService_2").checked == false) {
			if (document.getElementById("NoService_3").checked == false) {
				foundError = "Y"
				errorCount = errorCount + 1;
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("NoServiceError").bgColor = "#FF0000";
		document.getElementById("NoServiceError").innerHTML = "<strong>Please tell us if you'd use the bus</strong>";
		document.getElementById("NoService_1").focus();
	} else {
		document.getElementById("NoServiceError").bgColor = "";
		document.getElementById("NoServiceError").innerHTML = "&nbsp;";
	}
	// Check age
	foundError = "N";
	if (document.getElementById("Age_1").checked == false) {
		if (document.getElementById("Age_2").checked == false) {
			if (document.getElementById("Age_3").checked == false) {
				if (document.getElementById("Age_4").checked == false) {
					foundError = "Y"
					errorCount = errorCount + 1;
				}
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("AgeError").bgColor = "#FF0000";
		document.getElementById("AgeError").innerHTML = "<strong>Please tell us which age range you fall within</strong>";
		document.getElementById("Age_1").focus();
	} else {
		document.getElementById("AgeError").bgColor = "";
		document.getElementById("AgeError").innerHTML = "&nbsp;";
	}
	// If use number 12, check if satisfied
	foundError = "N";
	if (document.getElementById("WhichService_12").checked == true) {
		if (document.getElementById("Satisfied_1").checked == false) {
			if (document.getElementById("Satisfied_2").checked == false) {
				foundError = "Y"
				errorCount = errorCount + 1;
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("SatisfiedError").bgColor = "#FF0000";
		document.getElementById("SatisfiedError").innerHTML = "<strong>Please tell us if you're satisfied with the route</strong>";
		document.getElementById("Satisfied_1").focus();
	} else {
		document.getElementById("SatisfiedError").bgColor = "";
		document.getElementById("SatisfiedError").innerHTML = "&nbsp;";
	}
	// Check why not satisfied
	foundError = "N";
	if (document.getElementById("WhichService_12").checked == true) {
		if (document.getElementById("Satisfied_2").checked == true) {
			if (document.getElementById("NotSatisfied").value == false) {
				foundError = "Y"
				errorCount = errorCount + 1;
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("NotSatisfiedError").bgColor = "#FF0000";
		document.getElementById("NotSatisfiedError").innerHTML = "<strong>Please tell us where else you'd like the bus to go</strong>";
		document.getElementById("NotSatisfied").focus();
	} else {
		document.getElementById("NotSatisfiedError").bgColor = "";
		document.getElementById("NotSatisfiedError").innerHTML = "&nbsp;";
	}
	// If not a user of number 12 bus, check where else in Littlehampton
	foundError = "N";
	if (document.getElementById("WhichService_12").checked == false) {
		if (document.getElementById("WhereElse").value == false) {
			foundError = "Y"
			errorCount = errorCount + 1;
		}
	}
	if (foundError == "Y") {
		document.getElementById("WhereElseError").bgColor = "#FF0000";
		document.getElementById("WhereElseError").innerHTML = "<strong>Please tell us where the service should run to</strong>";
		document.getElementById("WhereElse").focus();
	} else {
		document.getElementById("WhereElseError").bgColor = "";
		document.getElementById("WhereElseError").innerHTML = "&nbsp;";
	}
	// Checked for errors so time to see whether okay to submit the form
	if (errorCount == 0) {
		return true;
	} else {
		return false;
	}
}
function ValidateLibraryForm() {
	var errorCount = 0;
	var foundError = "N";
	// Check answer to question 1
	if (document.getElementById("Question1_1").checked == false) {
		if (document.getElementById("Question1_2").checked == false) {
			foundError = "Y";
			errorCount = errorCount + 1;
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question1Error").bgColor = "#FF0000";
		document.getElementById("Question1Error").innerHTML = "<strong>Please tell us if you used the library last year</strong>";
	} else {
		document.getElementById("Question1Error").bgColor = "";
		document.getElementById("Question1Error").innerHTML = "&nbsp;";
	}
	// Check answer to question 2
	foundError = "N";
	if (document.getElementById("Question2_1").checked == false) {
		if (document.getElementById("Question2_2").checked == false) {
			foundError = "Y";
			errorCount = errorCount + 1;
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question2Error").bgColor = "#FF0000";
		document.getElementById("Question2Error").innerHTML = "<strong>Please tell us if you you believe the opening hours should be reduced</strong>";
	} else {
		document.getElementById("Question2Error").bgColor = "";
		document.getElementById("Question2Error").innerHTML = "&nbsp;";
	}
	// Check answer to question 3
	foundError = "N";
	if (document.getElementById("Question3_1").checked == false) {
		if (document.getElementById("Question3_2").checked == false) {
			if (document.getElementById("Question3_3").checked == false) {
				foundError = "Y";
				errorCount = errorCount + 1;
			}
		}
	}
	if (foundError == "Y") {
		document.getElementById("Question3Error").bgColor = "#FF0000";
		document.getElementById("Question3Error").innerHTML = "<strong>Please tell us your preferred option</strong>";
	} else {
		document.getElementById("Question3Error").bgColor = "";
		document.getElementById("Question3Error").innerHTML = "&nbsp;";
	}
	// Checked for errors so time to see whether okay to submit the form
	if (errorCount == 0) {
		return true;
	} else {
		return false;
	}
}
