var locapath = document.location.href;
var atgb = false;

if (locapath.toString().search('/gallery_chs/')!=-1){
	atgb = true;
}else{
	atgb = false;
}

if (locapath.toString().search('http://')!=-1){
	base_path="http"+"://";
	sitepath = locapath.substring(7,locapath.length);
}else{
	base_path="";
	sitepath = locapath.substring(0,locapath.length);
}

function chglang(lang){
	switch(lang){
		case'tc':
			final_path = sitepath.replace("gallery_chs","gallery_tc");
			window.location = base_path + final_path;
			break;
		case'chs':
			final_path = sitepath.replace("gallery_tc","gallery_chs");
			window.location = base_path + final_path;
			break;
	}


}


function englang(){
		if (atgb){
		final_path = sitepath.replace("gallery_chs","gallery_en");
		window.location = base_path +final_path;
		}
		else {
		final_path = sitepath.replace("gallery_tc","gallery_en");
		window.location = base_path +final_path;
		}

}


function chgtcsc(lang1){
	switch(lang1){
		case'tc':
			final_path = sitepath.replace("gallery_en","gallery_tc");
			window.location = base_path + final_path;
			break;
		case'chs':
			final_path = sitepath.replace("gallery_en","gallery_chs");
			window.location = base_path + final_path;
			break;
	}
}

