function changeLanguage(lang) {
	var oldURL = window.location.href;
	// Make sure current page URL ends in forward slash otherwise newURL will be invalid.
	if(oldURL.charAt(oldURL.length-1) != '/') { oldURL += '/'; }
	var regex = new RegExp('\/[a-zA-Z]{2}\/');
	var langPos = oldURL.search(regex);
	var newURL = oldURL.substr(0, langPos) + '/' + lang + '/' + oldURL.substr(langPos + 4, oldURL.length);
	window.location = newURL;
}
