var IsIEPlus = false
//alert(navigator.userAgent);
if (navigator.userAgent.indexOf("MSIE")    != -1 && 
	navigator.userAgent.indexOf("Windows") != -1 && 
	navigator.appVersion.substring(0,1) > 3)
{
	IsIEPlus = true;
}

if (IsIEPlus)
{
	var newLineChar = String.fromCharCode(10);
	var char34 = String.fromCharCode(34);
	var FirstCRMsg = true;
	var hpStr;
	var hpLinkCnt = 0;
	var hpLinkWidth = 0;
	var voto = "0";

	hpStyle =	"<STYLE type='text/css'>" +
				" A:link			{ color:#003399; }" +
				" A:visited			{ color:#003399; }" +
				" A:hover			{ color:red;     }" +
				"</STYLE>";
	document.write(hpStyle);

	hpStr =	"<TABLE BORDER=0 WIDTH=200 CELLPADDING=0 CELLSPACING=0 BGCOLOR='#FFFFFF'>" +
		"<TR>" +
		"<TD WIDTH=150 VALIGN=TOP><font face='verdana,arial,helvetica' size=1>" +
		"<!--CATEGORY_LINKS--><BR>" +
		"	<!--TOP_LINKS-->" +
		"</TD>"  + 
		"</TR>" + 
		"</TABLE>"
		}

function showHomePage(PageIDStr)
{
	buildNavigation(PageIDStr);
//	buildHeadline(PageIDStr);

	//alert(hpStr);
	document.write(hpStr);
}

function setHomePageLinkTitle(TitleStr)
{
	SubStr = "<!--HOMEPAGE_LINKS-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		hpLinkWidth = TitleStr.length;
		SrcStr = TitleStr + "<BR>" +
				 "<SELECT NAME='target' onChange='goHomePage(this);'>" +
				 "<!--HOMEPAGE_LINK-->" +
				 "</SELECT>";
		hpStr = hpStr.replace(SubStr, SrcStr);	
	}
}

function addHomePageLink(LinkStr, LinkUrl, defaultSelection)
{
	SubStr = "<!--HOMEPAGE_LINK-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		hpLinkCnt += 1;
		SrcStr = "<OPTION VALUE='" + hpLinkCnt + "'";
		if (defaultSelection) SrcStr += " SELECTED";
		SrcStr += ">" + LinkStr;
		
		//Make the select box the same width as the link title.
		for (i = LinkStr.length+1; i < hpLinkWidth+2; i++)
			SrcStr += "&nbsp;";

		SrcStr += SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);
		
		hpStr += "<A ID=ID_HPLink" + hpLinkCnt + " STYLE='display:none' HREF='" + LinkUrl + "'>1</A>";
	}
}

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='../images/" + sImg + "' ALT='*'" +
				 "     ID=I_" + CatIDStr +
				 "     onClick=clickCategory(" + char34 + CatIDStr + char34 + ") ALIGN=middle BORDER=0>&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 + ">" +
				 "<B>" + CatStr + "</B></A><BR>" +
				 "<DIV STYLE='display:" + sStyle + ";'" +
				 "     ID=T_" + CatIDStr + 
				 "     onClick=" + char34 + "window.event.cancelBubble=true;" + char34 + ">" +
				 "<DIV STYLE='margin-left:12;'><FONT SIZE=1><!--" + 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>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);	
	}
}

function setTopLinkTitle(TitleStr)
{
	SubStr = "<!--TOP_LINKS-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<B>" + TitleStr + "</B><BR><DIV STYLE='margin-left:12;'><!--TOP_LINK--></DIV>";
		hpStr = hpStr.replace(SubStr, SrcStr);	
	}
}

function addTopLink(LinkStr, LinkUrl)
{
	SubStr  = "<!--TOP_LINK-->";
	if (hpStr.indexOf(SubStr) >= 0)
	{
		SrcStr = "<A HREF='" + LinkUrl + "'>" + LinkStr + "</A><BR>" + SubStr;
		hpStr = hpStr.replace(SubStr, SrcStr);	
	}
}


function goHomePage(s)
{	
	//window.location.href = s.options[s.selectedIndex].value;
	
	option = s.options[s.selectedIndex].value;
	elmID = "ID_HPLink" + option
	obj = document.all(elmID);
	if (obj != null)
		obj.click();
}

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.gif';
	}
	else 
	{
		txtObj.style.display = 'none';
		imgObj.src = '../images/plus.gif';
	}
	window.event.cancelBubble=true;
}

