
/*

JavaScript Navigation Page.
Built by John Majewski.  9/13/03

-- not very clean, but compatible and quick

*/

//------------------------------------------------------------------------------------
// EDIT THIS->
//------------------------------------------------------------------------------------

// list menu items

var navMenuItems = new Array(


[	"home", 		"Home"				],
[	"about", 		"About Us"			],
[	"certification", 	"Certification Trainings"	],
[	"lectures", 		"Lectures"			],
[	"products", 		"Manuals & Tools"		],
[	"consultation",		"Consultation Services"		],
[	"contact", 		"Contact Us"			],
[	"resources", 		"Patient Resources"		],
[	"Merchant2", 		"Order Now"			]


);

//------------------------------------------------------------------------------------

// Build list of menus items and href's

var navProperty = new Array(

	
[	"about.company", 		"Company", 					"../about/company.htm"			],
[	"about.principal", 		"Principal", 					"../about/principal.htm"		],
[	"certification.trainings", 	"Certification Trainings",			"../certification/trainings.htm"	],
[	"certification.course", 	"Course Offerings",				"../certification/course.htm"		],
[	"certification.registration", 	"On-line Registration",				"../certification/course.htm#online_registration"		],
[	"consultation.organization", 	"Organizational Development",			"../consultation/organization.htm"	],
[	"consultation.index",		"System Design Innovations",			"../consultation/index.htm#system"	],
[	"consultation.study", 		"Case Study",					"../consultation/study.htm"		],
[	"resources.support",		"Patient & Family Support",			"../resources/support.htm"		],
[	"resources.patient",		"Medications",					"../resources/patient.htm"		],
[	"resources.interventions",	"Non Medical Interventions",			"../resources/interventions.htm"	],
[	"Merchant2.form",		"Online Order Form",				"http://yhst-90616455459028.stores.yahoo.net/"		]

);


// Set Nav Delay
// 1000 = 1 second, 2000 = 2 seconds, etc.
var navDelay = 1000;


//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------



// build menus
var navAssembled = new Array();
var NavCurrPage;
var displayText;
var navSwitch = 0;
var navTimer;
navMenu = new Array(new Array(), new Array());
navHTML = new Array();
if (navPageName == null || navPageName == "" || navPageName == undefined) navPageName = "doesNotExist123456";


for (i=0; i < navMenuItems.length; i++)
{
	for (j=0; j < navProperty.length; j++)
	{
		var tmpTestNavProp = navProperty[j][0];
		var tmpTestNavItem = navMenuItems[i][0];


		if (tmpTestNavProp.match(tmpTestNavItem) != null)
		{
			if (navAssembled[navMenuItems[i][0]] != undefined && navAssembled[navMenuItems[i][0]] != null && navAssembled[navMenuItems[i][0]] != "")
			{
				if (tmpTestNavProp.match(navPageName) == null)
				{
					navAssembled[navMenuItems[i][0]] = navAssembled[navMenuItems[i][0]] + "&nbsp;-&nbsp;<a href='" + navProperty[j][2] + "' name='" + navProperty[j][1] + "' class='nav' onMouseOver = 'onLink();' onMouseOut = 'offLink();'>" + navProperty[j][1] + "</a>";

				}
				else
				{
					navAssembled[navMenuItems[i][0]] = navAssembled[navMenuItems[i][0]] + "&nbsp;-&nbsp;<b>" + navProperty[j][1] + "</b>";
				}

			}
			else
			{
				if (tmpTestNavProp.match(navPageName) == null)
				{
					navAssembled[navMenuItems[i][0]] = "";
					navAssembled[navMenuItems[i][0]] = "&nbsp;&nbsp;<a href='" + navProperty[j][2] + "' name='" + navProperty[j][1] + "' class='nav' onMouseOver = 'onLink();' onMouseOut = 'offLink();'>" + navProperty[j][1] + "</a>";
				}
				else
				{
					navAssembled[navMenuItems[i][0]] = "";
					navAssembled[navMenuItems[i][0]] = "&nbsp;&nbsp;<b>" + navProperty[j][1] + "</b>";
				}
			}


		}

	}

}


// Set error nav
navHTML[""] = "&nbsp;&nbsp;";


// Assemble Nav
for (z=0; z < navMenuItems.length; z++)
{
	// assemble nav html
	navHTML[navMenuItems[z][0]] = "&nbsp;&nbsp;<a href = '../" + navMenuItems[z][0] + "/' name = '" + navMenuItems[z][1] + "' class = 'nav' onMouseOver = 'onLink();' onMouseOut = 'offLink();'>" + navMenuItems[z][1] + "</a>&nbsp;&nbsp;>>" + navAssembled[navMenuItems[z][0]];

	// display nothing instead of undefined
	if (navAssembled[navMenuItems[z][0]] == undefined) navHTML[navMenuItems[z][0]] = "&nbsp;&nbsp;";

	// if no data is entered for nav element, display nothing
	if (navMenuItems[z][1] == "" || navMenuItems[z][1] == null) navHTML[navMenuItems[z][0]] = "&nbsp;&nbsp;";

	// if undefined error, display nothing
	if (navHTML[navMenuItems[z][0]] == "" || navHTML[navMenuItems[z][0]] == null || navHTML[navMenuItems[z][0]] == undefined) navHTML[navMenuItems[z][0]] = "&nbsp;&nbsp;";

	// set navCurrPage (the diplay first var) equal to the HTML output if the current page name matches the nav Item.
	if (navPageName.match(navMenuItems[z][0]) != null) 
	{
		navCurrPage = navHTML[navMenuItems[z][0]];
	}
		
}


function onLink()
{
clearTimeout(navTimer);
}

function offLink()
{
navTimer = setInterval("dispOnPage(navCurrPage)",navDelay);
}

function dispOnPage(displayText)
{

	//if IE 4+
	if (document.all) document.all.nav.innerHTML = displayText;
	
	//else if NS 4
	else if (document.layers)
	{
		document.ns4nav.document.ns4nav2.document.write(diplayText);
		document.ns4nav.document.ns4nav2.document.close();
	}
	
	//else if NS 6 (supports new DOM)
	else if (document.getElementById) document.getElementById("nav").innerHTML = displayText;
	
}



function displayNav(name, navSwitch)
{

//  navSwitch = 0 >>> returns nav to current page after delay
//  navSwitch = 1 >>> displays link info, then returns to current page after delay
//  navSwitch = 2 or anything else >>> displays link info, does not return to current page


clearTimeout(navTimer);

	if (navSwitch == 0 && (document.all||document.layers||document.getElementById))
	{
		navTimer = setTimeout("dispOnPage(navCurrPage)",navDelay);
	}
	else if (navSwitch == 1 && (document.all||document.layers||document.getElementById))
	{
		dispOnPage(navHTML[name]);
		navTimer = setInterval("dispOnPage(navCurrPage)",navDelay);
	}		
	else if (navSwitch == 2 || (navSwitch != 0 || navSwitch != 1) && (document.all||document.layers||document.getElementById))
	{
		dispOnPage(navHTML[name]);
	}
}





