var NavBar_Supported = false;

if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.appVersion.substring(0,1) > 3)
{
	NavBar_Supported = true;

	var newLineChar = String.fromCharCode(10);
	var char34 = String.fromCharCode(34);
	var FirstCRMsg = true;
	var hpStr;
	var hpLinkCnt = 0;
	var hpLinkWidth = 0;

	hpStr =	"<font face='arial' style='font-size:9pt'><IMG SRC='/taiwan/images/t.gif' WIDTH=130 HEIGHT=3 BORDER=0><br>" +
		"	<!--TITLE_LINKS-->" +
		"	<!--SELECT_TITLE-->" +
		"	<!--SELECT_LINKS-->" +
		"	<!--CATEGORY_LINKS--><BR>" +
		"	<!--TOP_LINKS-->";
}

function showPage(PageIDStr)
{
	buildNavigation(PageIDStr);
	document.write(hpStr);
}

function addCategory(CatIDStr, CatStr, defaultShow)
{
	sImg = defaultShow? "minus.gif" : "plus.gif";
	sStyle = defaultShow? "black" : "none";

	SubStr = "<!--CATEGORY_LINKS-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<DIV STYLE='cursor:hand'" +
				 " ID=C_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") NOWRAP>" +
				 "<IMG SRC='/taiwan/images/" + sImg + "'" +
				 " ID=I_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") ALIGN=middle BORDER=0 HEIGHT=9 WIDTH=9>&nbsp;" +
				 "<A STYLE='color:black;text-decoration:none;'" +
				 " HREF='noop' " +
				 " onfocus=" + char34 + "window.status='';" + char34 +
				 " onmouseover=" + char34 + "window.status='';" + char34 +
				 " onclick=" + char34 + "window.event.returnValue = false;" + char34 + ">" +
				 CatStr + "</A><BR>" +
				 "<DIV STYLE='display:" + sStyle + ";'" +
				 " ID=T_" + CatIDStr +
				 " onClick=" + char34 + "window.event.cancelBubble=true;" + char34 + ">" +
				 "<DIV STYLE='margin-left:12'><!--" + CatIDStr + "-->" + "</DIV>" +
				 "</DIV></DIV>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}

function addCategoryLink(CatIDStr, CatStr, LinkUrl)
{
	SubStr  = "<!--" + CatIDStr + "-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<A HREF='" + LinkUrl + "'>" + CatStr + "</A><BR><IMG SRC='/taiwan/images/1ptrans.gif' WIDTH=5 HEIGHT=10 BORDER=0><BR>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}

function setSelectTitle(TitleStr)
{
	SubStr = "<!--SELECT_TITLE-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		hpLinkWidth = TitleStr.length;
		SrcStr = "<span style='font-size:9pt;font-family:Arial'>" + TitleStr + "<BR>" + "<SELECT style='font-size:9pt;font-family:Arial' NAME='target' ONCHANGE='goPage(this);'>" + "<!--SELECT_LINK-->" +"</SELECT><br>";
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}

function addSelectList(LinkStr, LinkUrl, defaultSelection)
{
	SubStr = "<!--SELECT_LINK-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		hpLinkCnt += 1;
		SrcStr = "<OPTION VALUE='" + LinkUrl + "'";
		if (defaultSelection) SrcStr += " SELECTED";
		SrcStr += ">" + LinkStr;

		//Make the select box the same width as the link title.
		for (i = LinkStr.length+1; i < hpLinkWidth ; i++)
			SrcStr += "&nbsp;";

		SrcStr += SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}

function setTopLinkTitle(TitleStr)
{
	SubStr = "<!--TOP_LINKS-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = TitleStr + "<BR><DIV STYLE='margin-left:12;'><!--TOP_LINK--></DIV>";
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}

function setTopTitle(TitleStr)
{
	SubStr = "<!--TITLE_LINKS-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = TitleStr + "<P>";
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}

function clickCategory(CatIDStr) 
{
	var txtObj = document.all("T_" + CatIDStr);
	var imgObj = document.all("I_" + CatIDStr);

	if (txtObj.style.display == 'none')
	{
		txtObj.style.display = '';
		imgObj.src = '/taiwan/images/minus.gif';
	}
	else 
	{
		txtObj.style.display = 'none';
		imgObj.src = '/taiwan/images/plus.gif';
	}
	window.event.cancelBubble=true;
}

function goPage(s)
{	
	location.href = s.options[s.selectedIndex].value;
}