
function changelang(lang)
{
	
	if(lang == "tw")
	{
		lang1 = ""; 
		partten= "/en/";
	}
	else  if(lang == "en")
	{
		lang1 = "/en";
		partten= "/";
	}
	

	if (parent.location.href.lastIndexOf("#")+1 == parent.location.href.length ){
		len = parent.location.href.length -1
		temp = parent.location.href.substring(parent.location.href.lastIndexOf(partten));
		docname =temp.substring(0, temp.length -1);

	}else{
		docname = parent.location.href.substring(parent.location.href.lastIndexOf(partten));
	}
		if(lang == "tw")  docname = docname.substring(docname.lastIndexOf("/"));
		dir = parent.location.href.substring(0, parent.location.href.lastIndexOf(partten));
		newloc =  dir + lang1 + docname;

		document.location.href = newloc;

}
