/* duplicate and adapted from http://www.cuhk.edu.hk/v5/
 * Copyright of this script is of ITSC
 */
 
function goEnglish() {
	if (window.location.href.indexOf("gb") > 0) //it is gb version now, so go to en
	{
		s = window.location.href;
		re = '/ch/';
		s = s.replace(re, '/en/');
		re = 'http://translate.itsc.cuhk.edu.hk/gb/';
		s = s.replace(re, 'ht'+'tp://');
		window.location = s;
	}
	else //it is b5 version now, so go to en
	{
		s = window.location.href;
		re = '/ch/';
		s = s.replace(re, '/en/');
		window.location = s;
	}
}

function goB5() {
	if (window.location.href.indexOf("gb") > 0) //it is gb version now, so to b5
	{
		s = window.location.href;
		re = 'http://translate.itsc.cuhk.edu.hk/gb/';
		s = s.replace(re, 'ht'+'tp://');
		window.location = s;
	}
	else //it is en version nowm, so go to b5
	{
		s = window.location.href;
		re = '/en/';
		s = s.replace(re, '/ch/');
		window.location = s;
	}
}

function goGb() {
	if (window.location.href.indexOf("en") > 0) //it is en version now, so to gb
	{
		s = window.location.href;
		re = '/en/';
		s = s.replace(re, '/ch/');
		re = 'http://';
		s = s.replace(re, 'http://translate.itsc.cuhk.edu.hk/gb/');
		window.location = s;
	}
	else //it is b5 version nowm, so go to gb
	{
		s = window.location.href;
		re = 'http://';
		s = s.replace(re, 'http://translate.itsc.cuhk.edu.hk/gb/');
		window.location = s;
	}
}