if(location.href.toString().search('test.sars-monitoringcom.gov.hk') != -1)
{
	div_path = 'test.sars-monitoringcom.gov.hk';
}
else if(location.href.toString().search('www0.sars-monitoringcom.gov.hk') != -1)
{
	div_path = 'www0.sars-monitoringcom.gov.hk';
}
else
{
	div_path = 'www.sars-monitoringcom.gov.hk';
}


//div_path = "www.sars-monitoringcom.gov.hk";

cv_sc_base_path = "http:" + "//" + div_path;

cv_nonsc_base_path = "http:" + "//" + div_path;



path = div_path;

tc_path = cv_nonsc_base_path + div_path;
front_path = cv_nonsc_base_path + div_path;

if (location.href.toString().search('/chs/') != -1 && location.href.toString().search('\/text\/') == -1 ) {
	atgb = "sc_chi";
} else if (location.href.toString().search('/chs/') == -1 && location.href.toString().search('\/text\/') == -1) {
	atgb = "chi";
}
else if (location.href.toString().search('/chs/') != -1 && location.href.toString().search('\/text\/') != -1 && location.href.toString().search('/eng/') == -1) {
	atgb = "sc_textchi";
}
else if (location.href.toString().search('/chs/') == -1 && location.href.toString().search('\/text\/') != -1 && location.href.toString().search('/eng/') == -1) {
	atgb = "textchi";
}


else if (location.href.toString().search('/eng/') != -1 && location.href.toString().search('\/text\/') != -1) {
	atgb = "texteng";
}

function changeVer(lang) {

	chi_path = "chinese";
	eng_path = "english";
	chs_path = "chs";


	//org_path=window.location.href;
org_path=window.location.href;
	org_path_start=org_path.indexOf(div_path) + div_path.length;
	org_path_end=org_path.length;
	org_path=org_path.substring(org_path_start, org_path_end);

   
	if (org_path.indexOf(chi_path) != -1) {
		org_lang_path = chi_path;
	} 
	else if (org_path.indexOf(chs_path) != -1) {
		org_lang_path = chs_path;
	}else {
		org_lang_path = eng_path;
	}



	if (lang == 'e') {
		des_lang_path = eng_path;
		base_path = cv_nonsc_base_path;
	} 
	else if (lang == 'e_text') {
		des_lang_path = "text/" + eng_path  ;
		base_path = cv_nonsc_base_path;
	}	

	else if (lang == 'e_Gra') {
		org_lang_path = "text/" + eng_path;
		des_lang_path =  eng_path;
		base_path = cv_nonsc_base_path;
	}	
	
	else {
		des_lang_path = chi_path;
	

	if (lang == 's') {
		des_lang_path = chs_path;
		base_path = cv_sc_base_path;
	} 
	else if (lang == 's_text') {
		base_path = cv_sc_base_path + "/text";
		des_lang_path = chs_path;
	}	

	else if (lang == 's_Gra') {
		org_lang_path = "text/" + chs_path;
		base_path = cv_nonsc_base_path
	}	

	else if (lang == 'c_text') {
		base_path = cv_nonsc_base_path + "/text";
	}

	else if (lang == 'c_Gra') {
		org_lang_path = "text/" + chi_path;
		base_path = cv_nonsc_base_path;
	}
	else  {
		base_path = cv_nonsc_base_path;
	}

	}

	tail = org_path.replace(org_lang_path, des_lang_path);
	
	window.location.href = base_path + tail;

	//alert (base_path + tail);
}

