/**
 * if (location.href.toString().search('www.info.gov.hk/lad') != -1) {
 *   tcpath='www.info.gov.hk/lad';
 *   scpath='sc.info.gov.hk/gb/www.info.gov.hk/lad';
 * } else if (location.href.toString().search('test.info.gov.hk/lad') != -1) {
 *   tcpath='test.info.gov.hk/lad';
 *   scpath='sc.info.gov.hk/gb/test.info.gov.hk/lad';
 * }
 */
if (top.location.href.indexOf("dev02.westcomzivo.com") != -1){
var gb_svr = "http://common.westcomzivo.com/gb/";
}else{
var gb_svr = "http://sc.info.gov.hk/gb/";
}
gb_svr='';

english = "/english/";
chinese = "/sc/";
textonly = "/text"

function getLang(){
	var langs = ["chinese", "english", "sc"];
	var fromLang = '';
	for(counter = 0; counter < langs.length; counter++){
		if(location.href.search('/'+langs[counter]+'/')!= -1){
			fromLang = langs[counter];
		}
	}
	return fromLang;
}
function tran_gb(){
	top.location.href = top.location.href.replace("/"+getLang()+"/", "/sc/");
}

function tran_b5(){
	top.location.href = top.location.href.replace("/"+getLang()+"/", "/chinese/");
}

function tran_en(){
	top.location.href = top.location.href.replace("/"+getLang()+"/", "/english/");
}

function tran_text(){
	link = top.location.href;
	if (link.indexOf(english) != -1){
		link = link.replace(english,textonly+english); 	
	}
	if (link.indexOf(chinese) != -1){
		link = link.replace(chinese,textonly+chinese); 	
	}
	top.location.href = link;
}