function locatorCountryChange()
{
	var theForm = getItem("cSelectorFrm");
	var thisSelect = theForm.elements["csCountry"];
	var countryID = thisSelect.options[thisSelect.selectedIndex].value;
	if (countryID == -1)
	{
		return;
	}
	if (countryID == 1)
	{
		var curLocHost = this.location.hostname;
		var curLocPath = this.location.pathname;
		var curLocSearch = this.location.search;
		var newLoc = "http://" + curLocHost + curLocPath;
		if (curLocSearch == "")
		{
			this.location.href = newLoc + "?csCountry=1";
		}
		else
		{
			var qRegex = /\?/g;
			var newSearch = "?";
			var pathString = curLocSearch.replace(qRegex, "");
			var splitArray = pathString.split("&");
			for (var i = 0; i < splitArray.length; i++)
			{
				var splitItem = splitArray[i];
				var itemArray = splitItem.split("=");
				if (itemArray[0] != "csCountry" && itemArray[0] != "csRegion")
				{
					if (newSearch == "?")
					{
						newSearch += splitItem + "&";
					}
					else
					{
						newSearch += splitItem + "&";
					}
				}
			}
			this.location.href = newLoc + newSearch + "csCountry=" + countryID
		
		}
	}
	else
	{
		this.location.href = "/tools/locator/index.asp?csCountry=" + countryID;
	}
}

function locatorRegionChange(countryID)
{
	var theForm = getItem("cSelectorFrm");
	var regionSelect = theForm.elements["csRegion"];
	var regionID = regionSelect.options[regionSelect.selectedIndex].value;
	if (countryID == -1 || regionID == -1)
	{
		return;
	}
	this.location.href = "/tools/locator/index.asp?csCountry=" + countryID + "&csRegion=" + regionID;
}

function getItem(itemName)
{
	if (document.getElementById)
	{
		return document.getElementById(itemName);
	}
	if (document.all)
	{
		return document.all(itemName);
	}
	if (document.forms)
	{
		var theItem = document.forms[itemName];
		if (theItem)
		{
			return theItem;
		}
	}
	return null;
}

function trim(text)
{
	if (text == null)
	{
		return "";
	}
	else
	{
		return new String(text).replace(/^\s*/g, "").replace(/\s*$/g, "");
	}
}

function verifyPostCode(theForm)
{
	var postCodeVal = trim(theForm.postCode.value);
	if (postCodeVal == "")
	{
		alert("Post Code not specified");
		return false;
	}
	return true;
}
