function changeLanguage(sitelanguage) {
	var cmsindexurl = '${site.url}';
	if (cmsindexurl.indexOf("index.shtml") != -1) {
		cmsindexurl = cmsindexurl.substring(0, cmsindexurl.indexOf("index.shtml"));
	}

	if (cmsindexurl.length != cmsindexurl.lastIndexOf("/") + 1) {
		cmsindexurl += "/";
	}

	var tempurl = window.location.href;
	if (tempurl.lastIndexOf("/") == tempurl.length-1) {
		tempurl = tempurl + "index.shtml";
	}
	
	if (tempurl.indexOf("_big5.jsp") != -1 && sitelanguage == "cn") {
		tempurl = tempurl.replace(new RegExp("_big5.jsp", "g"), ".jsp");
		window.location = tempurl;
	} else if (tempurl.indexOf("Result.jsp") != -1 && sitelanguage == "big5") {
		tempurl = tempurl.replace(new RegExp("Result.jsp", "g"), "Result_big5.jsp");
		window.location = tempurl;
	} else {
		if (tempurl.indexOf("/cn/") == -1 && tempurl.indexOf("/big5/") == -1) {
			if (sitelanguage == "big5" && tempurl.indexOf("big5") == -1) {
				tempurl = tempurl.replace(new RegExp("index.shtml", "g"), "index_big5.shtml");
				window.location = tempurl;
			} else if (sitelanguage == "cn" && tempurl.indexOf("index_big5") != -1) {
				tempurl = tempurl.replace(new RegExp("index_big5.shtml", "g"), "index.shtml");
				window.location = tempurl;
			}
		} else if (tempurl.indexOf("/cn/") != -1 && sitelanguage == "big5") {
			tempurl = tempurl.replace(new RegExp("/cn/", "g"), "/big5/");
			window.location = tempurl;
		} else if (tempurl.indexOf("/big5/") != -1 && sitelanguage == "cn") {
			tempurl = tempurl.replace(new RegExp("/big5/", "g"), "/cn/");
			window.location = tempurl;
		}
	}
}
