// Display the smarTours navbar with current page indicated by non-linked text

function DisplayNavBar(){

	var navItemsTop = [ ["index.htm", "Home"],
						["map.htm", "Map"],
						["sa.htm", "South Africa and Safari"],
						["scandinavia.htm", "Scandinavian Explorer"],
						["orient.htm", "The Orient"],
						["europe.htm", "Eastern Europe"],
						["vietnam.htm", "Vietnam Discovery"],
						["china.htm", "China and the Yangtze River"],
						["australia.htm", "Australia, New Zealand and Fiji"],
						["nile.htm", "Nile Splendors"],
						["samerica.htm", "South America"],
						["india.htm", "India and Nepal"],
						["turkey.htm", "Turkey"],
						["borneo.htm", "Borneo"],
						["kenya.htm", "Kenya"],
						["italy.htm", "Italy"],
						["russia.htm", "Cruise of the Czars"],
						["tahiti.htm", "New Zealand"],
						["japan.htm", "Japan"] ]

	var navItemsBottom = [ ["hotels.htm", "Hotels"],
						["letters.htm", "Travelers' Letters"],
						["deals.htm", "Hot Deals"],
						["contact.asp", "Contact Us"],
						["privacy.htm", "Privacy Policy"],
						["terms.htm", "Terms and Conditions"]
						["insurance.htm", "Comprehensive Travel Insurance"]]

	var str = "|&nbsp;"
	var i, sLinkText, sStyle

	var regExp = / /g   // match each space char, for later conversion to non-breaking space
	var sURL = new String(window.location);
	// could also reference window.location.href or location.href
	var sFileName = sURL.substr(sURL.lastIndexOf("/")+1);
	// document.write('sFileName = ' + sFileName + '<br><br>')
	// document.write('navItemsTop.length = ' + navItemsTop.length + '<br>')
	// document.write('navItemsBottom.length = ' + navItemsBottom.length + '<br><br>')
	// fix sFileName if page was requested as default directory
	if (sFileName == "")
	{
		sFileName = "index.htm"
	}

	// cycle through the navItemsTop array, building the top portion of the navbar. The 
	// number of rows in the array matches the "for" loop upper bound.
	for (i=0;i<navItemsTop.length;i++){
		sLinkText = navItemsTop[i][1]
		if (i%2 == 0)
		{
			sStyle = "navred"
		}
		else
		{
			sStyle = "navcyan"
		}
		if (sFileName == navItemsTop[i][0])
		{
			// build non-linked, with text non-breaking spaces to keep the text from wrapping
			str += sLinkText.replace(regExp, "&nbsp;") + '&nbsp;| '
		}
		else
		{
			// build linked text, with non-breaking spaces to keep the text from wrapping
			str += '<a href="' + navItemsTop[i][0] + '"><span class="' + sStyle + '">' + sLinkText.replace(regExp, "&nbsp;") + '</span></a>&nbsp;| '
		}
	}

	str += "<br><br>|&nbsp;"

	// cycle through the navItemsBottom array, building the bottom portion of the navbar. The 
	// number of rows in the array matches the "for" loop upper bound.
	for (i=0;i<navItemsBottom.length;i++){
		sLinkText = navItemsBottom[i][1]
		if (i%2 == 0)
		{
			sStyle = "navred"
		}
		else
		{
			sStyle = "navcyan"
		}
		if (sFileName == navItemsBottom[i][0])
		{
			// build non-linked, with text non-breaking spaces to keep the text from wrapping
			str += sLinkText.replace(regExp, "&nbsp;") + '&nbsp;| '
		}
		else
		{
			// build linked text, with non-breaking spaces to keep the text from wrapping
			str += '<a href="' + navItemsBottom[i][0] + '"><span class="' + sStyle + '">' + sLinkText.replace(regExp, "&nbsp;") + '</span></a>&nbsp;| '
		}
	}

	return (str)

}

document.write('<STYLE TYPE="TEXT/CSS">')
document.write('.navred {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 7.5pt; color: #ff0000; text-decoration: underline}\n')
document.write('.navcyan {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 7.5pt; color: #00c0f9; text-decoration: underline}\n')
document.write('.navnolink {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 7.5pt; color: #000000; text-decoration: none}\n')
document.write('</STYLE>')

document.write('<table border="0" cellpadding="0" cellspacing="0" width="80%" align="center"><tr><td><p class="navnolink" align="center">');
document.write(DisplayNavBar());
document.write('</p></td></tr></table>');