// create image object
if (document.images) {
	chi_off = new Image(57,20);
	chi_off.src = "/hk/library/toolbar/en-hk/images/icon_chi_off.gif";
	chi_on = new Image(57,20);
	chi_on.src = "/hk/library/toolbar/en-hk/images/icon_chi_on.gif";
	eng_off = new Image(107,20);
	eng_off.src = "/hk/library/toolbar/en-hk/images/icon_eng_off.gif";
	eng_on = new Image(107,20);
	eng_on.src = "/hk/library/toolbar/en-hk/images/icon_eng_on.gif";
}

// function to change images when mouse over
function ChangeImageOver(img) {
	if (document.images)
		document.images[img].src = eval(img + "_on.src")
}

// function to change images when mouse out
function ChangeImageOut(img) {
	if (document.images)
		document.images[img].src = eval(img + "_off.src")
}

// function to create Chinese-English Switching button
function drawVersionToolbar(version) {
	switch(version) {
	case "chi":
		imageObj = "eng"
		fileName = self.location.href.replace("_c.asp",".asp");
		if ( self.location.href.indexOf(".asp") == -1 ){
			if ( self.location.href.charAt(self.location.href.length-1) == "/" ){
				fileName = self.location.href + "default.asp";
			}
		}
//		fileName = "default.htm"
		break;
	case "eng":
		imageObj = "chi"
		fileName = self.location.href.replace(".asp","_c.asp");
		if ( self.location.href.indexOf(".asp") == -1 ){
			if ( self.location.href.charAt(self.location.href.length-1) == "/" ){
				fileName = self.location.href + "default_c.asp";
			}
		}
		if (self.location.href.indexOf("?") > -1) {
			cutPos = self.location.href.indexOf("?");
			fileName = self.location.href;
			fileName = fileName.substring(0,cutPos) + "default_c.asp";
		}
//		fileName = "default_c.htm"
		break;
	}

	HTMLStr5 = '<table border=0 cellpadding=0 cellspacing=0 width=100% height=20 bgcolor="#FFFFFF">'
	HTMLStr5 += '<tr><td width=5 bgcolor="#a1d7c9"><img src="/hk/images/1ptrans.gif" border=0 width=5></td><td bgcolor="#a1d7c9"><a href="' + fileName + '"' + ' onMouseOver="ChangeImageOver(' + "'" + imageObj + "'" + ')"' + ' onMouseOut="ChangeImageOut(' + "'" + imageObj + "'" + ')"' + '><img name="' + imageObj + '" src="' + eval(imageObj + "_off.src") + '" height=20 alt="" border="0"></a></td></tr>'
	HTMLStr5 += '</table>'
	document.write(HTMLStr5);
}

// function to create Back Home button
function drawBackHomeBar(version) {
	switch(version) {
	case "eng":
		linkObj = "eng"
		fileName = "default.htm"
		break;
	case "chi":
		linkObj = "chi"
		fileName = "default_c.htm"
		break;
	}

	HTMLStr6 = '<table border=0 cellpadding=0 cellspacing=0 width=100% height=20 bgcolor="#FFFFFF">'
	HTMLStr6 += '<tr><td colspan=2 height=1><img src="/hk/images/1ptrans.gif" width=1 height=1 border=0></td></tr>'
	HTMLStr6 += '<tr><td width=5 bgcolor="#7fc4cb"><img src="/hk/images/1ptrans.gif" border=0 width=5></td><td bgcolor="#7fc4cb"><a href="' + fileName + '"' + ' onMouseOver="ChangeImageOver(' + "'backHome_" + linkObj + "'" + ')"' + ' onMouseOut="ChangeImageOut(' + "'backHome_" + linkObj + "'" + ')"' + '><b><img name="backHome_' + linkObj + '" src="images/backHome_' + linkObj + '_off.gif" border="0"></b></a></td></tr>'
	HTMLStr6 += '</table>'
	document.write(HTMLStr6);
}

function makeHomePage(){
 if (navigator.userAgent.indexOf("Win")  > -1) {
	if (navigator.appName == "Microsoft Internet Explorer") 
	  if (navigator.userAgent.substring((MSIEIndex + 5),(MSIEIndex + 6)) >= 5) {
		oHome.style.behavior='url(#default#homepage)';
	  	oHome.setHomePage('http://www.microsoft.com/hk');
	  }
	  else
          {
		alert("Thank you for choosing to have Microsoft Hong Kong Webpage as your home page. When you click 'OK' you will be asked what you want to do. Please select 'Open this file from its current location' and click 'OK'");
		location.href = "start.reg";
	  }
	else if (parseInt(navigator.appVersion) >= 4 ) {
		alert("Thank you for choosing to have Microsoft Hong Kong Webpage as your home page. When you click 'OK' you will be asked what you want to do. Please select 'Open this file from its current location' and click 'OK'");
		location.href = "navistart.reg";
	     }
 }
 else if (navigator.userAgent.indexOf("Mac") > -1)
	{
	alert("Thanks for choosing to have Microsoft Hong Kong Webpage as your home page. On your Mac: Ctrl+Click the page background and choose 'Set Home Page' from the popup menu (Internet Explorer Only)");
	}
}

function writelicensing(){
	document.write('<br><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>');
	document.write('<TR>');
	document.write('<td width=15 rowspan=2><img src="/hk/images/1ptrans.gif" width=15 height=1 border=0></TD>');
	document.write('<TD nowrap>');
	document.write('<font size=1 face="Verdana, Arial, Helvetica" class=copy>English will prevail in case of inconsistencies between the English and Chinese verison.</font><br>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
}

function cwritelicensing(){
	if (document.all){
		htmlstr = unescape("%u672C%u7DB2%u7AD9%u5167%u5BB9%u4E4B%u4E2D%u82F1%u6587%u7248%u672C%u5982%u6709%u5DEE%u7570%uFF0C%u4E00%u6982%u4EE5%u82F1%u6587%u7248%u672C%u70BA%u6E96%u3002");
		document.write('<br><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>');
		document.write('<TR>');
		document.write('<td width=15 rowspan=2><img src="/hk/images/1ptrans.gif" width=15 height=1 border=0></TD>');
		document.write('<TD nowrap>');
		document.write('<span class="chi">' + htmlstr + '</span><br>');
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
	} else{
		document.write('<br><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>');
		document.write('<TR>');
		document.write('<td width=15 rowspan=2><img src="/hk/images/1ptrans.gif" width=15 height=1 border=0></TD>');
		document.write('<TD nowrap>');
		document.write('<span class="chi">本網站內容之中英文版本如有差異，一概以英文版本為準。</span><br>');
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
	}
}
