////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  textnav_support.js
//
//  version 1.0  2/5/2003
//
//  copyright 2003 Neal W. Gronlund
//                 Gronlund Software, Inc.
//                 PO Box 9864
//                 Seattle, WA  98109
//                 neal@gronlund.com
//  all rights reserved
//  
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////


// Nav Data Table
//
//                            page        indent     displayed  
//                            name        level        text                                      href
//                    -------------------- ---  -------------------------------------     -----------------------
var navDataTable = [[ "home"              , 1 , "Home"                                 , "index.shtml"            ],
                    [ "services"          , 1 , "Services"                             , "services.shtml"         ],
                    [ "philosophy"        , 1 , "Philosophy"                           , "philosophy.shtml"       ],
                    [ "clients"           , 1 , "Clients"                              , "clients.shtml"          ],
                    [ "projects"          , 1 , "Projects / Case Studies"              , "projects.shtml"         ],
					[ "pastprojects"      , 2 , "Past Projects Summary"                , "projects_overview.shtml"],
                    [ "project1"          , 2 , "Case Study 1"                         , "project_1.shtml"        ],
					[ "project2"          , 2 , "Case Study 2"     			           , "project_2.shtml"        ],
                    [ "project3"          , 2 , "Case Study 3"                         , "project_3.shtml"        ],
   		  		    [ "project4"          , 2 , "Case Study 4"                         , "project_4.shtml"        ],
//		            [ "project5"          , 2 , "Case Study 5"                         , "project_5.shtml"        ],
//		            [ "project5a"         , 3 , "Sub-Project: Site Design"             , "project_5a.shtml"       ],
//		            [ "project5b"         , 3 , "Sub-Project: CMS"                     , "project_5b.shtml"       ],
                    [ "articles"          , 1 , "Articles"                             , "articles.shtml"         ],
                    [ "presentations"     , 1 , "Presentations"                        , "presentations.shtml"    ],
                    [ "resources"         , 1 , "Resources"                            , "resources.shtml"        ],
                    [ "cm"                , 2 , "Content Management"                   , "res_cm.shtml"           ],					
                    [ "ia"                , 2 , "Information Architecture & Usability" , "res_ia.shtml"           ],		
	                [ "webdesign"         , 2 , "Web Design, Development & Teams"      , "res_webdesign.shtml"    ],	
	                [ "hotspots"          , 2 , "Hot Spots Analysis"                   , "res_hotspots.shtml"     ],	
					[ "inventory"         , 2 , "Web Content Inventory"                , "res_inventory.shtml"    ],	
					[ "about"             , 1 , "About the Company"                    , "about.shtml"            ],
					[ "aboutmargie"       , 2 , "About Margie"                         , "about_Margie.shtml"     ],			    
					[ "contact"           , 1 , "Contact"                              , "contact.shtml"          ],
				    [ ""                  , 0 , ""                                     , ""                       ]];  //<- do not edit!
																											//must remain as last line
																																																					//must remain as last line
// Desired indent for each level in pixels
// (not used for Navigator 4 because of browser bug)

var indentPixels = 20;


function DoTextNav(pageName)
{
	var currPage             = -1;
	var beginLevel1          = -1;
	var beginLevel2          = -1;
	var lastLevel2           = -1;
	var lastLevel3           = -1;
	var lowestLevelDisplayed = -1;
	var displayIndex         = -1;
	var currIndent           = 1;
	
    // find index corresponding to pageName
	currPage = 0;
	while (pageName != navDataTable[currPage][0])
	{
		if (navDataTable[currPage][1] == 0)
		{
			document.write('#### ERROR:<br>unknown page name "', pageName, '"');
			return;
		}
		
		currPage++;
	}

	// determine lowest indent level to be displayed
	lowestLevelDisplayed = navDataTable[currPage][1]
	if (navDataTable[currPage + 1][1] > navDataTable[currPage][1])
		lowestLevelDisplayed++;
		
	// determine first and last item to display for each indent level
	if (lowestLevelDisplayed == 3)
	{
		beginLevel2 = currPage;
		while (navDataTable[beginLevel2][1] != 2)
			beginLevel2--;
		
		lastLevel3 = currPage;	
		while (navDataTable[lastLevel3 + 1][1] > 2)
			lastLevel3++;
	}

	if (lowestLevelDisplayed >= 2)
	{
		beginLevel1 = currPage;
		while (navDataTable[beginLevel1][1] != 1)
			beginLevel1--;
		
		lastLevel2 = currPage;	
		while (navDataTable[lastLevel2 + 1][1] > 1)
			lastLevel2++;
	}
	
    // traverse navDataTable and display appropriate nav text lines
	displayIndex = 0;
	while (navDataTable[displayIndex][1] != 0)
	{
		if ((navDataTable[displayIndex][1] == 1) ||               // always display level 1
		   				((lowestLevelDisplayed > 1) && (navDataTable[displayIndex][1] == 2) && 
		                      (displayIndex > beginLevel1) && (displayIndex <= lastLevel2)) ||
		   				((lowestLevelDisplayed > 2) && (navDataTable[displayIndex][1] == 3) && 
		                      (displayIndex > beginLevel2) && (displayIndex <= lastLevel3)))
		{
			switch (navDataTable[displayIndex][1] - currIndent)
			{
			case 1:
				document.write('<ul class="textnavul___">\n');
				break;
			case -1:
				document.write('</ul>\n');
				break;
			case -2:
				document.write('</ul>\n</ul>\n');
			}
			
			currIndent = navDataTable[displayIndex][1];
					
			if ((navDataTable[displayIndex][1] == 2) || (navDataTable[displayIndex][1] == 3))
				document.write('<li>');
		
			if (displayIndex != currPage)
				document.write('<p><a href="', navDataTable[displayIndex][3], '" class="textnav___"');
			else
				document.write('<p class="textnavcur___"');
				
			document.write('>', navDataTable[displayIndex][2]);
			
			if (displayIndex != currPage)
				document.write('</a></p>\n');
			else
				document.write('</p>\n');
		}
		
		displayIndex++;
	}

	if (currIndent == 2)
		document.write('</ul>\n');
	else if (currIndent == 3)
		document.write('</ul>\n</ul>\n');
}

// detect navigator 4 (or earlier)
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
			&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
			&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4 = (is_nav && (is_major <= 4));

document.write('<style media="screen" type="text/css">\n');
document.write('a.textnav___:link    { color:black; font-weight: normal; text-decoration: none; ');
document.write('font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; }\n');
document.write('a.textnav___:visited { color:black; font-weight: normal; text-decoration: none; ');
document.write('font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; }\n');
document.write('a.textnav___:hover   { color:#CC0000; font-weight: normal; text-decoration: underline; ');
document.write('font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; }\n');
document.write('p.textnavcur___      { color:black; font-weight: bold; text-decoration: none; ');
document.write('font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; }\n');

if (is_nav4)
	document.write('ul.textnavul___      { list-style-type: none; }\n');
else
	document.write('ul.textnavul___      { list-style-type: none; margin-left: ', indentPixels, 'px; }\n');
	
document.write('</style>');

