var altTag = new Array();
var hyperlinks = new Array();
var sectionImage = new Array();
var baseURL = "/";

//Set path
var domain = location.hostname;

if(location.href.search(domain)==-1){
	/*
	domain_pref="censtatd";
	domain="202.64.223.114/"+domain_pref	;
	*/
	domain="www.ecf.gov.hk";
	if (location.href.search('www.ecf')!=-1){
		domain="www.ecf.gov.hk";
	}else if (location.href.search('www0.ecf')!=-1){
		domain="www0.ecf.gov.hk";
	}else if (location.href.search('www0.cms.ecf')!=-1){
		domain="www0.cms.ecf.gov.hk";
	}else if (location.href.search('www.cms.ecf')!=-1){
		domain="www.cms.ecf.gov.hk";
	}else if (location.href.search('active.ecf')!=-1){
		domain="active.ecf.gov.hk";
	}else if (location.href.search('staging.ecf')!=-1){
		domain="staging.ecf.gov.hk";
	}else if (location.href.search('wip.ecf')!=-1){
		domain="wip.ecf.gov.hk";
	}
}


if(document.URL.toString().search('/sc/')!=-1){
	langID=3;
	langFolder='/sc/';
	docFolder='/doc/';
}else if(document.URL.toString().search('/tc/')!=-1 || document.URL.toString().search('mode=288')!=-1){
	langID=2;
	langFolder='/tc/';
	docFolder='/doc/';
}else{
	langID=1;
	langFolder='/en/';
	docFolder=langFolder+'pdf/';
}
var imgFolder='/images'+langFolder;

if(location.href.toString().search('westcomzivo')!=-1){			//Setting kanhan Server
	gb_urlPath='common.westcomzivo.com/gb/';
}else{
	gb_urlPath='sc.info.gov.hk/gb/';
}

if(document.URL.toString().search('/gb/')!=-1){					//Setting kanhan path
	domain_url = "ht"+"tp://"+gb_urlPath+domain;
}else{
	domain_url = "ht"+"tp://"+domain;
}

if(document.URL.toString().search('/text/')!=-1){					//TEXTONLY VERSION
	langPath = domain_url + '/text' + langFolder;
}else{													//GRAPHIC VERSION
	langPath = domain_url + langFolder;
	imgPath = domain_url + imgFolder;
}
docPath=domain_url + docFolder;
//Set path

//english version
altTag[1] = new Array();
altTag[1][1]="Welcome Message";
altTag[1][2]="About Us";
altTag[1][3]="What's New";
altTag[1][4]="Application for ECF";
altTag[1][5]="Vetting Mechanism";
altTag[1][6]="Approved Projects";
altTag[1][7]="Committee";
altTag[1][8]="Meetings";
altTag[1][9]="Publication";
altTag[1][10]="Green Partners";
altTag[1][11]="FAQ";
altTag[1][12]="Links";
altTag[1][13]="Secretariat";
altTag[1][14]="Archives";
altTag[1][15]="Contact Us";
altTag[1][16]="Important Notices";
altTag[1][17]="Sitemap";
altTag[1][18]="Privacy Policy Statement";
altTag[1][19]="en";
altTag[1][20]="utf-8";

hyperlinks[langID] = new Array();
hyperlinks[langID][1]=langPath + "home/index.html";
hyperlinks[langID][2]=langPath + "about/index.html";
hyperlinks[langID][3]=langPath + "whatsnew/index.html";
hyperlinks[langID][4]=langPath + "application/index.html";
hyperlinks[langID][5]=langPath + "mechanism/index.html";
hyperlinks[langID][6]=langPath + "approved/index.html";
hyperlinks[langID][7]=langPath + "committee/index.html";
hyperlinks[langID][8]=langPath + "meetings/index.html";
hyperlinks[langID][9]=langPath + "publication/index.html";
hyperlinks[langID][10]=langPath + "partners/index.html";
hyperlinks[langID][11]=langPath + "faq/index.html";
hyperlinks[langID][12]=langPath + "links/index.html";
hyperlinks[langID][13]=langPath + "secretariat/index.html";
hyperlinks[langID][14]=langPath + "archives/index.html";
hyperlinks[langID][15]=langPath + "contactus/index.html";

sectionImage[langID] = new Array("section01.gif","section02.gif","section03.gif","section04.gif","section05.gif","section06.gif","section07.gif","section08.gif","section09.gif","section10.gif","section11.gif","section12.gif","section13.gif","section14.gif","section15.gif","section16.gif","section17.gif","section18.gif");

