//Declare Variables
var tableHTML = new String;
var tableHTMLCount = 0;

try
{					
	//Set tableHTML variable with RightNav innerHTML contents					
	tableHTML = document.all("RightNav").innerHTML.toLocaleUpperCase();
									
	//Remove all "<TR>","<TBODY>" and "<TD>" tags from inner HTML
	while(tableHTMLCount <= tableHTML.length)
	{	
		
		//if inner HTML contains any "<TR>","<TBODY>" and "<TD>" tags remove from string
		if(tableHTML.indexOf("<TBODY>") != -1 || 
			tableHTML.indexOf("</TBODY>") != -1 ||
			tableHTML.indexOf("<TR>") != -1 ||
			tableHTML.indexOf("</TR>") != -1 ||
			tableHTML.indexOf("<TD>") != -1 ||
			tableHTML.indexOf("</TD>") != -1 ||
			tableHTML.indexOf("<TABLE>") != -1 ||
			tableHTML.indexOf("</TABLE>") != -1 ||
			tableHTML.indexOf("<SPAN>") != -1 ||
			tableHTML.indexOf("</SPAN>") != -1)
		{		
			
			//Replace TBODY HTML Tags with empty string
			tableHTML = tableHTML.replace("<TBODY>","")	;																
			tableHTML = tableHTML.replace("</TBODY>","");
									
			//Replace TR Tags with empty string											
			tableHTML = tableHTML.replace(GetStartElement("TR",tableHTML),"");																	
			tableHTML = tableHTML.replace("</TR>","");		
			
			//Replace TD Tags with empty string
			tableHTML = tableHTML.replace(GetStartElement("TD",tableHTML),"");						
			tableHTML = tableHTML.replace("</TD>","");
					
			//Replace TABLE Tags with empty String
			tableHTML = tableHTML.replace(GetStartElement("TABLE",tableHTML),"");						
			tableHTML = tableHTML.replace("</TABLE>","");
			
			//Replace SPAN Tags with empty String
			tableHTML = tableHTML.replace(GetStartElement("SPAN",tableHTML),"");						
			tableHTML = tableHTML.replace("</SPAN>","");	
			
		}
		else
		{
			//End loop by setting HTML count to table length
			tableHTMLCount = tableHTML.length;
		}
		
		//ADD to tableCount integer
		tableHTMLCount = tableHTMLCount + 1;
		
	}

	//Remove special characters from inner html														
	tableHTML = tableHTML.replace(/[^a-zA-Z 0-9]+/g,'');

	//Remove white spaces from inner html
	trimAll(tableHTML);
							
	//if inner html of table is empty remove dots spacer image
	if(tableHTML.length == 0)
	{
		document.all("dotsImgSpacer").style.display = "none";
	}
}
catch(e)
{
}

//function to remove all white spaces from a string
function trimAll(sString)
{
	try
	{
		//Remove whitespaces from left of string					
		while (sString.substring(0,1) == ' ')
		{
		
			sString = sString.substring(1, sString.length);
			
		}

		//Remove whitespaces from right of string	
		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
		
			sString = sString.substring(0,sString.length-1);
			
		}

		//Return string with no whitespaces	
		return sString;
	}
	catch(e)
	{
	
		return null;
	
	}
	
}

//function to get HTML Start element
function GetStartElement(elementName,tableHTML)
{
	try
	{
		if(tableHTML.indexOf("<"+elementName) != -1)
		{
			//Get HTML Tag from "<" to closing tag ">"
			htmlString = tableHTML.substring(tableHTML.indexOf("<"+elementName),tableHTML.length);
			htmlString = htmlString.substring(0,htmlString.indexOf(">")+1);

			//Return HTML String	
			return htmlString;
		}
	}
	catch(e)
	{
		return null;
	}
}