function changeLocale(selectElement) {
	var url;
	
	// check for external URL and redirect if present
	if ( 'undefined' != typeof(arrExternalLocaleURLs[selectElement.value]) )
	{
		document.location.href = arrExternalLocaleURLs[selectElement.value];
		return false;
	}

	// Remove anchor from url if present
	url = document.location.href;
	if (url.indexOf('#') > -1) {
		url = url.substr(0, url.indexOf('#'));
	}

	// Remove variable V when changing locales to prevent adding maps to the cart unintentionally
	if (url.indexOf('V=') > -1) {
		var locVar = url.indexOf('V=');
		var str = url.substr(locVar);
		var locVarEnd = str.indexOf('&');
		
		for (var text = '', i = 0; i < url.length; i = i + 1) {
			if (i != locVar) {
	    		text += url.charAt(i);
			} else {
				i = i + locVarEnd;
			}
		}
		url = text;
	}

	paramSeperator = url.indexOf('?')>-1?'&':'?';
	if (url.indexOf('Lid=') > -1) {
		selectElement.form.action = url.replace(/Lid=[0-9]+/, 'Lid='+selectElement.value);
	}
	else {
		selectElement.form.action = url + paramSeperator + 'Lid=' + selectElement.value;
	}
	
	paramSeperator = '&';
	if (url.indexOf('selector=') == -1) {
		selectElement.form.action = selectElement.form.action + paramSeperator + 'selector=true';
	}
	
	document.location.href = selectElement.form.action;
	return false;
}

