<!--
function clickCloud(id)
{
	for (var i = 0; i < document.getElementById("ddlFeatures").length; i++)
	{
		if (document.getElementById("ddlFeatures").options[i].text == id)
		
		{
			document.getElementById("ddlFeatures").selectedIndex = i;
		}
	}
}

function clickSearch(feature, postcode, settlement)
{
	if (feature.selectedIndex == 0)
	{
		alert("Please select a feature from the drop down list or the tag cloud.");
		document.getElementById("ddlFeatures").focus();
		return false;
	}
	
	if (postcode == "" && settlement.selectedIndex == 0)
	{
		alert("Please enter a postcode or select a location from the drop down list.");
		document.getElementById("txtPostcode").focus();
		return false;
	}
	
	if (postcode != "")
	{
		if (postcode.length <=2 || postcode.length >= 9)
		{
			alert("Please enter a valid postcode.");
			document.getElementById("txtPostcode").focus();
			return false;
		}

		var xmlHttp = createXmlHttp();

		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				if (xmlHttp.status==200)
				{
					var xmlDoc = xmlHttp.responseXML;
					var x;
					var y;
					var type;
				
					try
					{
						type = xmlDoc.getElementsByTagName("Type")[0].firstChild.nodeValue;
						x = xmlDoc.getElementsByTagName("X")[0].firstChild.nodeValue;
						y = xmlDoc.getElementsByTagName("Y")[0].firstChild.nodeValue;

						if (type == "NotFound")
						{
							alert ("Postcode could not be found.");
							return false;
						}
						else
						{
							location.href = "FindMyNearestMap.aspx?feature=" + feature.options[feature.selectedIndex].value + "&x=" + x + "&y=" + y;
						}
					}
					catch(err)
					{
					}
				}
			}
		}

		//xmlHttp.open("GET","/address/Address.asmx/LocatePostcode?postcode=" + postcode, true);
		xmlHttp.open("GET","http://www2.northamptonshire.gov.uk/MappingWebServices/Address.asmx/LocatePostcode?postcode=" + postcode, true);

		xmlHttp.send(null);
	}
	else
	{
		location.href = "FindMyNearestMap.aspx?feature=" + feature.options[feature.selectedIndex].value + "&settlement=" + settlement.options[settlement.selectedIndex].value;
	}

	return false;
}

function clickMap(event)
{
	if (document.getElementById("ddlFeatures").selectedIndex == 0)
	{
		alert("Please select a feature from the drop down list or the tag cloud before clicking on the map.");
		document.getElementById("ddlFeatures").focus();
		return false;
	}
	else
	{
		return true;
	}
/*
	if (!event)
	{
		event = window.event;
	}
	
	var mapLeft = 438741;
	var mapRight = 518870;
	var mapTop = 308252;
	var mapBottom = 227836;
	var imageWidth = 222;
	var imageHeight = 222;
	var clickX = 0;
	var clickY = 0;
	
	if (event.offsetX && event.offsetY) // IE
	{
		clickX = event.offsetX?event.offsetX:event.layerX;
		clickY = event.offsetY?event.offsetY:event.clientY;
	}
	else //Firefox
	{
		var Element = event.target ;
		var CalculatedTotalOffsetLeft = CalculatedTotalOffsetTop = 0;
		while (Element.offsetParent)
		{
			CalculatedTotalOffsetLeft += Element.offsetLeft;
			CalculatedTotalOffsetTop += Element.offsetTop;
			Element = Element.offsetParent;
		}
		clickX = event.pageX - CalculatedTotalOffsetLeft;
		clickY = event.pageY - CalculatedTotalOffsetTop;
	}
	
	var mapX = Math.round(mapLeft + ((clickX / imageWidth) * (mapRight - mapLeft)));
	var mapY = Math.round(mapBottom + (((imageHeight - clickY) / imageHeight) * (mapTop - mapBottom)));

	location.href = "FindMyNearestMap.aspx?feature=" + document.getElementById("ddlFeatures").options[document.getElementById("ddlFeatures").selectedIndex].value + "&x=" + mapX + "&y=" + mapY;

	return false;	
*/
}
-->