//tc version
altTag[2] = new Array();
altTag[2][1]="舧迭";
altTag[2][2]="闽и";
altTag[2][3]="程穝";
altTag[2][4]="膀ビ叫冈薄";
altTag[2][5]="糵у挤蹿诀";
altTag[2][6]="莉у璸购";
altTag[2][7]="〆穦";
altTag[2][8]="穦某";
altTag[2][9]="";
altTag[2][10]="厚︹官︸";
altTag[2][11]="盽ǎ拜肈";
altTag[2][12]="闽挡硈";
altTag[2][13]="矪";
altTag[2][14]="戈畐";
altTag[2][15]="羛蹈и";
altTag[2][16]="璶ボ";
altTag[2][17]="呼瓜";
altTag[2][18]="╬留現郸羘";
altTag[2][19]="zh-hk";
altTag[2][20]="utf-8";

/*
hyperlinks[2] = new Array();
hyperlinks[2][1]="#";
hyperlinks[2][2]="#";
hyperlinks[2][3]="#";
hyperlinks[2][4]="#";
hyperlinks[2][5]="#";
hyperlinks[2][6]="#";
hyperlinks[2][7]="#";
hyperlinks[2][8]="#";
hyperlinks[2][9]="#";
hyperlinks[2][10]="#";
hyperlinks[2][11]="#";
hyperlinks[2][12]="#";

sectionImage[2] = new Array("section01.gif","section02.gif","section03.gif","section04.gif","section05.gif","section06.gif","section07.gif","section08.gif","section09.gif","section10.gif","section11.gif","section12.gif");
*/
//sc version
altTag[3] = new Array();
altTag[3][1]="欢迎词";
altTag[3][2]="关于我们 ";
altTag[3][3]="最新消息";
altTag[3][4]="基金申请详情 ";
altTag[3][5]="审批拨款机制";
altTag[3][6]="获批准计划";
altTag[3][7]="委员会";
altTag[3][8]="会议";
altTag[3][9]="出版刊物";
altTag[3][10]="绿色夥伴";
altTag[3][11]="常见问题";
altTag[3][12]="相关结连 ";
altTag[3][13]="秘书处";
altTag[3][14]="资料库";
altTag[3][15]="联络我们";
altTag[3][16]="重要告示";
altTag[3][17]="网站地图";
altTag[3][18]="私隐政策声明";
altTag[3][19]="zh-cnhk";
altTag[3][20]="utf-8";

