function changeURL(switchLang){ //chinese and english switch
	//alert(switchLang);	
	var currentPath=location.href.toString();
	var lan = switchLang;
	var switchTw='/';
	//正则查找
	var regx = /\/\w{2}\//
	//替换掉
	if (regx.test(currentPath)){
		currentPath = currentPath.replace(regx, "/");
	}
			
	if (lan=='TW'){
		currentPath=currentPath.replace("/"+switchLang+"/", switchTw);
	}else if (lan=='CN'){
		currentPath=getCurPath(currentPath,"cn");
	}else if (lan=='PT'){
		currentPath=getCurPath(currentPath,"pt");
	}else if (lan=="EN"){
		currentPath=getCurPath(currentPath,"en");			
	}	
	
	document.location=currentPath;
}

function getCurPath(currentPath,langType){	
	var words = currentPath.split("/");
	var path = "";
	

	for (var i = 0; i<words.length;i++ )
	{		
		if (i == 3)
		{
			path += langType + "/" 
		}
		path += words[i] + "/";	
			
	}
	if (path != null && path != "")
	{
		path = path.substring(0,path.length-1);
	}
	
	return path;
}

