// ###########################
// created by: Ben Weeks
// Created Date: 3rd November 2005
// Company: webtechy.co.uk
//
// Modified By:
// Modified Date:
// Modified Comment:
//
// Version: 1.00
// ###########################

function AlterWardSelect() {
	var bFound;
	var sString = "";
	var sWardID = "WardSelectSpan";
	aAllowedWards = new Array();
	aAllowedWards[0] = "All";

	aAllowedWards[1] = "Aldeburgh";
	aAllowedWards[2] = "Earl Soham";
	aAllowedWards[3] = "Felixstowe East";
	aAllowedWards[4] = "Felixstowe North";
	aAllowedWards[5] = "Felixstowe South";
	aAllowedWards[6] = "Felixstowe South East";
	aAllowedWards[7] = "Felixstowe West";
	aAllowedWards[8] = "Framlingham";
	aAllowedWards[9] = "Grundisburgh";
	aAllowedWards[10] = "Hacheston";
	aAllowedWards[11] = "Hollesley with Eyke";
	aAllowedWards[12] = "Kesgrave East";
	aAllowedWards[13] = "Kesgrave West";
	aAllowedWards[14] = "Leiston";
	aAllowedWards[15] = "Martlesham";
	aAllowedWards[16] = "Melton and Ufford";
	aAllowedWards[17] = "Nacton";
	aAllowedWards[18] = "Orford and Tunstall";
	aAllowedWards[19] = "Otley";
	aAllowedWards[20] = "Peasenhall";
	aAllowedWards[21] = "Rendlesham";
	aAllowedWards[22] = "Rushmere St. Andrew";
	aAllowedWards[23] = "Saxmundham";
	aAllowedWards[24] = "Snape";
	aAllowedWards[25] = "Sutton";
	aAllowedWards[26] = "Trimleys with Kirton";
	aAllowedWards[27] = "Walberswick and Wenhaston";
	aAllowedWards[28] = "Wickham Market";
	aAllowedWards[29] = "Witnesham";
	aAllowedWards[30] = "Yoxford";

	aAllowedWards[31] = "Woodbridge Farlingaye";
	aAllowedWards[32] = "Woodbridge Kyson";
	aAllowedWards[33] = "Woodbridge Riverside";
	aAllowedWards[34] = "Woodbridge Seckford";

//Grundisburgh should be Grundisburgh and Witnesham 
//Farlingaye should be Woodbridge Farlingaye 
//Kyson should be Woodbridge Kyson 
//Riverside should be Woodbridge Riverside 
//Seckford should be Woodbridge Seckford

	try {
		oWardSelect = document.getElementById(sWardID).firstChild;

		if (oWardSelect) {
			aOptionsToRemove = new Array();
			var iNumberOfOptions = oWardSelect.children.length;
	
			// Search through the options	
			for (var i = 0; i <= iNumberOfOptions - 1; i++) {
				bFound = false;
				for (var j = 0; j <= aAllowedWards.length - 1; j++) {
					if (oWardSelect.children[i]) { // Just to be on the safe side, should work without this really.
						if (oWardSelect.children[i].innerText == aAllowedWards[j]) {
							// OK, we've found one of the Wards that 
							// we want, so set it to found.  could at
							// this point jump out of the for loop 
							// really to speed things up.
							bFound = true;
						}
					}
				}
				if (bFound != true) {
					oWardSelect.children[i].removeNode();
					i--; // We have to go back one because we have just removed one!
					iNumberOfOptions--; // We also have to reduce the total number by one!
				}
			}
			// alert(sString);
		}
		else {
			//alert("Ward select list with the ID " + sWardID + " not found on this page.");
		}
	}
	catch(er) {
		// We'll just have to leave the list as it is.
		//alert("Problem");
	}
}

AlterWardSelect();