﻿//var scserver = "http"+"://sc.info.gov.hk/gb/";
var locapath = document.location.href;
var atgb = false;


if (locapath.toString().search('/pland_sc/')!=-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("pland_sc","pland_tc");
			window.location = base_path + final_path;
			break;
		case'sc':
			final_path = sitepath.replace("pland_tc","pland_sc");
			window.location = base_path + final_path;
			break;
	}


}



function englang(){
		if (atgb){
		final_path = sitepath.replace("pland_sc","pland_en");
		window.location = base_path +final_path;
		}
		else {
		final_path = sitepath.replace("pland_tc","pland_en");
		window.location = base_path +final_path;
		}

}




function displaytcsc(){
	if(atgb){
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"javascript:chglang('tc')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar3','','/pland_sc/image_new/top/mainbar3_f2.gif',1)\">");
	document.write("<img name=\"mainbar3\" src=\"/pland_sc/image_new/top/mainbar3.gif\" border=\"0\" alt=\"繁体版\"></a></td>");

	}else{
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"javascript:chglang('sc')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar3','','/pland_tc/image_new/top/mainbar3_f2.gif',1)\">");
	document.write("<img name=\"mainbar3\" src=\"/pland_tc/image_new/top/mainbar3.gif\" border=\"0\" alt=\"簡體版\"></a></td>");
	}
}



function displayeng(){
if(atgb){
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"javascript:englang()\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar4','','/pland_sc/image_new/top/mainbar4_f2.gif',1)\">");
	document.write("<img name=\"mainbar4\" src=\"/pland_sc/image_new/top/mainbar4.gif\" width=\"56\" height=\"19\" border=\"0\" alt=\"English\"></a></td>");
}else{
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"javascript:englang()\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar4','','/pland_tc/image_new/top/mainbar4_f2.gif',1)\">");
	document.write("<img name=\"mainbar4\" src=\"/pland_tc/image_new/top/mainbar4.gif\" width=\"56\" height=\"19\" border=\"0\" alt=\"English\"></a></td>");
}
}

function displaytc(){
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"javascript:chgtcsc('tc')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar3','','/pland_en/image_new/top/mainbar3_f2.gif',1)\">");
	document.write("<img name=\"mainbar3\" src=\"/pland_en/image_new/top/mainbar3.gif\" width=\"51\" height=\"20\" border=\"0\" alt=\"Traditional Chinese\"></a></td>");
	}

function displaysc(){
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"javascript:chgtcsc('sc')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar4','','/pland_en/image_new/top/mainbar4_f2.gif',1)\">");
	document.write("<img name=\"mainbar4\" src=\"/pland_en/image_new/top/mainbar4.gif\" width=\"50\" height=\"20\" border=\"0\" alt=\"Simplified Chinese\"></a></td>");
	}

//20110623 bryan for mobile
function displaymobile(){
	if (locapath.indexOf("pland_tc")!=-1){_lang = 'tc';}
	if (locapath.indexOf("pland_sc")!=-1){_lang = 'sc';}
	if (locapath.indexOf("pland_en")!=-1){_lang = 'en';}
	
		switch(_lang){
		case'tc':
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"/mobile/pland_tc/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar_m','','/common_images/mainbar_m_tc_f.gif',1)\">");
	document.write("<img name=\"mainbar_m\" src=\"/common_images/mainbar_m_tc.gif\" border=\"0\" alt=\"手機版\" width=\"56px\" height=\"19px\"></a></td>");

			break;
		case'sc':
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"/mobile/pland_sc/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar_m','','/common_images/mainbar_m_sc_f.gif',1)\">");
	document.write("<img name=\"mainbar_m\" src=\"/common_images/mainbar_m_sc.gif\" border=\"0\" alt=\"手机版\"></a></td>");

			break;
		case'en':
	document.write("<td align=\"left\" valign=\"bottom\"><a href=\"/mobile/pland_en/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar_m','','/common_images/mainbar_m_en_f.gif',1)\">");
	document.write("<img name=\"mainbar_m\" src=\"/common_images/mainbar_m_en.gif\" border=\"0\" alt=\"Mobile\" width=\"56px\" height=\"20px\"></a></td>");

			break;
	}	
	
}

function chgtcsc(lang1){
	switch(lang1){
		case'tc':
			final_path = sitepath.replace("pland_en","pland_tc");
			window.location = base_path + final_path;
			break;
		case'sc':
			final_path = sitepath.replace("pland_en","pland_sc");
			window.location = base_path + final_path;
			break;
	}
}

function externalLink(url)
{url = url.replace('sc.info.gov.hk/gb/www', 'www');
eval("nw = window.open(url, 'external','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,pageXOffset=0,pageYOffset=0,top=0,left=0,width=800,height=300')");
	if ( nw.focus != null)
	{nw.focus();}
}

function PopXMas(){
   if(location.href.toString().search("sc.info.gov.hk") >= 0)
	window.open("http://210.17.235.91/hplb_xmas2005/gb/index.htm", "_blank");
    else
	window.open("http://210.17.235.91/hplb_xmas2005/chi/index.htm", "_blank");
}


function govhktcsc(){
	if(atgb){
	document.write("<td height=\"1\" width=\"153\" background=\"/pland_sc/image_new/top/bkgdtexture.gif\"><kanhanbypass><a href=\"http://www.gov.hk/sc/residents/\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar1','','/pland_sc/image_new/top/mainbar1_new_f2.gif',1)\" target=\"_blank\"><img name=\"mainbar1\" src=\"/pland_sc/image_new/top/mainbar1_new.gif\" border=\"0\" alt=\"GovHK 香港政府一站通\"></a></kanhanbypass></td>")
	}else{
	document.write("<td height=\"1\" width=\"153\" background=\"/pland_tc/image_new/top/bkgdtexture.gif\"><kanhanbypass><a href=\"http://www.gov.hk/tc/residents/\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mainbar1','','/pland_tc/image_new/top/mainbar1_new_f2.gif',1)\" target=\"_blank\"><img name=\"mainbar1\" src=\"/pland_tc/image_new/top/mainbar1_new.gif\" border=\"0\" alt=\"GovHK 香港政府一站通\"></a></kanhanbypass></td>")
	}
}

function pland(){
	basepland_path="http"+"://";
	sitepland_path="www.pland.gov.hk/index.html";

	window.location = basepland_path + sitepland_path;
}

function brandhk(){
	basebrandhk_path="http"+"://";
	sitebrandhk_path="www.brandhk.gov.hk/brandhk/";
	window.open(basebrandhk_path + sitebrandhk_path, "_blank");
}
