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' size=10pt>" +
		"	<!--SELECT_TITLE-->" +
		"	<!--SELECT_LINKS--><br>" +
		"	<!--CATEGORY_LINKS--><BR>" +
		"	<!--TOP_LINKS-->";
}

function showPage(PageIDStr)
{

	buildNavigation(PageIDStr);
	document.write(hpStr);
 
}

function addCategory(CatIDStr, CatStr, defaultShow)
{
	sImg = defaultShow? "minus.jpg" : "plus.jpg";
	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='images/" + sImg + "'" +
				 " ID=I_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") BORDER=0 align=absmiddle>&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 addCategory1(Topcat, CatIDStr, CatStr,defaultShow)
{
	sImg = defaultShow? "minus.jpg" : "plus.jpg";

sStyle = defaultShow? "black" : "none";
	SubStr ="<!--" + Topcat + "-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<DIV STYLE='cursor:hand'" +
				 " ID=C_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") NOWRAP>" +
				 "<IMG SRC='images/" + sImg + "'" +
				 " ID=I_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") BORDER=0 align=absmiddle>&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 addCategory2(Topcat, CatIDStr, CatStr,defaultShow)
{
	sImg = defaultShow? "minus.jpg" : "plus.jpg";
sStyle = defaultShow? "black" : "none";

	SubStr = "<!--" + Topcat + "-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<DIV STYLE='cursor:hand'" +
				 " ID=C_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") NOWRAP>" +
				 "<IMG SRC='images/" + sImg + "'" +
				 " ID=I_" + CatIDStr +
				 " onClick=clickCategory(" + char34 + CatIDStr + char34 + ") BORDER=0 align=absmiddle>&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 Style='color:black;'><A HREF='" + LinkUrl + " 'target='main'>" + CatStr + "</A><BR>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}
function addCategoryLink2(CatIDStr, CatStr, LinkUrl,Tar)
{
	SubStr  = "<!--" + CatIDStr + "-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<tr><td class='font4' valign='middle' align='left'>  <IMG SRC='images/newbu.gif' HSPACE='0' bORDER='0' width='7' height='7'></td><td class='font4' align='left'><B> <font color='#0066CC'><a href='" + LinkUrl + "' target='" + Tar + "'>" + CatStr + "</a></font></B></td></tr><BR>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
//document.write(SrcStr);
//hpStr = hpStr + SrcStr
	}
}
function addCategoryLink1(CatIDStr, CatStr, LinkUrl)
{
	SubStr  = "<!--" + CatIDStr + "-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "กก<A Style='color:black;'><A HREF='" + LinkUrl + " 'target='main'>" + CatStr + "</A><BR>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
	}
}
function setSelectTitle(TitleStr)
{
	SubStr = "<!--SELECT_TITLE-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		hpLinkWidth = 0;
		SrcStr = "<span style='font-size:10pt;font-family:Arial'>" + TitleStr + "<BR>" + "<SELECT style='font-size:10pt;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 = 'images/minus.jpg';
	}
	else 
	{
		txtObj.style.display = 'none';
		imgObj.src = 'images/plus.jpg';
	}
	window.event.cancelBubble=true;
}

function goPage(s)
{	
	window.open (s.options[s.selectedIndex].value,"_top")

}