/*
hyperlinks[3] = new Array();
hyperlinks[3][1]="#";
hyperlinks[3][2]="#";
hyperlinks[3][3]="#";
hyperlinks[3][4]="#";
hyperlinks[3][5]="#";
hyperlinks[3][6]="#";
hyperlinks[3][7]="#";
hyperlinks[3][8]="#";
hyperlinks[3][9]="#";
hyperlinks[3][10]="#";
hyperlinks[3][11]="#";
hyperlinks[3][12]="#";

sectionImage[3] = new Array("section01.gif","section02.gif","section03.gif","section04.gif","section05.gif","section06.gif","section07.gif","section08.gif","section09.gif","section10.gif","section11.gif","section12.gif");
*/
function printLeftMenu(selectPage,lang) {
	var folder = getLangFolder(lang);
	
	if(document.URL.toString().search('/text/')!=-1){	//text only version
		//document.write("<table width=\"153\" height=\"670\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">");
		document.writeln("<table width=\"153\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
		document.writeln("      <tr>");
		document.writeln("        <td width=\"153\" valign=\"top\" height=\"100%\">");
		document.writeln("        <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><ul>");
		var i = 1
		for(;i<=15;i++){
			if(i!=5)
			{
			document.writeln("            <li>");
			if (i <10){
				if (selectPage == i) {
				document.write("              <a href=\""+hyperlinks[lang][i]+"\"><b>"+altTag[lang][i]+"</b></a>");
				}else{
				document.write("              <a href=\""+hyperlinks[lang][i]+"\">"+altTag[lang][i]+"</a>");
				}
			}else{
				if (selectPage == i) {
				document.write("              <a href=\""+hyperlinks[lang][i]+"\"><b>"+altTag[lang][i]+"</b></a>");
				}else{
				document.write("              <a href=\""+hyperlinks[lang][i]+"\">"+altTag[lang][i]+"</a>");
				}
			}
			document.writeln("            </li>");
			}
		}
		document.write("        </ul></td></tr></table></td>");
		document.write("	  </tr>");
		document.write("	</table>");
	}else{	//Graphic version
		//document.write("<table width=\"153\" height=\"670\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">");
		document.writeln("<table width=\"153\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
		document.writeln("      <tr>");
		document.writeln("        <td width=\"153\" valign=\"top\" height=\"100%\" background=\"../../images/common/left.jpg\">");
		document.writeln("        <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
		var i = 1
		for(;i<=hyperlinks[langID].length-1;i++){
			if(i!=5)
			{
			document.write("            <tr>");
			if (i <10){
				if (selectPage == i) {
				document.write("              <td><a href=\""+hyperlinks[lang][i]+"\"><img src=\""+baseURL+"images/"+folder+"/btn_0"+i+"_over.jpg\" name=\"Image"+(i+5)+"\" width=\"153\" height=\"25\" border=\"0\" id=\"Image"+(i+5)+"\" alt=\""+altTag[lang][i]+"\" title=\""+altTag[lang][i]+"\" /></a></td>");
				}else{
				document.write("              <td><a href=\""+hyperlinks[lang][i]+"\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('Image"+(i+5)+"','','"+baseURL+"images/"+folder+"/btn_0"+(i)+"_over.jpg',1)\"><img src=\""+baseURL+"images/"+folder+"/btn_0"+(i)+".jpg\" width=\"153\" height=\"25\" border=\"0\" id=\"Image"+(i+5)+"\"  alt=\""+altTag[lang][i]+"\" title=\""+altTag[lang][i]+"\" /></a></td>");
				}
			}else{
				if (selectPage == i) {
				document.write("              <td><a href=\""+hyperlinks[lang][i]+"\"><img src=\""+baseURL+"images/"+folder+"/btn_"+i+"_over.jpg\" name=\"Image"+(i+5)+"\" width=\"153\" height=\"25\" border=\"0\" id=\"Image"+(i+5)+"\"  alt=\""+altTag[lang][i]+"\" title=\""+altTag[lang][i]+"\" /></a></td>");
				}else{
				document.write("              <td><a href=\""+hyperlinks[lang][i]+"\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('Image"+(i+5)+"','','"+baseURL+"images/"+folder+"/btn_"+(i)+"_over.jpg',1)\"><img src=\""+baseURL+"images/"+folder+"/btn_"+(i)+".jpg\" width=\"153\" height=\"25\" border=\"0\" id=\"Image"+(i+5)+"\"  alt=\""+altTag[lang][i]+"\" title=\""+altTag[lang][i]+"\" /></a></td>");
				}
			}
			document.writeln("            </tr>");
			}
		}
		document.write("        			<tr><td>&nbsp;</td></tr>");
/*		if (langID==1){
		document.write('        			<tr><td align="center"><a href="http://www.cmab-cd2012.gov.hk" target="_blank"><img src="http://www.isd.gov.hk/eng/images/cmab-cd2012.gif" alt="Please support the 2012 constitutional package" width="84" height="50" border="0"></a></td></tr>');
		}else if (langID==2){
		document.write('        			<tr><td align="center"><a href="http://www.cmab-cd2012.gov.hk" target="_blank"><img src="http://www.isd.gov.hk/chi/images/cmab-cd2012.gif" alt="叫や2012現よ" width="84" height="50" border="0"></a></td></tr>');		
		}else{
		document.write('        			<tr><td align="center"><a href="http://www.cmab-cd2012.gov.hk" target="_blank"><img src="http://www.isd.gov.hk/sim/images/cmab-cd2012.gif" alt="请支持2012政制方案" width="84" height="50" border="0"></a></td></tr>');
		}*/
		//Icon Starts
		/*if (langID==1)
		{
		document.write("        			<tr><td align='center'><a href='http://www.policyaddress.gov.hk/08-09/eng/policy.html' target='_blank'><img src='../../images/pa_08-09_en.jpg' alt='2008-09 Policy Address' border='0'></a></td></tr>");
		}
		else if (langID==2)
		{
		document.write("        			<tr><td align='center'><a href='http://www.policyaddress.gov.hk/08-09/chi/policy.html' target='_blank'><img src='../../images/pa_08-09_tc.jpg' alt='2008-09琁現厨' border='0'></a></td></tr>");
		}
		else
		{
		document.write("        			<tr><td align='center'><a href='http://sc.info.gov.hk/TuniS/www.policyaddress.gov.hk/08-09/chi/policy.html' target='_blank'><img src='../../images/pa_08-09_sc.jpg' alt='2008-09施政报告' border='0'></a></td></tr>");
		}*/
		//Icon Ends
		document.write("        </table></td>");
		document.write("	  </tr>");
		document.write("	</table>");
	}
}

function getTitleImage(selectPage,lang){
	var folder = getLangFolder(lang);
	if(document.URL.toString().search('/text/')!=-1){	//text only version
		document.write('<span class="TextonlyHeading">'+altTag[lang][selectPage]+'</span><br><br>');
	}else{
		document.write("<img src=\""+baseURL+"images/"+folder+"/"+sectionImage[lang][selectPage-1]+"\" alt=\""+altTag[lang][selectPage]+"\"  title=\""+altTag[lang][selectPage]+"\" /><br><br>");
	}
}